LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting: Positions of objects in Block Diagram

Solved!
Go to solution

This simple test puzzles me.

  1. I create VI with only Flat Sequence Structure and no other BD objects. As a fact the same problem concerns any other BD structure: loops, case structures, etc.
  2. This script creates In Place Element Structure inside the Flat Sequence Structure. As a fact the same problem concerns any object placed inside structure.

createIPE.vi.png

 

This is the result:

VI.vi.png

 

 

  1. Next script reads positions of the created In Place Element Structure and all its owners: script and results:
  1. getPositioning.vi.pnggetPositioningFP.gif

 

I cannot see any relation between location assigned when Flat Sequence Structure was created (30 and 10) and positions read afterwards.

 

Could you give me a hint how do location values used with New VI Object related to positions of objects in BD.

 

Thank you.

 

_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
0 Kudos
Message 1 of 11
(3,286 Views)

The flat sequence structure is the object that is on the main panel of the block diagram.

The flat sequence structures contain one or more flat sequence frames.  Those frames are owned by the sequence structure and their positions are relative to that sequence structure.

0 Kudos
Message 2 of 11
(3,275 Views)

@RavensFan wrote:

Those frames are owned by the sequence structure and their positions are relative to that sequence structure.


It was my first guess disproved by this test. Position values are probably related to the same coordinate system.

_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
0 Kudos
Message 3 of 11
(3,243 Views)

I thought you were talking about the frame being at position 0,0?

 

0 Kudos
Message 4 of 11
(3,238 Views)

The position you set when you create the object (30,10) is in the coordinate system of the owner, in this case the FSS frame.  The position you read is in the coordinate system of the block diagram.

 

The origin of the FSS frame corresponds to the origin of the diagram.  This is offset from the position of FSS itself by the filmstrip border.  A similar offset is there for loops and other structures.

 

From the offsets in position values (36,20) we can infer that the FSS border is 6 pixels wide and 10 pixels high.

 

The moral of the story is that if you want to predict the final location of the created object inside a structure you have to take the border size into account.

0 Kudos
Message 5 of 11
(3,230 Views)

Same thing with cluster constants.

It's an old quirk.  When you create the object, the position is relative to the owner.

When you read the position, it's relative to the top level diagram.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 6 of 11
(3,228 Views)

@Darin.K wrote:

The position you set when you create the object (30,10) is in the coordinate system of the owner, in this case the FSS frame.  The position you read is in the coordinate system of the block diagram.

 

The origin of the FSS frame corresponds to the origin of the diagram.  This is offset from the position of FSS itself by the filmstrip border.  A similar offset is there for loops and other structures.

 

From the offsets in position values (36,20) we can infer that the FSS border is 6 pixels wide and 10 pixels high.

 

The moral of the story is that if you want to predict the final location of the created object inside a structure you have to take the border size into account.


Thank you, i got the positioning ideology. However, two new questions arise immediately:

1. How the border size can be found for each type of structure? Different structures could have different borders. Even more, they could differ between LabVIEW versions.

2. How absolute position can be predicted for second or more frame of FFS? FlatSequenceFrame has no position property and Diagram inside is (as I understand) only a wrapper around own content.

 

I know multi-frame sequence is a bad style but they exist.

_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
0 Kudos
Message 7 of 11
(3,205 Views)
Solution
Accepted by topic author _Y_

1. How the border size can be found for each type of structure? Different structures could have different borders. Even more, they could differ between LabVIEW versions.


Loops and FlatSequenceFrames have a ContentRect property, compare this to the MasterBoundsRect property of the structure to get the borders. 

 


2. How absolute position can be predicted for second or more frame of FFS? FlatSequenceFrame has no position property and Diagram inside is (as I understand) only a wrapper around own content.

Again use the ContentRect property, the Top and Left values will give you the position.

 

 

Message 8 of 11
(3,201 Views)

Thank you Darin.K

Everything is clear for me now.

 

This in image illustrating difference between different types of structures. It could be useful for someone else who will meet the same problem

 

propertiesOfDifferentStructures.vi.png

_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
Message 9 of 11
(3,136 Views)

Why is InPlaceElementStructure.Position=InPlaceElementStructure.Diagram.Position rather than (30,10) more?

 

Why is FlatSequenceFrame.Position=(0,0) versus (6,10) or FlatSequence.Position + (6,10)? It is senseless for FlatSequenceFrame.Position to be relative to itself.

 

If all Position properties are not in the same reference plane, how is it determined whether Position is relative to the Block Diagram or something else?

 

Why is FlatSequence.Position=TopLevelDiagram.Position when FlatSequence is not in the upper-left corner of the Block Diagram (either relative to the origin dot or to the visible scrolled location)?

0 Kudos
Message 10 of 11
(1,525 Views)