Announcements

We are currently experiencing an issue impacting some Autodesk Products and Services - please refer to the Autodesk Health Dashboard for updates.

[API] - Eccentricity

[API] - Eccentricity

Anonymous
Not applicable
592 Views
1 Reply
Message 1 of 2

[API] - Eccentricity

Anonymous
Not applicable

Hello,

hope you're doing great.

How can I create a bar eccentrity and apply it to a bar with ROBOT API using VBa?

 

(here is the eccentricty I'm talking about)

ClmentTAHERI6316_0-1624033509580.png

 

0 Likes
Accepted solutions (1)
593 Views
1 Reply
Reply (1)
Message 2 of 2

Stephane.kapetanovic
Mentor
Mentor
Accepted solution

Hi @Anonymous 

Sub Create_And_Apply_Offset()
   
  Dim RobApp As IRobotApplication
  Set RobApp = New RobotApplication
  
  Dim Structure As RobotStructure
  Set Structure = RobApp.Project.Structure
  
  '// Create Offset
  Dim OffsetName As String
  Dim RLabelServer As RobotLabelServer
  Dim RLabel As RobotLabel
  Dim OffsetData As RobotBarOffsetData
  Dim EndOffset As RobotBarEndOffsetData
  
  OffsetName = "X1/Y2"
  Set RLabelServer = Structure.Labels
  Set RLabel = RLabelServer.Create(IRobotLabelType.I_LT_BAR_OFFSET, OffsetName)
  Set OffsetData = RLabel.Data
  Set EndOffset = OffsetData.Start
  EndOffset.UX = 0.01 ' < 1 cm in meters
  Set EndOffset = OffsetData.End
  EndOffset.UY = 0.02 
  RLabelServer.Store RLabel
  
  '// Get Beams from a RobotSelection to apply offset
  Dim SelBar As RobotSelection
  Set SelBar = Structure.Selections.Get(IRobotObjectType.I_OT_BAR)
  Dim Rbars As RobotBarCollection
  Set Rbars = Structure.Bars.GetMany(SelBar)
  
  Dim Bar As IRobotBar
  For i = 1 To SelBar.Count
    Set Bar = Rbars.Get(i)
    Bar.SetOffset OffsetName, True '< True if ReversedOffset
  Next i
  
  Set RobApp = Nothing
End Sub

See also :

https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-offset-to-a-bar-with-excel-vba/m-p/5616005

 

Best regards

Stéphane

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature