Hello dev & support team,
I'm writing a script to change the attributes of a large collection of elements.
So far I have a working script to change the attributes of that element collection but in comparison with the interface function 'Import Attributes' it is really slow.
The reason for the slowness of the script lies in the updates that are triggered in Allplan every time I use AllplanBaseElements.ElementsAttributeService.ChangeAttributes()
In Allplan Trace I then see many of the following blocks when running the script:
Data Update - 32 ms
Update Asso View- 0 ms
Update UVS - 0 ms
Update Finish Elements - 0 ms
Fill Finish Elements - 0 ms
Update MVS Section Doc - 0 ms
My question and/or request:
[edit]After experimenting with the function, see also conversation here below, I can only come to the conclusion that AllplanBaseElements.ElementsAttributeService.ChangeAttributes can only change a list of attributes for one element, not multiple elements.
I think it would be very useful if we can use sublists within the 'attributeDataList'.
Many thanks in advance for considering my request.
Steven Maijinckx
Code of the script:
def reset_enumerations(self): """ Resets enumerated objects back to their prefix """ # Empty list for tuple with (attribute_id, value) element_attribute_list = [] # Empty adapter list element_adapter_list = AllplanElementAdapter.BaseElementAdapterList() # Note: # Attribute 507 / 'description' is used to store the enumerated element names. # In an IFC export this is the element name. for element in AllplanBaseElements.ElementsSelectService.SelectAllElements(self.coord_input.GetInputViewDocument()): attributes = AllplanBaseElements.ElementsAttributeService.GetAttributes(element) for id, value in attributes: if id == 507 and value != "": element_adapter_list.append(element) prefix = str() for char in value: if char in string.ascii_letters: prefix += char else: element_attribute_list.append((507, prefix)) break AllplanBaseElements.ElementsAttributeService.ChangeAttributes(element_attribute_list, element_adapter_list) element_attribute_list = [] element_adapter_list = AllplanElementAdapter.BaseElementAdapterList() return