Martensite_Steel
Civil/Environmental
- Feb 8, 2019
- 8
Hello everyone,
although I'm getting a little bit better with the whole python and scripting thing in general, I'm still far from an expert and struggling with some things.
In my assembly, I have several lateral reinforcement bars. They are applied via a linear pattern in 3-direction and the total number of instances is defined in the variable x. For an embedded constraint, I want to put all the lateral reinforcement into the set "Reinforcement". Since the total amount of bars can vary, I'd like to put the instances into a set automatically with a for-loop. But I have absolutely no idea how to do this and this drives me crazy.
At first, I thought about something like this: (I know, that the variable 'cells' will overwrite itself for every pass through the loop, so this cannot be the right solution. Somehow it should be possible to append i to the variable 'cells', so that it goes: cells1=… , cells2=… )
I guess, it would be best, if every reinforcement bar was put into its own set, so that they can be put all together afterwards via MdB.models['Model-1'].rootAssembly. Set(cells=cells1+cells2+ … cellsx, name='Reinforcement')
I'm pretty sure, my whole idea is way too complicated. But it's all I got… I keep searching for a solution, but if someone could give me a little push in the right direction, it would be greatly appreciated.
although I'm getting a little bit better with the whole python and scripting thing in general, I'm still far from an expert and struggling with some things.
In my assembly, I have several lateral reinforcement bars. They are applied via a linear pattern in 3-direction and the total number of instances is defined in the variable x. For an embedded constraint, I want to put all the lateral reinforcement into the set "Reinforcement". Since the total amount of bars can vary, I'd like to put the instances into a set automatically with a for-loop. But I have absolutely no idea how to do this and this drives me crazy.
At first, I thought about something like this: (I know, that the variable 'cells' will overwrite itself for every pass through the loop, so this cannot be the right solution. Somehow it should be possible to append i to the variable 'cells', so that it goes: cells1=… , cells2=… )
Python:
for i in range(x+1):
[indent]cells=MdB.models['Model-1'].rootAssembly.instances['Reinforcement-'+str(i)].getByBoundingCylinder((0.0,0.0,0.0),(0.0,0.0,l),2*l)
[/indent]
I guess, it would be best, if every reinforcement bar was put into its own set, so that they can be put all together afterwards via MdB.models['Model-1'].rootAssembly. Set(cells=cells1+cells2+ … cellsx, name='Reinforcement')
I'm pretty sure, my whole idea is way too complicated. But it's all I got… I keep searching for a solution, but if someone could give me a little push in the right direction, it would be greatly appreciated.