• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Robot Structural Analysis

    Reply
    Active Member
    Posts: 7
    Registered: ‎04-03-2012
    Accepted Solution

    Working with loads on claddings (API)

    291 Views, 7 Replies
    05-30-2012 05:21 AM

    Hi,

     

    During the last months of year 2011 I had a few discussions with Marcin Rakus and Marek Wiecek about how to manage with the load on claddings through the Robot Open Source API.

     

    The conclusion was that the API of RSA 2011 did not cover 100% of program functionality, making it impossible to manipulate such data. Typically, when accessing the load type I_LRT_UNIFORM associated to claddings in my RSA models, I get not only the loads on the cladding itself but also the ones generated automatically on the bars being in the influence area of the cladding. The API seemed to work fine with panels, unfortunately I do not use such objects. We also tried to write some code to convert claddings into panels, and the opposite, but it did not lead to something satisfying.

     

    Has the API of RSA 2012 been updated to allow an efficient management of claddings ?...

    Please use plain text.
    Product Support
    Posts: 2,519
    Registered: ‎04-26-2010

    Re: Working with loads on claddings (API)

    05-31-2012 03:09 AM in reply to: fcussol

    I have not checked yet in code but according to documentation this flag is available from v.2012

    If IsAutoGenerated = true (1) such records can be skipped during ....

     

    isauto.jpg



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Active Member
    Posts: 7
    Registered: ‎04-03-2012

    Re: Working with loads on claddings (API)

    06-05-2012 03:26 AM in reply to: RG_Adsk

    Hi,

     

    Ok I'll try to check in code, but how do you get access to this parameter ?

    For example, working with a RobApp object initialized with Set RobApp = New RobotApplication : RobApp.Project.Structure... ???

     

    Thanks

    Please use plain text.
    Product Support
    Posts: 2,519
    Registered: ‎04-26-2010

    Re: Working with loads on claddings (API)

    06-05-2012 07:48 AM in reply to: fcussol

    Sample Excel VBA code:

    records with TRUE below displayed = generated automaticaly from cladding

     

    autogen.jpg

     

    Sub Button1_Click()
    Dim RobApp As IRobotApplication
    Set RobApp = New RobotApplication
    
    Dim iscsel As IRobotSelection
    Dim RLCom As IRobotLoadRecordCommon
    
    Set iscsel = RobApp.Project.Structure.Selections.CreatePredefined(I_PS_CASE_SIMPLE_CASES)
    
    Dim col As IRobotCaseCollection
    Set col = RobApp.Project.Structure.Cases.GetMany(iscsel)
    Dim isc As IRobotSimpleCase
    Row = 10
    
    For c = 1 To col.Count
        Range("B9").Value = Format(c) & " / " & Format(ccount)
        Dim icase As IRobotCase
        Set icase = col.Get(c)
        If icase.Type = I_CT_SIMPLE Then
            
            Set isc = icase
            Dim r As Long, i As Long, rcount As Long
            rcount = isc.Records.Count
            r = 1
            While r > 0 And r <= isc.Records.Count
                Rr = "B" + Trim(Str(Row))
                Range(Rr).Value = icase.Number & " / " & Format(isc.Records.Count)
                DoEvents
                Dim irec As IRobotLoadRecord
                Set irec = isc.Records.Get(r)
                Set RLCom = isc.Records.Get(r)
                
                Cells(Row, 3) = Str(RLCom.IsAutoGenerated)
                Cells(Row, 4) = irec.Objects.ToText
    
     
                Set irec = isc.Records.Get(r)
                For iic = 0 To 14
                    Cells(Row, 5 + iic) = irec.GetValue(iic)
                Next iic
                Row = Row + 1
                r = r + 1
            Wend
            Set isc = Nothing
            
        End If
    
        Set icase = Nothing
    Next c
    
    Set col = Nothing
    Set iscsel = Nothing
    RobApp.Interactive = 1
    Set RobApp = Nothing
    End Sub

     

     



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Active Member
    Posts: 7
    Registered: ‎04-03-2012

    Re: Working with loads on claddings (API)

    06-07-2012 12:03 AM in reply to: RG_Adsk

    OK, this flag is doing well.

    It solves the question of accessing to a uniform load on a cladding.

     

    Now a last one : I wanted to extend this to a load defined by three points (IRobotLoadRecordIn3Points). The flag is efficient as well but I have some trouble with the VBA code to get the coordinates of the points. The documentation suggests to use this method :

    Public Function GetPoint(_which_point As int, ByRef _x As double*, ByRef _y As double*, ByRef _z As double*) As Boolean

     
    First remark : when writing the code in the VBA Excel interface the type of the function is told to be a "long". It's not necessary a problem because the result of the function is no matter of interest.
     
    But there is also a compilation error : even declaring explicitely the type of the three arguments x, y and z (Dim testX, testY, testZ As Double), an error message tells that the type of the ByRef arguments is incorrect when calling the function (after initializing an object as usual I just wrote : LoadRec3p.GetPoint 1, testX, testY, testZ guessing it would assign the coordinate values of point A to the last three arguments).
     
    Do you have some example of a code properly writed in VBA ?...
     
    Thanks for your help
     
    Please use plain text.
    Product Support
    Posts: 2,519
    Registered: ‎04-26-2010

    Re: Working with loads on claddings (API)

    06-07-2012 03:22 PM in reply to: fcussol
     
    First remark : when writing the code in the VBA Excel interface the type of the function is told to be a "long". It's not necessary a problem because the result of the function is no matter of interest.
     
    "Get coordinates of given point of load. Return false when given point has not " 
    In fact if false it returns 0, if true   -1. They can be long or bool.
     
    Do you have some example of a code properly writed in VBA ?...
     
    3p.jpg
    Sub AAAA()
    Dim RobApp As IRobotApplication
    Set RobApp = New RobotApplication
    
    Dim iscsel As IRobotSelection
    Dim RLCom As IRobotLoadRecordCommon
    
    Set iscsel = RobApp.Project.Structure.Selections.CreatePredefined(I_PS_CASE_SIMPLE_CASES)
    
    Dim col As IRobotCaseCollection
    Set col = RobApp.Project.Structure.Cases.GetMany(iscsel)
    Dim isc As IRobotSimpleCase
    Row = 10
    
    For c = 1 To col.Count
        Set isc = col.Get(c)
       
            Dim r As Long, i As Long, rcount As Long
            rcount = isc.Records.Count
            For r = 1 To rcount
            
                Dim irec As IRobotLoadRecord
                Set irec = isc.Records.Get(r)
                
                If (irec.Type = I_LRT_IN_3_POINTS) Then
                    Dim Cr As RobotLoadRecordIn3Points
                    Set Cr = isc.Records.Get(r)
                    Dim X As Double
                    Dim Y As Double
                    Dim Z As Double
                    
                    For i = 1 To 3
                        Cr.GetPoint i, X, Y, Z
                        Cells(Row, 3) = "Point " & Str(i)
                        Cells(Row, 4) = X
                        Cells(Row, 5) = Y
                        Cells(Row, 6) = Z
                        Cells(Row, 7) = "Value"
                        Cells(Row, 8) = Cr.GetValue(i * 3 - 3)
                        Cells(Row, 9) = Cr.GetValue(i * 3 - 2)
                        Cells(Row, 10) = Cr.GetValue(i * 3 - 1)
                        Row = Row + 1
                    Next i
                End If
                
                Row = Row + 1
            Next r
          
            Set isc = Nothing
    
        Set icase = Nothing
    Next c
    
    Set col = Nothing
    Set iscsel = Nothing
    RobApp.Interactive = 1
    Set RobApp = Nothing
    End Sub

     



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Active Member
    Posts: 7
    Registered: ‎04-03-2012

    Re: Working with loads on claddings (API)

    06-12-2012 03:16 AM in reply to: RG_Adsk

    Thanks for the example

     

    After looking for a long time for errors in the objects syntax (unsuccessfully), I found out quite by chance why the compilation failed :

     

    when declaring variables I often use such a syntax to save time :

    Dim X, Y, Z as Double

     

    in Excel VBA this should not be different from :

    Dim X as Double

    Dim Y as Double

    Dim Z as Double

     

    but here the code does not run when using the first method... don't understand why

     

    Anyway, this answers the whole question.

    Please use plain text.
    Product Support
    Posts: 2,519
    Registered: ‎04-26-2010

    Re: Working with loads on claddings (API)

    07-23-2012 03:58 AM in reply to: fcussol

     We also tried to write some code to convert claddings into panels, and the opposite, but it did not lead to something satisfying.

     

            Dim r As New RobotOM.RobotApplication
            Dim o As RobotOM.RobotObjObject
            o = r.Project.Structure.Objects.Get(1)
            o.SetLabel(RobotOM.IRobotLabelType.I_LT_CLADDING, "Two-way")
            o.Update()
    

     Most important  o.Update() at the end



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.