Robot Structural Analysis Forum
Welcome to Autodesk’s Robot Structural Analysis Forums. Share your knowledge, ask questions, and explore popular Robot Structural Analysis topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API Robot - Excel VBA to Robot - Table Values not being updated

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
darren.cosh
453 Views, 5 Replies

API Robot - Excel VBA to Robot - Table Values not being updated

Hello,

 

I am student and I am working on a project with a company. I came to a dead end and I need help with VBA.

 

Basically what I am doing is I have the model ready and done all calculations by the regular GUI. I want to change stiffness values of spring supports already modelled into robot, by new stiffness's which I have in my excel file. My program VBA code and API on Robot runs and shows no errors. When running the program behaves as if it is accessing Robot every time correctly but the value of stiffness doesn't get updated according to what I have in excel. The value stays same as old.

 

I have attached a screenshot showing the part of the code making changes in the Robot directory from excel file. However I think I am missing some part of the code.

 

Further, the installation of the software seems fine as well. Please help me! 

 

Thanks,

5 REPLIES 5
Message 2 of 6

hi @darren.cosh 

Difficult to say why, you do not seem to have communicated the part where the rigidity of the support is modified.

Best Regards

Dim SupLabel As RobotLabel
With RobApp.Project.Structure.Labels
  Set SupLabel = .Create(I_LT_SUPPORT, "MySupport")
  With SupLabel.Data
    .KX = 7000: .KY = 8000: .KZ = 9000
  End With
  .Store SupLabel
End With
Message 3 of 6

Hi @Stephane.kapetanovic 

That is where I am confused at. I have to modify the KZ of the support again from excel, but this is not included in the code.

I have attached a screenshot of the code making some amendments  adding the new KZ data into the Robot support table. However, I do not know if I have to store the label again, as I do not want to change them. I am getting a miss match error on the highlighted line in the attached error screenshot for the same code. 

Is there somewhere I can look at the object database to know which specific label I have to use to pick/change an attribute of the table in supports?

I want to change KZ of all supports, with everyone having a different value and name. Names are already added and I am changing the value.

Thanks,

Message 4 of 6

hi @darren.cosh 

so no need to iterate over the nodes that have these supports, you have to do it on the support labels from their names and change them one by one.

Dim Coef As Double
Coef = 0.8
  
Dim LabelCollection As RobotLabelCollection
Set LabelCollection = RobApp.Project.Structure.Labels.GetMany(I_LT_SUPPORT)
  
For i = 1 To LabelCollection.Count
  Set SupLabel = LabelCollection.Get(i)
  If Left(SupLabel.Name, 7) = "Support_" Then
    With SupLabel.Data: .KZ = .KZ * Coef: End With
    RobApp.Project.Structure.Labels.Store SupLabel
  End If
Next i

Best Regards

Message 5 of 6

Hi @Stephane.kapetanovic 

What is the purpose of coefficient here?

Thanks,

Message 6 of 6

hi @darren.cosh 

this is an example, I don't know your case precisely, take into account the way to iterate on the labels rather than on the nodes. Rather than a coefficient, you will undoubtedly opt for a value from your sheet.
What you need to do is list all the different labels (one per node if needed) and change them all to whatever value you want.

Best Regards

Tags (3)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report