Jump to content

Xnode Diagram Cleanup


bbean

Recommended Posts

Rookie question here.  I'm getting lazy and don't want to click the cleanup diagram button when I'm debugging generated code in the Xnode.

 

Is there a way to clean-up the Xnode diagram with scripting?  I tried putting some cleanup commands on the diagram reference in generate code ability, but I'm guessing the code is not actually generated until after this VI is completed.  Or maybe I'm doing something wrong.  Is there another ability that can run after the code is actually generated where I can cleanup the diagram for debugging purposes?  

 

post-549-0-29836000-1436455306.png

 

  • Like 1
Link to comment

So in my Find References XNode in my GenerateCode Ability VI, I call the Insert and Wire Template.vi which is a VI that I use for inserting a template VI (it still needs some work) but what you'll notice is at the end of that VI I have a constant set to false for cleaning up the BD.  I just called the Block Diagram >> Clean up invoke node on the VI reference, which I got using the Owning VI reference on the Diagram reference passed in.

 

I set that constant to false when I'm done, but have it be true during development so the code isn't complete crap and hard to debug.

Link to comment

hoovahh I implemented the same operation as your subvi and it did not appear to work when I looked at the generated code.  So I went back and created some debugging code to get the block diagram image before and after cleanup to compare to the final code:

 

post-549-0-53356600-1436466343.png

 

The result of probing these images is that it appears block diagram cleanup occurs but then gets lost:

 

Before BD.Cleanup:

post-549-0-66771900-1436466406.png

After BD.Cleanup (just what I want):

post-549-0-44890400-1436466406.png

Final "Generated Code" (somewhat crapified)

post-549-0-23841800-1436466406.png

 

The only other thing that happens after the Generate Code Ability VI is that I do an  "Update Image" (calls the Image Ability).  Could this cause the diagram to get screwed up?

 

Link to comment

Your "final" looks cleaned up to me.  Sure the terminals aren't quite right, and wires are a bit long, probably indicating that the terminals are added after the code generation (just a guess not sure XNodes actually do this).  But you don't have wires on top of each other like the first image.

 

Since this XNode lives in the VI that calls it, and is pretty much inlined as far as we can tell, the terminals are probably added when you right click the XNode to look at the generated code, and before then an interface to the XNode is this nebulous thing (at least to you and I).

Link to comment

Your "final" looks cleaned up to me.  Sure the terminals aren't quite right, and wires are a bit long, probably indicating that the terminals are added after the code generation (just a guess not sure XNodes actually do this).  But you don't have wires on top of each other like the first image.

 

Since this XNode lives in the VI that calls it, and is pretty much inlined as far as we can tell, the terminals are probably added when you right click the XNode to look at the generated code, and before then an interface to the XNode is this nebulous thing (at least to you and I).

That makes sense. Thanks for the help.

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.