Script to create IfcElementAssemblyType
@Gorgious Moving from this thread.
For my use case, shown here , I need to create type assemblies (IfcElementAssemblyType) for the precast concrete elements (20 different types) and instantiate copies (IfcElementAssembly) for the individual elements (32 modules x 36 elements). I intend to do this using script.
In the blenderbim-230701 version, with this syntax, it works like this:
In the most current version, blenderbim-230814, the syntax has changed:
The assembly type is created, but the element representations are replaced with a "default" shape.
Comments
I think this particular operator might need a rework, particularly the
from_invoke
argument which is smelly IMO, operators shouldn't have to rely on an explicit argument to know whether they were invoked or not (nor should they care, if they are called from invoke, the special case should be handled in theinvoke
method). Here's the definition FWIW https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/blenderbim/blenderbim/bim/module/model/product.py#L111 More than 100 lines long, I think you should look into using lower-level API calls to instantiate your instances, this is meant to be used in the context of the type manager I think.I saw this code and from what I could understand (I confess that I'm suffering a little from this) I suspect that the problem is in the function call on line 189 and change_object_data in https://github.com/IfcOpenShell/IfcOpenShell/blob/10fae033c83eaaa78d1bf8b46f36535cd9653e3b/src/blenderbim/blenderbim/tool/type.py#L29C9-L29C28 which replaces the "cube" mesh with the instantiated type mesh. As the IfcElementAssemblyType is created with an "empty" there is no "data" to replace so the "cube" remains.
I don't know where to start, if you can light my way, I'll be grateful!
For registration and for anyone who needs it in the future.
For the time being, an operator that does this directly is not available.
Using copy of IfcElementAssembly available from https://github.com/IfcOpenShell/IfcOpenShell/pull/3328 (thanks brunoperdigao) it is possible to do this: