ifcopenshell: assign object
Hello.
I am trying to assign various elements to an element assembly. My function call looks like this:
ifcopenshell.api.run("aggregate.assign_object", model, relating_object=Rost, products=elements),
where Rost is an instance of IfcElementAssembly and elements is a list of the elements i would like to bundle into the assembly.
It yields the following error: TypeError: Usecase.init() got an unexpected keyword argument 'products'
First, I am a bit confused as in the source code the argument products is included:
def assign_object(
file: ifcopenshell.file,
products: list[ifcopenshell.entity_instance],
relating_object: ifcopenshell.entity_instance,
)
Can anyone help me spot the mistake?
Second, while I'm at it, I'm also a bit confused as to what the correct usage of the API is. I've seen the syntax used above with api.run("aggregate.assign_object", ...) as well as api.aggregate.assign_object(...). Considering the source code, the latter seems correct to me but I always get a "module is not callable" error.
What is the correct way to use the API?
Thanks in advance
Comments
not sure if this helps but you can call api functions without
run
please check the relelevant updated page
however, I tested the function and it's working (I have two walls in the basic model)
I used wall1.Decomposes and wall2.IsDecomposedBy to check the aggregation and it's ok
PS it's the first time I use this module.. ;)
related: https://github.com/IfcOpenShell/IfcOpenShell/issues/5163
thank you!