Creating Top-Level Nodes with Script-Transactions
Top-level nodes are nodes which have a global scope and their relationships are mapped in the Graph. The syntax for directly creating top-level nodes within script transactions is as follows. You should never use this syntax to create a top-level node inside a ByFunction technique.
transaction 1 modelChange 'Add baseCS' { node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem { Technique = 'AtModelOrigin'; GraphLocation = <auto> {40.0, 40.0}; } } transaction 2 modelChange 'Change baseCS' { node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem { GraphLocation = {25.833, 78.333, 174.0, 0.0}; } } transaction 3 modelChange 'Change baseCS' { node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem { Technique = 'AtModelOrigin'; DGNModelName = '3D Metric Design'; GraphLocation = {29.167, 81.667, 174.0, 0.0}; } } transaction 4 script 'Create top-level Point' { Point pt = new Point("scriptPoint"); pt.ByCartesianCoordinates(baseCS, 1.2, 3.4, 0.0); }
Note: Whenever a new
top-level node is created, you don't need to store its value into a local
variable. Instead, you can simply use its name directly:
transaction 1 modelChange 'Add baseCS' { node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem { Technique = 'AtModelOrigin'; GraphLocation = <auto> {40.0, 40.0}; } } transaction 2 modelChange 'Change baseCS' { node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem { GraphLocation = {25.833, 78.333, 174.0, 0.0}; } } transaction 3 modelChange 'Change baseCS' { node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem { Technique = 'AtModelOrigin'; DGNModelName = '3D Metric Design'; GraphLocation = {29.167, 81.667, 174.0, 0.0}; } } transaction 4 script 'Create top-level Point' { new Point("scriptPoint"); scriptPoint.ByCartesianCoordinates(baseCS, 1.2, 3.4, 0.0); }