Hello,
I want divide bars using API macro in Excel. For example, divide bar number 2 into 4 parts.
You can provide an example?
Thanks.
Solved! Go to Solution.
Solved by Rafal.Gaweda. Go to Solution.
Dim RVA As New RobotValuesArray RVA.SetSize 3 RVA.Set 1, 0.25 RVA.Set 2, 0.5
RVA.Set 3, 0.75
barnumber=2 RobApp.Project.Structure.Edit.DivideBar barnumber, RVA, True
Hello,
When I run the the API in Excel, it show an error. I attached the error. Can you help me?
Thank you and best regards
Hello,
When I run the the API in Excel, it show an error. I attached the error. Can you help me?
Thank you and best regards
Try:
Dim RVA As RobotValuesArray Set RVA = RobApp.CmpntFactory.Create(I_CT_VALUES_ARRAY)
It works. Thanks.
It's possible generate the nodes without bar division?
Thank you and best regards.
Of course. Write your own divide function
- calculate bar vector
- normalize it to 1
- use startnode + normalized vector to generate node in proper position or endnode and opposite vector to normalized one
or use this 🙂
http://forums.autodesk.com/t5/Autodesk-Robot-Structural/API-addin-for-merging-bars/td-p/3817730
Dim RobApp As RobotApplication Set RobApp = New RobotApplication Dim RBar As RobotBar Dim StartNode As RobotNode Dim EndNode As RobotNode Dim Relative As Boolean BarNumber = 2 Distance = 0.3 Relative = True Set RBar = RobApp.Project.Structure.Bars.Get(BarNumber) Set StartNode = RobApp.Project.Structure.Nodes.Get(RBar.StartNode) Set EndNode = RobApp.Project.Structure.Nodes.Get(RBar.EndNode) Dim Vx As Double, Vy As Double, Vz As Double, VL As Double 'bar vector Vx = EndNode.x - StartNode.x Vy = EndNode.y - StartNode.y Vz = EndNode.z - StartNode.z 'vector length VL = Sqr(Vx * Vx + Vy * Vy + Vz * Vz) 'normalization Vx = Vx / VL Vy = Vy / VL Vz = Vz / VL 'new node If Relative Then Distance = Distance * VL End If RobApp.Project.Structure.Nodes.Create RobApp.Project.Structure.Nodes.FreeNumber, _ StartNode.x + Vx * Distance, _ StartNode.y + Vy * Distance, _ StartNode.z + Vz * Distance