API points on calc element

API points on calc element

AbelSV78
Enthusiast Enthusiast
689 Views
11 Replies
Message 1 of 12

API points on calc element

AbelSV78
Enthusiast
Enthusiast

Dear all,

 

we are triying to extract data from a bar in a model with VB.net. For example, we have obtained Smax in a bar, but only in determinate points, NOT THE MAXIMUM. Could you indicate me the variable to obtain this maximum?

 

See attached file, we can obtain data from first and third option, but not with second (this the one we need).

 

Thank you in advance

Best regards

0 Likes
Accepted solutions (1)
690 Views
11 Replies
Replies (11)
Message 2 of 12

Rafal.Gaweda
Autodesk Support
Autodesk Support

 but not with second (this the one we need).

 

Not implemented

You have to write such function by your own, if you need it.



Rafal Gaweda
0 Likes
Message 3 of 12

AbelSV78
Enthusiast
Enthusiast

Dear Rafal, all...

 

we continue working on bar stresses. Is it possible to know (for one bar, one load case) the position of maximum S min(MY) ? Could you give me the varialbe for VB.net and how to use it?

 

Thank you so so much in advance, regards.

0 Likes
Message 4 of 12

Rafal.Gaweda
Autodesk Support
Autodesk Support

 

we continue working on bar stresses. Is it possible to know (for one bar, one load case) the position of maximum S min(MY) ? Could you give me the varialbe for VB.net and how to use it?

 

Use RobotExtremeResultServer



Rafal Gaweda
0 Likes
Message 5 of 12

AbelSV78
Enthusiast
Enthusiast

We are trying this, but it doesn't work. Could you indicate us how to apply?:

 

Dim robApp As RobotOM.IRobotApplication = New RobotOM.RobotApplication

 

        Dim Bar As RobotOM.IRobotBar

        Dim BarCol As RobotOM.RobotBarCollection

 

        Dim CasCol As RobotOM.RobotCaseCollection

        Dim caso As RobotOM.IRobotCase

 

        Dim BarExtremeStressServer As RobotOM.RobotExtremeResultServer

 

        CasCol = robApp.Project.Structure.Cases.GetAll()

        BarCol = robApp.Project.Structure.Bars.GetAll()

 

        For i = 1 To BarCol.Count

            For ii = 1 To CasCol.Count

 

                caso = CasCol.Get(ii)

               Bar = BarCol.Get(i)

 

                BarExtremeStressServer = robApp.Project.Structure.Results.Bars.Stresses

 

                Dim ExtremeParams As RobotOM.RobotExtremeParams

                ExtremeParams = robApp.CmpntFactory.Create(RobotOM.IRobotComponentType.I_CT_EXTREME_PARAMS)

                ExtremeParams.BarDivision = 100

                ExtremeParams.Selection.Set(RobotOM.IRobotObjectType.I_OT_BAR, Bar)

                ExtremeParams.Selection.Set(RobotOM.IRobotObjectType.I_OT_CASE, caso)

                ExtremeParams.ValueType = RobotOM.IRobotExtremeValueType.I_EVT_FORCE_BAR_FX

 

                Dim MaxValue As Double = robApp.Project.Structure.Results.Extremes.MaxValue(ExtremeParams).Value

                Dim MaxValuePosition As Double = robApp.Project.Structure.Results.Extremes.MaxValue(ExtremeParams).Position

                Dim MinValue As Double = robApp.Project.Structure.Results.Extremes.MinValue(ExtremeParams).Value

                Dim MinValuePosition As Double = robApp.Project.Structure.Results.Extremes.MinValue(ExtremeParams).Position

 

            Next ii

 

        Next i

 

Thank you so much

0 Likes
Message 6 of 12

Rafal.Gaweda
Autodesk Support
Autodesk Support

You try to get Stress but ask for force : I_EVT_FORCE_BAR_FX



Rafal Gaweda
0 Likes
Message 7 of 12

AbelSV78
Enthusiast
Enthusiast

Sorry about confussion. We have obtained the maximum value and its position, but only for selection bars, this is:

 

For i = 1 To BarCol.Count

            Bar = BarCol.Get(i)

           

            For ii = 1 To CasCol.Count

                caso = CasCol.Get(ii)

                                                     

                Dim ExtremeParams As RobotOM.RobotExtremeParams

                ExtremeParams = robApp.CmpntFactory.Create(RobotOM.IRobotComponentType.I_CT_EXTREME_PARAMS)

                ExtremeParams.BarDivision = 100

 

                ExtremeParams.Selection.Set(RobotOM.IRobotObjectType.I_OT_BAR, Bar)

                ExtremeParams.Selection.Set(RobotOM.IRobotObjectType.I_OT_CASE, case)

  

                ExtremeParams.ValueType = RobotOM.IRobotExtremeValueType.I_EVT_STRESS_BAR_SMAX_MY

                Dim My_Max As Double = robApp.Project.Structure.Results.Extremes.MaxValue(ExtremeParams).Value

                Dim My_Pos As Double = robApp.Project.Structure.Results.Extremes.MaxValue(ExtremeParams).Position

  

                MsgBox(System.Math.Round(My_Max / 1000000, 2))

                MsgBox(System.Math.Round(My_Pos, 2))

Next ii

 

 

We are trying to obtain from all bars in model, but we can't (only for selected bars). Can you help us???

 

Thank you so much

0 Likes
Message 8 of 12

Rafal.Gaweda
Autodesk Support
Autodesk Support

Bar and caso (not "case") in ExtremeParams.Selection.Set  should be selections, not objects
"Next i" line is missing but I think it is not the point here.



Rafal Gaweda
0 Likes
Message 9 of 12

Rafal.Gaweda
Autodesk Support
Autodesk Support

Example code (update selection according to your needs)

 

    Dim REV As RobotExtremeValue
    Dim Params As RobotExtremeParams
    Set Params = New RobotExtremeParams
    Params.BarDivision = 101
    Dim rs As RobotSelection
    Set rs = RobApp.Project.Structure.Selections.CreateFull(I_OT_BAR)
    
    Dim rsc As RobotSelection
    Set rsc = RobApp.Project.Structure.Selections.CreateFull(I_OT_CASE)
    
    Params.Selection.Set I_OT_BAR, rs
    Params.Selection.Set I_OT_CASE, rsc
    
    Params.ValueType = I_EVT_STRESS_BAR_SMAX
    
        Set REV = RobApp.Project.Structure.Results.Extremes.MaxValue(Params)
            aaa = REV.Position
            ccc = REV.Case
            ddd = REV.Value
            eee = REV.Bar

 



Rafal Gaweda
0 Likes
Message 10 of 12

AbelSV78
Enthusiast
Enthusiast

With this solution, we do not obtain any response from computer, there is no error but there is no solution, compilation is blocked.

 

We have this code and it works for one bar, for one load case:

 

Dim robApp As RobotOM.IRobotApplication = New RobotOM.RobotApplication

Dim BarCol As RobotOM.RobotBarCollection

Dim Bar As RobotOM.IRobotBar

Dim CasCol As RobotOM.RobotCaseCollection

Dim caso As RobotOM.IRobotCase

BarCol = robApp.Project.Structure.Bars.GetAll()

 

For i = 1 To BarCol.Count

Bar = BarCol.Get(i)

 

For ii = 1 To CasCol.Count

             caso = CasCol.Get(ii)

For iii = 0 To BarLong Step 1

BSD = BarStressServer.Value(BarNumber, CasoNumber, (iii / BarLong) )

BarSmax = System.Math.Round(BSD.Smax / 1000000, 2)

                    BarSmin = System.Math.Round(BSD.Smin / 1000000, 2)  

                    BarSmaxMy = System.Math.Round(BSD.SmaxMY / 1000000, 2

                    BarSmaxMz = System.Math.Round(BSD.SmaxMZ / 1000000, 2)  

                    BarSminMy = System.Math.Round(BSD.SminMY / 1000000, 2)  

                    BarSminMz = System.Math.Round(BSD.SminMZ / 1000000, 2)  

                    BarFxSx = System.Math.Round(BSD.FXSX / 1000000, 2)  

                    BarTy = System.Math.Round(BSD.ShearY / 1000000, 2)

                    BarTz = System.Math.Round(BSD.ShearZ / 1000000, 2)

                    BarT = System.Math.Round(BSD.Torsion / 1000000, 2)

Next iii

Next ii

Next i

 

We need to obtain the maximum stress for all bar and each load case.

 

Thank you again

0 Likes
Message 11 of 12

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

Your CaseCol is empty \ null \ not set

 

My example code for finding max stress bar out all bars for each load case

 

    Dim REV As RobotExtremeValue
    Dim Params As RobotExtremeParams
    Set Params = New RobotExtremeParams
    Params.BarDivision = 101
    Dim rs As RobotSelection
    Set rs = RobApp.Project.Structure.Selections.CreateFull(I_OT_BAR)
    
    
    Dim rsc_single As RobotSelection
    Set rsc_single = RobApp.Project.Structure.Selections.Create(I_OT_CASE)
    
    Dim CasCol As RobotCaseCollection
    Set CasCol = RobApp.Project.Structure.Cases.GetAll
    
    For i = 1 To CasCol.Count
    
    rsc_single.FromText Str(CasCol.Get(i).Number)
    Params.Selection.Set I_OT_BAR, rs
    Params.Selection.Set I_OT_CASE, rsc_single
    
    Params.ValueType = I_EVT_STRESS_BAR_SMAX
    
    
        Set REV = RobApp.Project.Structure.Results.Extremes.MaxValue(Params)

            MsgBox ("BAR= " + Str(REV.Bar) + " " + " Case= " + Str(REV.Case) + " Pos = " + Str(REV.Position) + " Value = " + Str(REV.Value))
            
    Next i

 



Rafal Gaweda
0 Likes
Message 12 of 12

AbelSV78
Enthusiast
Enthusiast

Hi again, finally it works:

 

Dim REV As RobotOM.RobotExtremeValue

        Dim Params As RobotOM.RobotExtremeParams

        Params = New RobotOM.RobotExtremeParams

        Params.BarDivision = 101

 

        Dim rs As RobotOM.RobotSelection

        rs = robApp.Project.Structure.Selections.CreateFull(RobotOM.IRobotObjectType.I_OT_BAR)

 

        Dim rsb_single As RobotOM.IRobotSelection

        rsb_single = robApp.Project.Structure.Selections.Create(RobotOM.IRobotObjectType.I_OT_BAR)

 

        Dim rsc_single As RobotOM.RobotSelection

        rsc_single = robApp.Project.Structure.Selections.Create(RobotOM.IRobotObjectType.I_OT_CASE)

 

 

        Dim CasCol As RobotOM.RobotCaseCollection

        CasCol = robApp.Project.Structure.Cases.GetAll

 

        Dim BarCol As RobotOM.RobotBarCollection

        BarCol = robApp.Project.Structure.Bars.GetAll

 

 

        For ii = 1 To BarCol.Count

 

            For i = 1 To CasCol.Count

 

                rsc_single.FromText(Str(CasCol.Get(i).Number))

                rsb_single.FromText(Str(BarCol.Get(ii).Number))

 

 

                Params.Selection.Set(RobotOM.IRobotObjectType.I_OT_BAR, rsb_single)

                Params.Selection.Set(RobotOM.IRobotObjectType.I_OT_CASE, rsc_single)

 

                Params.ValueType = RobotOM.IRobotExtremeValueType.I_EVT_STRESS_BAR_SMAX

                REV = robApp.Project.Structure.Results.Extremes.MaxValue(Params)

 

                MsgBox("BAR= " + Str(REV.Bar) + " " + " Case= " + Str(REV.Case) + " Pos = " + Str(REV.Position) + " Value = " + Str(REV.Value))

 

            Next i

 

        Next ii

 

Thank you so much.

0 Likes