| Applies To | |||
| Product(s): | STAAD.Pro | ||
| Version(s): | All | ||
| Environment: | N/A | ||
| Area: | OpenSTAAD | ||
| Subarea: | Geometry | ||
| Original Author: | Bentley Technical Support Group, Shreyanka Bhattacharjee | ||
Problem Description:
How to move all the nodes using OpenSTAAD functions (VBA)
Solution:
You may use function SetNodeCoordinate to set or replace the previous.
Function GetNodeCount and GetNodeList is used to extract the node number information.
Function GetNodeCoordinates is used to extract node coordinates.
Parameter for function RenumberBeam
[Input] node: Node number ID
[Input] CoordX: New coordinate X in GLOBAL
[Input] CoordY: New coordinate Y in GLOBAL
[Input] CoordZ: New coordinate Z in GLOBAL
VBA script:
Set objOpenStaad = GetObject(, "StaadPro.OpenSTAAD")
     Dim node() As Long
     Dim newnodecoord() As Double
     Dim CoordX() As Double
     Dim CoordY() As Double
     Dim CoordZ() As Double
     
     nodecount = objOpenStaad.Geometry.GetNodeCount
     ReDim node(nodecount - 1)
     ReDim newnodecoord(nodecount - 1)
     
     ReDim CoordX(nodecount - 1)
     ReDim CoordY(nodecount - 1)
     ReDim CoordZ(nodecount - 1)
     objOpenStaad.Geometry.GetNodeList node
     
     For i = 0 To nodecount - 1
         objOpenStaad.Geometry.GetNodeCoordinates node(i), CoordX(i), CoordY(i), CoordZ(i)
     Next i
     
     For i = 0 To nodecount - 1
         newnodecoord(i) = CoordZ(i) + 2 'Move Z coordinate be 2m in positive Z direction
         objOpenStaad.Geometry.SetNodeCoordinate node(i), CoordX(i), CoordY(i), newnodecoord(i)
     Next i
     
 End Sub
Output:
Please refer to the attached video, Move Node.mp4. I have moved the entire structure (all nodes) by 2m in positive Z direction using this function.
I have attached the STAAD model (Structure2.STD)
communities.bentley.com/.../Structure2.STD