Robot Structural Analysis Forum
Welcome to Autodesk’s Robot Structural Analysis Forums. Share your knowledge, ask questions, and explore popular Robot Structural Analysis topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python load combinations

14 REPLIES 14
SOLVED
Reply
Message 1 of 15
1234eddie
1722 Views, 14 Replies

Python load combinations

Hi all,

 

I hope someone here can help me a little bit with this.

 

I'm working with a python script inside dynamo, to create load combination in Robot.

The fact is i got it working for just one combination.(see picture below).

python loadcomb tbv forum single.JPG

This is the python script:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
clr.AddReferenceToFileAndPath(user +r"\Dynamo\Dynamo Core\1.3\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll")
from RobotOM import *
from System import Object

#The inputs to this node will be stored as a list in the IN variables.

CombCaseName = IN[0]
CaseNumber = IN[1]
CFactors = IN[2]
CombNumber = IN[3]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
loads = structure.Cases

CaseComb = structure.Cases.CreateCombination(CombNumber,CombCaseName,IRobotCombinationType.I_CBT_ULS,IRobotCaseNature.I_CN_WIND,IRobotCaseAnalizeType.I_CAT_COMB)
IRobotCaseFactorMngr
caseManage1 = CaseComb.CaseFactors
caseManage1.New(CaseNumber[0],CFactors[0])
caseManage1.New(CaseNumber[1],CFactors[1])
caseManage1.New(CaseNumber[2],CFactors[2])
caseManage1.New(CaseNumber[3],CFactors[3])

But now i want to edit the script to do this for multipe cases. This is what i have written now, but it only creates "Comb1".

python loadcomb tbv forum multiple.JPG

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
clr.AddReferenceToFileAndPath(user +r"\Dynamo\Dynamo Core\1.3\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll")
from RobotOM import *
from System import Object

#The inputs to this node will be stored as a list in the IN variables.

CombCaseName = IN[0]
CaseNumber = IN[1]
CFactors = IN[2]
CombNumber = IN[3]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
loads = structure.Cases

CaseComb = structure.Cases.CreateCombination(CombNumber[0],CombCaseName[0],IRobotCombinationType.I_CBT_ULS,IRobotCaseNature.I_CN_WIND,IRobotCaseAnalizeType.I_CAT_COMB)
IRobotCaseFactorMngr
caseManage1 = CaseComb.CaseFactors
caseManage1.New(CaseNumber[0],CFactors[0])
caseManage1.New(CaseNumber[1],CFactors[1])
caseManage1.New(CaseNumber[2],CFactors[2])
caseManage1.New(CaseNumber[3],CFactors[3])

Can someone tell me what i should change
1: in the python script to do this for multiple combinations?
2: With “IRobotCaseFactorMngr” I’m now limited it to four cases and factors, how can i change it so it’s dynamic.

 

I have also asked the same question at the Dynamo forum, see link.

https://forum.dynamobim.com/t/dynamo-and-rsa-define-load-combinations/26777/5

 

Thanks in advance,

 

Edward

14 REPLIES 14
Message 2 of 15
1234eddie
in reply to: 1234eddie

I solved this by myself. 

 

just use a few loops in the python code to create combinations.

 

PS: quite funny to see that a lot of people don't react when using API or python in the title, while it brings you much more possibilities in automation of structures.

Message 3 of 15
chico.escobar
in reply to: 1234eddie

Hey Eddie.

 

I have exactly the same question. But it was not clear for me which loops were necessary to solve this problem.

 

Could you share the final script?

 

Thanks a lot in advance

Message 4 of 15
1234eddie
in reply to: 1234eddie

hi @chico.escobar 

 

this is my final script,

 

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
clr.AddReferenceToFileAndPath(user +r"\Dynamo\Dynamo Core\1.3\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll")
from RobotOM import *
from System import Object

#The inputs to this node will be stored as a list in the IN variables.

CombCaseName = IN[0]
CaseNumber = IN[1]
CFactors = IN[2]
CombNumber = IN[3]
CBTTYPE = IN[4]
ICN = IN[5]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
loads = structure.Cases

for k in range(len(CombNumber)):
	CaseComb = structure.Cases.CreateCombination(CombNumber[k],CombCaseName[k],CBTTYPE[k],ICN[k],IRobotCaseAnalizeType.I_CAT_COMB)
	IRobotCaseFactorMngr
	for j in range(len(CaseNumber[k])):
		caseManage1 = CaseComb.CaseFactors
		caseManage1.New(CaseNumber[k][j],CFactors[k][j])
Out = CombNumber

 

hope this will help you.

Message 5 of 15
vise92
in reply to: 1234eddie

Hello! I think I have the same problem! I imported from Excel, my list of: - Name of the combination -Factor of the first load condition -Name of the first load condition ...... Up to 4 conditions within the first load combination. From these lists I have to create about a hundred load combinations, but reading your script I can't understand how to add more load conditions within a combination. How can I do?

Message 6 of 15
1234eddie
in reply to: 1234eddie

Hi @vise92 

(nice to see you here and on the dynamo forum)

 

it took me some time to solve this issue but check the next images from my script.

this is my excel input.[i have once made a list of all availible combination which will occur in my system, and now i just select the load case and the excel tab will automatically fill the corresponding combinations. for the combinations which are not selected there are 0- values]

yellow=loadcasenumber, green=loadcasename,orange=combination name,blue=combinationnumber,grey=combination setting

Excel input.JPG

 

and this is the filtering i use from import excel.

part 1.JPGpart 2.JPG

and these will gett in to this script:

[i have removed all other call's but see script in post above]

COMB_INST = IN[0]
CCombNumber = IN[1]
CFactors = IN[2]
#Assign your output to the OUT variable.
for f in range(len(COMB_INST)):
	if (loads.Exist(COMB_INST[f][1])):
		OUT= "ok"
	if not (loads.Exist(COMB_INST[f][1])):
		CaseComb = structure.Cases.CreateCombination(COMB_INST[f][1],COMB_INST[f][0],COMB_INST[f][4],COMB_INST[f][2],COMB_INST[f][3])
		IRobotCaseFactorMngr
		for g in range(len(CCombNumber[f])):
			caseManage1 = CaseComb.CaseFactors
			caseManage1.New(CCombNumber[f][g],CFactors[f][g])

 

I hope this is something usefull for you. if you have other questions let me know.

 

Gr Edward

Message 7 of 15
vise92
in reply to: 1234eddie

Hello! Thanks a lot for the answer. Question, in your load combinations, how many load conditions do you have? For each load combination I always have 4 load conditions and consequently 4 multiplying factors of the load conditions. Maybe that's why it doesn't work for me? Thanks so much!

Message 8 of 15
vise92
in reply to: 1234eddie

These are the lists that the Python script should theoretically concatenate to create the single load combination. In the Python script I would have 7 inputs and then a single output which matches my load combination. To this then I have to understand if it is possible to tell him that he will be at SLU or SLE. Is everything possible?

Message 9 of 15
1234eddie
in reply to: 1234eddie

@vise92 

 

i'm quite busy at the moment, probably at the end of the day i can look again to it. 

but can you provide some more information. because what do you mean with SLU and SLE? does this mean 'ultimate limit state' and 'serviceliabilty state'?

and can you make a screenshot with the data opened? because i see now 7 times list get item at index, but can't see the information what is taken.

 

PS for the provided script and graph in post 6 it doesn't matter how many load conditions you have for a combination. for example combination 8(blue) has 2 conditons and 9(blue) has 5 conditons.

 

it would be really usefull if you can share a simplified excel and dynamo file of your input.

 

Gr edward

Message 10 of 15
vise92
in reply to: 1234eddie

Hello! No problem! Indeed thank you very much for the help! Yes I mean 'ultimate limit state' and 'serviceliabilty state'. I have attached both the excel and the simplified dynamo file. In the meantime, however, I am doing some tests but with very little results!

Message 11 of 15
1234eddie
in reply to: 1234eddie

Hi @vise92 

 

I did look at your script and excel file.

it's quite hard for me to understand the italian language(I'm from the Netherlands). but i get the way how you have build your excel.

 

But i miss some information to fully help you. as you may have seen i have three definitions marked in grey.

these are essantial for the combination. but my italian is not that good that i can't find them in your excel at the moment. i have added a sheet with "Robot SDK" with these names explained.

i also added a sheet which is called "New". from my point of view you should add a search and index function on this one to connect the factors for the load case. 

if you do this from there you can use the graph provided.

 

but if you want to continue with your own dynamo file it's possible but than you should add the information from the "IRCN, IRCAT, IRCBT". 

and than you should combine the lists with the load factors, do this the same for the load case numbers(where robot has to apply the factors).

 

I'm quite lazy that i don't want to write long lines of code. instead i use the index numbers of "IRCN, IRCAT, IRCBT"

 

I hope i helped you a little bit with my explantion.

 

If you have more questions let me know.

 

I hope to see your result soon.

Message 12 of 15
vise92
in reply to: 1234eddie

Hello! Thanks for the reply! Would I ask too much if I could have your script and your excel? I can't figure out how to do the script in Python and consequently I can't figure out which data should be imported into Dynamo. Thanks so much!

Message 13 of 15
1234eddie
in reply to: 1234eddie

Hi @vise92 

Below the pictures with the settings i mentioned.  "IRCN, IRCAT, IRCBT".

if you add this to your combinations information.

i will probably do a short check tonight, to solve somethings.

IRCBT_IRCN.pngIRCAT.png

as for now i won't share my excel because it's company owned and connected with different other spreadsheets.

 

 

Message 14 of 15
1234eddie
in reply to: 1234eddie

Hi @vise92 

 

How are you doiing?

i'm quite curious if you got it working?

 

(i'm quite busy at the moment)

 

Gr Edward

 

Message 15 of 15
vise92
in reply to: 1234eddie

vise92_0-1625822113989.png

Hello!! Yes in the end I saw that it was enough to set the table well and then do a simple copy and paste! It seems very strange to me that there is no evidence within the forum. Thanks so much for your time anyway!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report