Jump to content


Photo
- - - - -

[CR] Insert State Into JKI State Machine (Quick Drop Plugin)


  • Please log in to reply
12 replies to this topic

#1 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 11 September 2010 - 03:19 PM

Posted Image

Name: Insert State Into JKI State Machine (Quick Drop Plugin)
Submitter: jgcode
Submitted: 11 Sep 2010
File Updated: 03 Jan 2011
Category: Quick Drop Plugins
LabVIEW Version: 2009
License Type: BSD (Most common)

Insert State Into JKI State Machine v1.3-1

Copyright © 2010, Jonathon Green; JGCODE
All rights reserved.

Author: Jonathon Green
LAVA Name: jgcode
Contact Info: Contact via PM on lavag.org

LabVIEW Versions:
LabVIEW 2009

Dependencies:
No Dependencies

Description:
Contains a Quick Drop Plugin Tool Menu Item which adds a State to a JKI State Machine. This tool will allow you to create either a new state in a section or a complete new section whilst automatically handling the template's syntax. If a new state is selected then it is added after the current visible state and the current section's frame is used as the template frame. If a new section is added it is added after the current visible section and the Core frame is used as the template frame. Correct Syntax (e.g. proper name, single spaces) are forced but can be overriden (e.g. to achieve capitalisation) using a period "." at the end of the text entry.

This package will install the quick drop plugin to LabVIEW\resource\dialog\QuickDrop\plugins and the tool menu item to LabVIEW\project\JGCODE ToolsSupport files are installed at vi.lib\addons\_JGCODE Toolkits\insert_state_into_jki_state_machine. See here to learn more about creating your own keyboard shortcuts using Quick Drop Plugins.

Note: This tool assumes that the template structure of the JKI State Machine will not be altered in any way.

Installation and Instructions:
Install package using VIPM.
*Ensure that the j.vi does not already exist as a quick drop plugin, if so you will have to manual manipulate the install.
If dependencies exist, then install provided .vipc file.

If the VI contains only one JKI State Machine then just run the plugin otherwise, use the mouse to select the case structure you want to manipulate.

Quick Drop:
Press Ctrl + Space to activate Quick Drop on this VI
Enter the name of the State in the Quick Drop Combo Box
Press Ctrl + J to create a new State
Or
Press Ctrl + Shift + J to create a new Section

Tool Menu:
Select the item from the menu
Enter the name of the State and check whether to create a new State or new Section
Press Ok

Undo is supported with the plugin.

Examples:
No Examples supplied

Known Issues:
No Known Issues

Acknowledgements:
Darren Nattinger
Eric BOBILLIER and Ton Plomp

Version History (Changelist):
1.3-1 2010 09 30
Added (): Quick Drop combobox can force syntax and non-capitialisation. Names are now checked for correct syntax, including proper case and single spaces between words and no whitespace either side.

1.1-1 2010 09 13
Fixed (): Fixed broken run arrow issue. Thanks to Eric BOBILLIER for finding and posting the workaround.

1.0-1 2010 09 11
Added (): Initial release of the code (LabVIEW 2009)

License:
BSD (http://opensource.or...bsd-license.php)
Copyright © 2010, JGCODE
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of JGCODE nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY JGCODE ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL JONATHON GREEN BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Support:
If you have any problems with this code or want to suggest features:
please go to lavag.org and Navigate to LAVA > Resources > Code Repository (Certified) and search for the Insert State Into JKI State Machine support page.

Distribution:
This code was downloaded from the LAVA Code Repository found at lavag.org

Click here to download this file

#2 Bobillier

Bobillier

    Very Active

  • Members
  • PipPipPip
  • 146 posts
  • Location:Rennes France
  • Version:LabVIEW 2009
  • Since:2009

Posted 12 September 2010 - 11:09 AM

Hi Jonathon
Few days ago,I have propose similar tools on JKI Forum Here . Have you see it ? It's really near your tool but run like JKI RCF PlugIn.
Like you, i have find same issue arround break arrow. Certainly a scripting issue. Perhapse solve in LV2010 ?
My solution is to save automaticaly the vi before quit tool.( only possible if the vi is all ready save on hard drive)
Eric

#3 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 12 September 2010 - 12:24 PM

Hi Jonathon
Few days ago,I have propose similar tools on JKI Forum Here . Have you see it ? It's really near your tool but run like JKI RCF PlugIn.
Like you, i have find same issue arround break arrow. Certainly a scripting issue. Perhapse solve in LV2010 ?
My solution is to save automaticaly the vi before quit tool.( only possible if the vi is all ready save on hard drive)
Eric


Hi Eric

I certainly have been following your work (and with Ton too).
In fact, in the readme above you will see I included you in the acknowledgements (and made a mention in video).

I did see your code where you save the VI but I did not want to do that in this case, or handle new-VI (unsaved) case.

The reason for this tool was that I wanted to speed up my workflow when I insert a state.
This was probably the thing that takes me the longest to do.
Do you have any ideas in mind for other tools with respect to JKI State Machine?

Cheers

-Jon

#4 ShaunR

ShaunR

    LabVIEW Archetype

  • Members
  • PipPipPipPipPipPip
  • 2,222 posts
  • Version:LabVIEW 2009
  • Since:1994

Posted 12 September 2010 - 01:22 PM

Hi Eric

I certainly have been following your work (and with Ton too).
In fact, in the readme above you will see I included you in the acknowledgements (and made a mention in video).

I did see your code where you save the VI but I did not want to do that in this case, or handle new-VI (unsaved) case.

The reason for this tool was that I wanted to speed up my workflow when I insert a state.
This was probably the thing that takes me the longest to do.
Do you have any ideas in mind for other tools with respect to JKI State Machine?

Cheers

-Jon

Maybe worth exploring. But if you edit the case name after insertion (say insert a space then delete it). The broken arrow disappears.
A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort. (Herm Albright 1876-1944).

Founder and general mischief maker on www.labview-tools.com.
SQlite aficionado and websocket zealot.
If it 'aint in LabVIEW, then you 'aint got a clue!

#5 Bobillier

Bobillier

    Very Active

  • Members
  • PipPipPip
  • 146 posts
  • Location:Rennes France
  • Version:LabVIEW 2009
  • Since:2009

Posted 12 September 2010 - 09:47 PM

Hi Jonathon

Thanks for yours acknowledgements. :thumbup1:

After few tests, i have find a solution to break arrow issue. In fact it's arround default case. You just need to redefine it and the arrow isn't break. see my solution in the red box below.

Cheers

Eric

Break arrow issue solution.png

#6 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 12 September 2010 - 10:36 PM

Thanks for yours acknowledgements. :thumbup1:


You are welcome!

After few tests, i have find a solution to break arrow issue. In fact it's arround default case. You just need to redefine it and the arrow isn't break. see my solution in the red box below.


Eric this is great (and thanks for posting too Shaun)
I have found you only need less code, but the principle is the same: toggle the default case.


Toggle.png


Does this work for you?



Now that the broken run arrow is no longer an issue I have uploaded a fix: version 1.1.
Here is the video (it got mundged with the starting post was automatically updated) - but now the run arrow issue is fixed.

<object id="scPlayer" class="embeddedObject" width="1122" height="876" type="application/x-shockwave-flash" data="http://content.scree...swfplayer.swf"> <param name="movie" value="http://content.scree...swfplayer.swf"> <param name="quality" value="high"> <param name="bgcolor" value="#FFFFFF"> <param name="flashVars" value="thumb=http://content.screencast.com/users/jgcode/folders/LAVA%20CR/media/c275b677-922c-42b8-a699-ce4c1b7bd0bb/FirstFrame.jpg&containerwidth=1122&containerheight=876&content=http://content.screencast.com/users/jgcode/folders/LAVA%20CR/media/c275b677-922c-42b8-a699-ce4c1b7bd0bb/Insert%20State%20Into%20JKI%20State%20Machine.swf&blurover=false"> <param name="allowFullScreen" value="true"> <param name="scale" value="showall"> <param name="allowScriptAccess" value="always"> <param name="base" value="http://content.scree...ce4c1b7bd0bb/"> </object>

#7 crelf

crelf

    I'm a LAVA, not a fighter.

  • V I Engineering, Inc.
  • 5,742 posts
  • Version:LabVIEW 2012
  • Since:1993

Posted 13 September 2010 - 01:34 AM

Nice job Jon - looks good :thumbup1:

post-181-1170858537.png


#8 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 13 September 2010 - 02:02 AM

Nice job Jon - looks good :thumbup1:



But not worthy of a rep point? ;)
Probably should take some off for the terrible commentary on the video.
Apologies to everyones ears.
-JG



#9 Bobillier

Bobillier

    Very Active

  • Members
  • PipPipPip
  • 146 posts
  • Location:Rennes France
  • Version:LabVIEW 2009
  • Since:2009

Posted 13 September 2010 - 08:26 AM

Eric this is great (and thanks for posting too Shaun)
I have found you only need less code, but the principle is the same: toggle the default case.

Does this work for you?


Nice

It's work for me too. and i upgrade my plugIn on JKI Forum

Cheers

Eric

#10 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 13 September 2010 - 09:05 AM

It's work for me too


Sweet!
Thanks for checking.

#11 Mark Balla

Mark Balla

    Extremely Active

  • Premium Member
  • 490 posts
  • Location:Gurnee Illinois
  • Version:LabVIEW 2011
  • Since:1997

Posted 15 September 2010 - 04:38 AM

Certified 9-15-2010
Placed in Quick Drop Plugin Category.

#12 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 15 September 2010 - 05:02 AM

Certified 9-15-2010
Placed in Quick Drop Plugin Category.


Thanks mate.

#13 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 30 September 2010 - 10:40 AM

screenshot2.png


A small update to handle a little issue with the quick drop combo box...


Version History (Changelist):
1.3-1 2010 09 30
Added (): Quick Drop combobox can force syntax and non-capitialisation. Names are now checked for correct syntax, including proper case and single spaces between words and no whitespace either side.

So in QD if you Type "Load For..." it converts it to "Load for..."
So I decided to handle this case plus syntax in general.

Load for.png


Before:
Before.png

After:
After.png

And in the edge case that you want to override this Syntax, you can, by placing a period as the last character:
force.png


Forced.png


Cheers
-JG