From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting Set Object Owner Without New Position

So I'm doing some scripting and I am creating some new objects.  I know where I want the objects to go based on some other objects, and placing them there isn't the problem.  The issue is that if I want to drop the object into a structure.  The location I'm dropping is correct, but the owner isn't.  I can set the owner of the object using the Move method on the object but I have to provide a new position.

 

Now I thought about trying to get the structure position in the top level diagram, and calculating the difference, but this operation would need to be recursive since I can have diagrams in diagrams.

 

So is there an easy way to move an object (or drop it in the first place) at a position relative to the top level diagram, but has its owner set to a different diagram?

0 Kudos
Message 1 of 3
(2,476 Views)

To my knowledge there is not an easy way to accomplish this. Recursively calculating the positions is the only way to go that I know of.

0 Kudos
Message 2 of 3
(2,469 Views)

Oh well then you'll be glad to know I came up with a very hacky solution.  I first create a dummy object where I want my actual object to go.  (I'm sure you're loving this already).  This will have the wrong owner but at the right location.  Then use the New VI Object Offset From Referenced Object, and set it to the Top Left, of the dummy object with the offset being the size of the dummy object (I picked the Sort 1D array and so my offsets were 32 and 32).  Then use this cluster as the location on the new VI Object, with the correct owning refernce passed in.  Then delete the dummy object.  Thanks for confirming there isn't a simple solution.

Message 3 of 3
(2,458 Views)