Jump to content

Scripted Comments?


Recommended Posts

Hello all,

This is my first post ever, so "Hello, World!"

Basically, I'm trying to discover the method of using VI Scripting to create Front Panel and Block Diagram comments.

I know, I know, who ever wants to comment their code? I, for one, think that <CAN_OF_WORMS LID="OPEN">even though LabVIEW is a self-documenting language, there are still many times that comments are helpful and even necessary.</CAN_OF_WORMS> That being said, I've plowed through the many possibilities that the 'New VI Object' node allows and have found two Nodes that act as comments for a Front Panel, but as for the Block Diagram, nothing.

Code is attached demonstrating FP Comments, 'Scripted VI Comments.vi'.

My question is this, gurus: does anybody know how to create what the Diagram object calls 'Decos'? (I'm guessing this is short for 'Decorations', and I'm not referring to the type of Dialog Decorations placed on the front panel, either!) I've attached another quickie research VI I scabbed together - 'Export VI Contents.vi' that profiles the top-level contents of a VI. (It doesn't go through everything in the VI, such as Case Structures, Sequences, etc...) Run this VI on itself and you'll see what I'm talking about - on my machine the last object reported is a 'Deco'...

Thanks for your time,

Tony

Download File:post-2230-1117250735.vi

Download File:post-2230-1117250751.vi

Link to comment

This LabVIEW Object is called a "Label". If it is owned by a VI's FP or a Diagram object, then it is a "floating" Label (by convention). Here is some example code showing how to drop one on a VI using the "New VI Object" function. Hmmm, you don't have that in your palette? Download Commander and get it.

Download File:post-17-1117261434.zip

post-17-1117261441.png?width=400

Link to comment

Jim,

I don't know if I hadn't made myself clear, but I had already found this Object type and one other - 'Dialog Label'. (check the 'Scripted VI Comments' VI attached to my first message.) The problem I have with these two Object types is that they both exist/are created on the Front Panel, not the Block Diagram. I checked the 'Is On BD?' property for both of these Object Types, but it's read-only and cannot be used to force the newly created Label/Dialog Label onto the Block Diagram.

Just out of curiosity, what other conventions are there for labels? (Since "floating" was a new one to me!)

Thanks again,

Tony

P.S. I already have the 'Additional Application Control' pallete from Commander, it's how I wrote my example code. My compliments to the creator(s)!

P.P.S. Please forgive the lack of Close References in the original example - that's what I get for not double-checking my work before submitting!

This LabVIEW Object is called a "Label".  If it is owned by a VI's FP or a Diagram object, then it is a "floating" Label (by convention).  Here is some example code showing how to drop one on a VI using the "New VI Object" function.  Hmmm, you don't have that in your palette?  Download Commander and get it.

4880[/snapback]

Link to comment
Jim,

I don't know if I hadn't made myself clear, but I had already found this Object type and one other - 'Dialog Label'.  (check the 'Scripted VI Comments' VI attached to my first message.)  The problem I have with these two Object types is that they both exist/are created on the Front Panel, not the Block Diagram.  I checked the 'Is On BD?' property for both of these Object Types, but it's read-only and cannot be used to force the newly created Label/Dialog Label onto the Block Diagram.

Just out of curiosity, what other conventions are there for labels?  (Since "floating" was a new one to me!)

Thanks again,

Tony

P.S.  I already have the 'Additional Application Control' pallete from Commander, it's how I wrote my example code.  My compliments to the creator(s)!

P.P.S.  Please forgive the lack of Close References in the original example - that's what I get for not double-checking my work before submitting!

4883[/snapback]

In order to create a floating label on the block diagram (or a structure's diagram), you need to use the diagram reference as the owning object argument in the "New VI Object" function call. See the attached example and screenshot. Note: if you are trying to place/edit comments inside of structures, such as Case Structures, or While Loops, you will need to traverse the BD object hierarchy, in order to obtain the reference to that object's diagram. This is similar to traversing Tab Controls and Clusters (by control reference) on the FP.

Good luck.

Download File:post-17-1117426951.zip

post-17-1117426958.png?width=400

Link to comment

Jim,

:rolleyes: Well, I'm slapping myself on the head. This one should have been obvious.

Thanks for your help!

Tony

In order to create a floating label on the block diagram (or a structure's diagram), you need to use the diagram reference as the owning object argument in the "New VI Object" function call.  See the attached example and screenshot.  Note: if you are trying to place/edit comments inside of structures, such as Case Structures, or While Loops, you will need to traverse the BD object hierarchy, in order to obtain the reference to that object's diagram.  This is similar to traversing Tab Controls and Clusters (by control reference) on the FP.

Good luck.

4884[/snapback]

Link to comment
Hello Tony,

With this option (Have a look at the jpeg) you can also create invisible, (unerasable) Labels.

You can delete those (invisible) labels only by scripting, if they are directly on the diagram...

It is also possible to read from and write etc. to the Labels.

Martin

post-1396-1117445110.png?width=400

4888[/snapback]

Each!!! They localized the scripting too!

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.