539x
005382
2023-05-09

Cómo trabajar con múltiples modelos en una secuencia de comandos de Python utilizando la función Model()

¿Cómo puedo editar varios modelos en un script usando Python?


Respuesta:

Si su proyecto requiere la edición de varios modelos, hay dos opciones para elegir:

If you have multiple operations to do in one model and then switch to another, you can do it easily by calling Model() before switching it. This is executed in one session, that is, as fast as possible.

model1 = Model(True, 'TestModel1')
Material(1,'S235')
Material(2,'S235')

model2 = Model(True, 'TestModel2')
Material(3,'S275')

Model(False, 'TestModel1')
Material(4,'S235')

Model(False, 'TestModel2')
Material(5,'S275')

The second method is to create an instance of a Model() and use it as a method to parameter to apply changes to a specific model. This comes handy when making a small amount of changes between a lot of models.

model1 = Model(True, 'TestModel1')
Material(1,'S235', model = model1)
Material(2,'S235', model = model1)

model2 = Model(True, 'TestModel2')
Material(3,'S275', model = model2)

Material(4,'S235', model = model1) 

Material(5,'S275', model = model2)


;