How to add large number of objects in the tree without refreshing the tree each time using ACT autom
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 871
✭✭✭✭
How to add large number of objects in the tree without refreshing the tree each time using ACT automation APIs in Mechanical?
Tagged:
0
Best Answer
-
If one tries to add a lot of objects in the tree in Mechanical, using automation APIs, it refreshes tree each time an object is added. This can lead to large delays in the process.
So one can suspend the tree first and then add the objects, for example:
with(ExtAPI.DataModel.Tree.Suspend()): for i in range(100): ExtAPI.DataModel.Project.Model.AddComment()
This will be significantly faster as compared to simply adding 100 objects in the tree.
2
Answers
-
The below option would also help in speed up of adding lots of objects.
with Transaction(suspendClicks=True): for i in range(100): ExtAPI.DataModel.Project.Model.AddComment()
0