API generate CODE combinations

API generate CODE combinations

AbelSV78
Enthusiast Enthusiast
1,351 Views
6 Replies
Message 1 of 7

API generate CODE combinations

AbelSV78
Enthusiast
Enthusiast

Hi, 

 

I am trying to create code combinations for Robot from VB.net. I am using this:

 

engine = robapp.Project.Structure.Cases.CodeCmbEngine
engine.Params.SelectCombinationType(RobotOM.IRobotCombinationType.I_CBT_ULS, True)

engine.Generate()

 

but it doesn't work. Perhaps I need to define params, but I don't know the variables and how to use it. Could you help me?

 

Thank you so much in advance

0 Likes
Accepted solutions (1)
1,352 Views
6 Replies
Replies (6)
Message 2 of 7

Rafal.Gaweda
Autodesk Support
Autodesk Support
    Dim r As New RobotOM.RobotApplication

    Dim q As RobotOM.RobotCodeCombinationEngine
    q = r.Project.Structure.Cases.CodeCmbEngine

    q.Params.GenType = RobotOM.IRobotCodeCmbGenerationType.I_CCGT_FULL
    q.Params.SelectCombinationType RobotOM.IRobotCombinationType.I_CBT_ULS, True
    q.Params.SelectCombinationType RobotOM.IRobotCombinationType.I_CBT_SLS, True

    q.Generate

 



Rafal Gaweda
0 Likes
Message 3 of 7

AbelSV78
Enthusiast
Enthusiast

Thank you so much, but there is another problem:

 

"Incorrect definition of relations between case groups".

 

I have used different simple cases of different nature. I know the problem in Robot, but I don't know how to solve with API.

 

Regards

0 Likes
Message 4 of 7

Rafal.Gaweda
Autodesk Support
Autodesk Support

Old example below, something may not work but at least it should give you idea how to play with it

(do not use Kernel in your code ; just example)

 

                Public Sub CodeCombinations(ByVal ccE As RobotOM.RobotCodeCombinationEngine, ByVal k As KernelOM.RobotKernel)

                                Dim KccE As KernelOM.RobotCodeCombinationEngine
                                KccE = k.Structure.Cases.CodeCmbEngine
                                'Dim ccG As RobotOM.RobotCodeCmbGroup
                                'Dim KccG As KernelOM.RobotCodeCmbGroup
                                Dim cas_lst As String = ""

                                Const COMB_TYPES As Integer = 7
                                'Const COMB_GROUPS As Integer = 6
                                Const COMB_DECID_VAL As Integer = 14
                                'Const COEF_COUNT As Integer = 13
                                Dim i As Integer
                                'Dim j As Integer
                                Dim q As Integer

                                KccE.Params.GenType = ccE.Params.GenType

                                'cases
                                Dim casCol As RobotOM.IRobotCollection
                                Dim KcasCol As KernelOM.IRobotCollection
                                casCol = ccE.Params.ActiveCases
                                KcasCol = KccE.Params.ActiveCases
                                Dim cinfo As RobotOM.RobotCodeCmbActiveCaseInfo
                                Dim Kcinfo As KernelOM.RobotCodeCmbActiveCaseInfo
                                For i = 1 To KcasCol.Count
                                                Kcinfo = KcasCol.Get(i)
                                                For q = 1 To casCol.Count
                                                                cinfo = casCol.Get(q)
                                                                If cinfo.CaseNumber = Kcinfo.CaseNumber Then
                                                                                Exit For
                                                                End If
                                                Next
                                                If cinfo.IsSelected Then
                                                                Kcinfo = KcasCol.Get(i)
                                                                Kcinfo.IsSelected = cinfo.IsSelected
                                                                Kcinfo.Coefficient = cinfo.Coefficient
                                                End If
                                Next

                                If ccE.Params.AllBars Then
                                                KccE.Params.AllBars = ccE.Params.AllBars
                                Else
                                                KccE.Params.BarSel = ccE.Params.BarSel
                                End If
                                If ccE.Params.AllNodes Then
                                                KccE.Params.AllNodes = ccE.Params.AllNodes
                                Else
                                                KccE.Params.NodeSel = ccE.Params.NodeSel
                                End If
                                KccE.Params.ExtremalSnowFactor = ccE.Params.ExtremalSnowFactor

                                If KccE.Params.GenType = KernelOM.IRobotCodeCmbGenerationType.I_CCGT_SIMPLIFIED Then
                                                For i = 1 To COMB_DECID_VAL
                                                                KccE.Params.SelectDecidingValue(i, ccE.Params.IsDecidingValueSelected(i))
                                                Next
                                                KccE.Params.SelectDecidingValue(KernelOM.IRobotCodeCmbDecidingValueType.I_CCDVT_REACTIONS, _
                                                                ccE.Params.IsDecidingValueSelected(RobotOM.IRobotCodeCmbDecidingValueType.I_CCDVT_REACTIONS))
                                End If


                                'For q = 1 To ccE.Params.Regulations.Actions.Count
                                '               KccE.Params.Regulations.Actions.SetNature(q, ccE.Params.Regulations.Actions.GetNature(q))
                                '               KccE.Params.Regulations.Actions.SetName(q, ccE.Params.Regulations.Actions.GetName(q))
                                '               For j = 0 To COEF_COUNT
                                '                               KccE.Params.Regulations.Actions.SetCoeff(q, j, ccE.Params.Regulations.Actions.GetCoeff(q, j))
                                '               Next
                                'Next

                                'Dim lim_state As RobotOM.IRobotLimitState
                                'Dim cmb_typ As RobotOM.IRobotCodeCmbCombType
                                'Dim cmb_nam As String = ""
                                'Dim d_c As Short, l_c As Short, a_c As Short, s_c As Short

                                'For i = 1 To ccE.Params.Regulations.Combinations.Count
                                '               ccE.Params.Regulations.Combinations.Get(i, lim_state, cmb_typ, cmb_nam, d_c, l_c, a_c, s_c)
                                '               KccE.Params.Regulations.Combinations.[New](lim_state, cmb_typ, cmb_nam, d_c, l_c, a_c, s_c)
                                'Next

                                'Try
                                '               q = 0
                                '               While True
                                '                               KccE.Params.SelectCombination(q, ccE.Params.IsCombinationSelected(q))
                                '                               q += 1
                                '               End While
                                'Catch ex As Exception
                                '               'end of combinations
                                'End Try


                                'combinations



                                For i = 0 To COMB_TYPES
                                                If ccE.Params.IsCombinationTypeSelected(i) Then
                                                                KccE.Params.SelectCombinationType(i, True)
                                                Else
                                                                KccE.Params.SelectCombinationType(i, False)
                                                End If
                                Next



                                'groups
                                'For i = 0 To COMB_GROUPS
                                '               For j = 0 To ccE.Params.Groups.GetCount(i)
                                '                               ccG = ccE.Params.Groups.Get(i, j)

                                '                               For q = 1 To ccG.CaseCount
                                '                                               If ccG.IsFull Then
                                '                                                               'KccG.AddAll()
                                '                                               End If
                                '                               Next
                                '                               KccE.Params.Groups.[New](i, ccG.Operator, cas_lst)
                                '                               cas_lst = ""
                                '               Next
                                'Next

                                'relations
                                'Dim crel As RobotOM.RobotCodeCmbGroupRelation
                                'Dim Kcrel As KernelOM.RobotCodeCmbGroupRelation
                                'For q = 0 To COMB_TYPES
                                '               crel = ccE.Params.Relations.Get(q)
                                '               Kcrel = KccE.Params.Relations.Get(q)
                                'Next


                                k.Structure.Cases.CodeCmbEngine.Generate()

                End Sub

 



Rafal Gaweda
0 Likes
Message 5 of 7

AbelSV78
Enthusiast
Enthusiast
Accepted solution

Hi, finally I have found out this:

........................................

If norma.Text = "EUROCODE" Then
robapp.Project.Preferences.SetActiveCode(RobotOM.IRobotCodeType.I_CT_STEEL_STRUCTURES, "UNE-EN 1993-1:2005/AC:2009")
robapp.Project.Preferences.SetActiveCode(RobotOM.IRobotCodeType.I_CT_CODE_COMBINATIONS, "EN 1990:2002")
.......................
End If

Dim engine As RobotOM.IRobotCodeCombinationEngine
Dim codecombination As RobotOM.RobotCodeCombinationEngine
Dim cmbparams As RobotOM.IRobotCodeCmbGenerationParams

 

codecombination = robapp.Project.Structure.Cases.CodeCmbEngine
codecombination.Params.GenType = RobotOM.IRobotCodeCmbGenerationType.I_CCGT_FULL
codecombination.Params.SelectCombinationType(RobotOM.IRobotCombinationType.I_CBT_ULS, True)

cmbparams = robapp.Project.Structure.Cases.CodeCmbEngine.Params
cmbparams.Groups.[New](RobotOM.IRobotCaseNature.I_CN_PERMANENT, RobotOM.IRobotCodeCmbOperator.I_CCO_AND, "0")
cmbparams.Groups.[New](RobotOM.IRobotCaseNature.I_CN_EXPLOATATION, RobotOM.IRobotCodeCmbOperator.I_CCO_AND_OR, "0")
cmbparams.Groups.[New](RobotOM.IRobotCaseNature.I_CN_WIND, RobotOM.IRobotCodeCmbOperator.I_CCO_EXCLUSIVE_OR, "0")
cmbparams.Groups.[New](RobotOM.IRobotCaseNature.I_CN_SEISMIC, RobotOM.IRobotCodeCmbOperator.I_CCO_EXCLUSIVE_OR, "0")
cmbparams.Groups.[New](RobotOM.IRobotCaseNature.I_CN_SNOW, RobotOM.IRobotCodeCmbOperator.I_CCO_AND, "0")
cmbparams.Groups.[New](RobotOM.IRobotCaseNature.I_CN_ACCIDENTAL, RobotOM.IRobotCodeCmbOperator.I_CCO_AND, "0")
cmbparams.Groups.[New](RobotOM.IRobotCaseNature.I_CN_TEMPERATURE, RobotOM.IRobotCodeCmbOperator.I_CCO_AND, "0")
codecombination.Generate()

 

Thanks

0 Likes
Message 6 of 7

Anonymous
Not applicable

HI Rafal Gaweda, 

 

plz, I need help ...

How to use relations between groups with VBA 

 

PERMANENT "G1" And "G2"

EXPLOITATION "Q1" OR"Q2"

1.PNG

0 Likes
Message 7 of 7

Anonymous
Not applicable

"Definition of relations between groups. Definition of relations between groups can be illustrated by means of the matrix whose elements are group numbers. All groups whose numbers are located in the same matrix row are in the same relation with each other (either AND or AND_OR). Whereas among the matrix rows the relation EXCLUSIVE_OR occurs. ." 

 

How to do relation between "G1" And "G2" with VBA plz 

 

Thank ... 

0 Likes