439x
005382
2023-05-09

Question

How can I edit multiple models in one script using Python?


Answer:

If your project requires editing multiple models, there are two options to choose:

  • 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)



Author

Mr. Karataş is responsible for the development and quality assurance of Dlubal programs.