The Layout3D module

Also see :

Quick Notes

PR 45178 In the Python API, non-navigation tools will be disabled during Layout3D.get_Layout3D and the default Component .Component.SetReferencePointForMemberUI() implementation. (v2018)

PR 46989 Python Layout3D objects may have their "remove_bad_points" attribute set to False to avoid automatically removing collinear and duplicate points. (v2020)


Example :

Here's what the round bar generated in the following script looks like. The bottom node of the round bar is placed at the left-end work point of the member that the user selects.

# Adds a curved round bar at the member's left end work point.
from Layout3D import Layout3D
from param import Units, ClearSelection
from member import MemberLocate
from Point3D import Point3D
from rnd_bar import RndBar
Units("feet")
ClearSelection()
rb = RndBar()
rb.Member = MemberLocate("Select a member")
rb.BarDiameter = 1.0
rb.Centered = 'Yes'
layout = Layout3D()
pt = Point3D( rb.Member.LeftEnd.Location )
layout.add_node( Point3D( 0, 0, 0 ) + pt, 0 )
layout.add_node( Point3D( 0, 0, 12.0 ) + pt, 6.0 )
layout.add_node( Point3D( 0, 12.0, 12.0 ) + pt, 0 )
layout.set_depth_vectors( Point3D( 1, 0, 0 ), True )
rb.layout = layout
rb.Add()
ClearSelection()

Assigning nodes to a Layout3D and making it an attribute of an object :

In the example , the Layout3D is assigned the name layout in the following line of code:

layout = Layout3D()

A rnd_bar or weld_add object also needs to be defined in order for the Layout3D to have a physical object to control the layout of. In the example , this is done in the following lines of code. The selection of a member to apply the round bar to is also required -- you cannot add a round bar miscellaneous member layout. Welds also require the selection of a member. Also notice that this round bar ( rb ) does not have any length assigned to it. Its length will be defined by the nodes of the Layout3D.

rb = RndBar()
rb.Member = MemberLocate("Select a member")
rb.BarDiameter = 1.0
rb.Centered = 'Yes'
layout = Layout3D()

The layout.add_node() method is used to define the nodes of the Layout3D. In the example , the layout.set_depth_vectors() method is also used, since the nodes also require a vector.

layout.add_node( Point3D( 0, 0, 0 ) + pt, 0. )
layout.add_node( Point3D( 0, 0, 12.0 ) + pt, 6. )
layout.add_node( Point3D( 0, 12, 12.0 ) + pt, 0. )
layout.set_depth_vectors( Point3D( 1, 0, 0 ), True )

Finally, the Layout3D, which in this example is named layout , is assigned as the .layout attribute of the round bar, which is named rb .

rb.layout = layout
rb.Add()

Layout3D functions and methods :

layout = Layout3D() assigns the variable name layout to be the Layout3D object.

layout.add_node( Point3D , radius , optional_vector ) assigns a node to the Layout3D object, which is named layout in this example. A script requires a distinct xxx.add_node() line for each node. The first argument for any one node, Point3D , is a Point3D object that defines the global coordinates of that node. The second argument, radius , is a floating point number that defines the length of the bend radius at that node. The third argument, optional_vector , uses a vector in the form Point3D(x, y, z) to set a direction that is perpendicular to the next node in the script. Warning : The layout.set_depth_vectors() method must be used if you choose not to enter the optional_vector.

layout.clear() clears all the nodes from the Layout3D object, which is named layout in this example.

layout.pop_node() clears the last node from the Layout3D object, which is named layout in this example.

layout.set_depth_vectors( Point3D , boolean ) sets the direction of the entire layout when layout.add_node() does not include a vector. The first argument, Point3D , is a vector in the form Point3D(x, y, z) that defines the directional component of the layout. The vector must define a direction that is perpendicular to the plane of the first three points of the layout, or the parametric will generate errors. The second argument, boolean , is either True or False. True allows the material to be twisted. False keeps the round bar from being twisted.


A Layout3D can be an attribute of a weld or a round bar :

obj.layout = layout assigns the Layout3D object named layout as the .layout attribute of obj , where obj is a parametric round bar or weld object. For a round bar , the .layout attribute should be used in place of the round bar's OrderLength attribute. For a weld object that you assign a Layout3D object to, there is no need to assign material objects to WeldTo .