API - CREATE DIMENSIONING GROUPS

API - CREATE DIMENSIONING GROUPS

StefanoPasquini6790
Advisor Advisor
1,036 Views
10 Replies
Message 1 of 11

API - CREATE DIMENSIONING GROUPS

StefanoPasquini6790
Advisor
Advisor

Good morning at all,

 

I'm writing a Macro to generate steel dimensioning bar groups via API in excel VBA (I'm not really expert programmer), I can't find the right way to my program code.

 

Can someone correct my code?

 

One more issues, I have to extract from the opened Robot model this data for bars:

 

1) Section Label;

 

2) Bar Type;

 

3) ULS Design Ratio.

 

Attached you can find the source code and the reference excel file.

 

Sorry for my basic questions....Smiley Embarassed

 

Thanks in advance, greetings


PasProStudio

www.pasquiniprogetti.eu

Structural + Detailing engineers
0 Likes
Accepted solutions (1)
1,037 Views
10 Replies
Replies (10)
Message 2 of 11

Rafal.Gaweda
Autodesk Support
Autodesk Support

Example attached



Rafal Gaweda
0 Likes
Message 3 of 11

Rafal.Gaweda
Autodesk Support
Autodesk Support

Mind that to get steel design ratio you have to run steel design by macro \ API

Example attached.



Rafal Gaweda
0 Likes
Message 4 of 11

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

Example

 

Dim Bar As RobotBar
Dim Sec As RobotBarSection
Dim MTLabel As RobotLabel
Dim BarCol As RobotBarCollection

Set BarCol = RobApp.Project.Structure.Bars.GetAll


For i = 1 To BarCol.Count
    
    Set Bar = BarCol.Get(i)

    Set Sec = Bar.GetLabel(I_LT_BAR_SECTION)
    Set MTLabel = Bar.GetLabel(I_LT_MEMBER_TYPE)

    Cells((7 + i), 1) = Bar.Number
    Cells((7 + i), 2) = Sec.Name
    Cells((7 + i), 3) = MTLabel.Name
    
Next i

 



Rafal Gaweda
Message 5 of 11

StefanoPasquini6790
Advisor
Advisor

Sorry,

one more question.

 

If I have in the model some bars with no dimesioning rule assigned, the MACRO debug:

 

Cattura.JPG

 

How can I tell to the macro to "jump" to the next element? With a simple cicle (the green one) I have no results....

 

Thanks


PasProStudio

www.pasquiniprogetti.eu

Structural + Detailing engineers
0 Likes
Message 6 of 11

Rafal.Gaweda
Autodesk Support
Autodesk Support
If Not Bar.HasLabel(I_LT_MEMBER_TYPE) Then GoTo 10

 



Rafal Gaweda
0 Likes
Message 7 of 11

StefanoPasquini6790
Advisor
Advisor

Good MOrning.

 

One more issue, if I have in the model some bars that in dimensioning phase have some warning (for example thin walled sections, or any other kind of warnings...) the macro of Dim Ratio debug.

 

How can avoid this issue?

 

Greetings


PasProStudio

www.pasquiniprogetti.eu

Structural + Detailing engineers
0 Likes
Message 8 of 11

Rafal.Gaweda
Autodesk Support
Autodesk Support
Do you want to report them ? They do not block design calculations.


Rafal Gaweda
0 Likes
Message 9 of 11

StefanoPasquini6790
Advisor
Advisor

HI Rafal,

 

No, I don't want to report them, but the calculation of ratio debug when the first warning it appear.

 

This is the code:

 

Sub GetRatioFromRobot()
'
'
Dim UlsLoadCase As Integer
Dim RobApp As IRobotApplication
Set RobApp = New RobotApplication
'Get the collection of all bars from the structure.
'
'Declare and create the object giving access to standard section parameters.
'
Set bar_col = RobApp.Project.Structure.Bars.GetAll()
UlsLoadCase = InputBox("INSERISCI IL NUMERO DI COMBINAZIONE SLU IN ROBOT")
'Iterate for consecutive bars from the collection.

For I = 1 To bar_col.Count

'Dim RobApp As RobotApplication
'Set RobApp = New RobotApplication

Dim RDMServer As IRDimServer
Set RDMServer = RobApp.Kernel.GetExtension("RDimServer")
RDMServer.Mode = I_DSM_STEEL

Dim RDmEngine As IRDimCalcEngine
Set RDmEngine = RDMServer.CalculEngine

'the part below is optional if you want to set caclulation parameters by the code

Dim RDmCalPar As IRDimCalcParam
Dim RDmCalCnf As IRDimCalcConf

Set RDmCalPar = RDmEngine.GetCalcParam
Set RDmCalCnf = RDmEngine.GetCalcConf

Dim RdmStream As IRDimStream 'Data stream for setting parameters
Set RdmStream = RDMServer.Connection.GetStream
RdmStream.Clear

'Calculate results for all sections
RdmStream.WriteText ("all") ' member(s) selection
RDmCalPar.SetObjsList I_DCPVT_MEMBERS_VERIF, RdmStream 'members verification
RDmCalPar.SetLimitState I_DCPLST_ULTIMATE, 1
RdmStream.Clear
RdmStream.WriteText (UlsLoadCase) 'Set Load Case(s)
RDmCalPar.SetLoadsList RdmStream

RDmEngine.SetCalcConf RDmCalCnf
RDmEngine.SetCalcParam RDmCalPar

'end of calclulation parameter settings

RDmEngine.Solve Nothing

Dim RDmDetRes As IRDimDetailedRes
Dim RDMAllRes As IRDimAllRes

Set RDMAllRes = RDmEngine.Results
Set RDmDetRes = RDMAllRes.Get(I)

Range("e" & I + 1) = RDmDetRes.Ratio

Next

End Sub

 

and attache you can find the file that give the warnings


PasProStudio

www.pasquiniprogetti.eu

Structural + Detailing engineers
0 Likes
Message 10 of 11

Rafal.Gaweda
Autodesk Support
Autodesk Support

Corrected code

 

Dim UlsLoadCase As Integer
Dim RobApp As IRobotApplication
Set RobApp = New RobotApplication
'Get the collection of all bars from the structure.
'
'Declare and create the object giving access to standard section parameters.
'
Set bar_col = RobApp.Project.Structure.Bars.GetAll()
UlsLoadCase = InputBox("INSERISCI IL NUMERO DI COMBINAZIONE SLU IN ROBOT")
'Iterate for consecutive bars from the collection.

Dim RDMServer As IRDimServer
Set RDMServer = RobApp.Kernel.GetExtension("RDimServer")
RDMServer.Mode = I_DSM_STEEL

Dim RDmEngine As IRDimCalcEngine
Set RDmEngine = RDMServer.CalculEngine
Dim RDmCalPar As IRDimCalcParam
Dim RDmCalCnf As IRDimCalcConf

Row = 1
For I = 1 To bar_col.Count
'Dim RobApp As RobotApplication
'Set RobApp = New RobotApplication



'the part below is optional if you want to set caclulation parameters by the code



If bar_col.Get(I).HasLabel(I_LT_MEMBER_TYPE) Then
Set RDmCalPar = RDmEngine.GetCalcParam
Set RDmCalCnf = RDmEngine.GetCalcConf
Dim RdmStream As IRDimStream 'Data stream for setting parameters
Set RdmStream = RDMServer.Connection.GetStream
RdmStream.Clear
'Calculate results for all sections

RdmStream.WriteLong (bar_col.Get(I).Number) ' member(s) selection
RDmCalPar.SetObjsList I_DCPVT_MEMBERS_VERIF, RdmStream 'members verification
RDmCalPar.SetLimitState I_DCPLST_ULTIMATE, 1
RdmStream.Clear
RdmStream.WriteText Str(UlsLoadCase) 'Set Load Case(s)
RDmCalPar.SetLoadsList RdmStream
RDmEngine.SetCalcConf RDmCalCnf
RDmEngine.SetCalcParam RDmCalPar

'end of calclulation parameter settings

RDmEngine.Solve Nothing
Dim RDmDetRes As IRDimDetailedRes
Dim RDMAllRes As IRDimAllRes
Set RDMAllRes = RDmEngine.Results
Set RDmDetRes = RDMAllRes.Get(bar_col.Get(I).Number)

'Range("d" & Row) = Str(bar_col.Get(I).Number)
Range("e" & Row) = RDmDetRes.Ratio
Row = Row + 1
End If

Next

 



Rafal Gaweda
Message 11 of 11

StefanoPasquini6790
Advisor
Advisor

Hi everybody;

 

published the version n°3 of the tool, edited and optimized.

 

Hope you enjoy, cheers.

 

http://www.pasquiniprogetti.it/?p=868


PasProStudio

www.pasquiniprogetti.eu

Structural + Detailing engineers