Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
for example,
1) I want to get the "Node 1" and "Node 2" through the api
2) I want to get the length of the beam
Solved! Go to Solution.
for example,
1) I want to get the "Node 1" and "Node 2" through the api
2) I want to get the length of the beam
Solved! Go to Solution.
HI @wllao
two ways (by bar, by node)
Sub GetBarLength()
Dim RobApp As IRobotApplication: Set RobApp = New RobotApplication
Dim Structure As RobotStructure: Set Structure = RobApp.Project.Structure
BarNo = 1 'Example: Barre number 1
Dim Bar As RobotBar: Set Bar = Structure.Bars.Get(BarNo)
'First Method
BarLength1 = Bar.Length
'Second Method
Dim N1 As RobotNode, N2 As RobotNode
With Structure.Nodes: Set N1 = .Get(Bar.StartNode): Set N2 = .Get(Bar.EndNode): End With
DX = N1.X - N2.X: DY = N1.Y - N2.Y: DZ = N1.Z - N2.Z
BarLength2 = (DX * DX + DY * DY + DZ * DZ) ^ 0.5
Debug.Print BarNo, BarLength1, BarLength2
Set RobApp = Nothing
End Sub
Best Regards