Creating IfcCompositeProfileDef along with IfcMirorredProfileDef

I'm trying to create a composite element type with multiple profile extrusions. Has anyone tried IfcMirroredProfileDef and IfcCompositeProfileDef. I have been able to make the composite profile partially successful, but, with mirroring, my element type fails.
Any help in this direction. I am trying to do this with IfcOpenshell
I have also changed the Position attribute of the profile to achieve the relative placement of profiles within the composite profile. Is that how it is done?

theoryshawNigel

Comments

  • with mirroring, my element type fails.

    fails how?

    I have also changed the Position attribute of the profile to achieve the relative placement of profiles within the composite profile. Is that how it is done?

    I think it depends whether subprofiles of the composite profile should still be available without the offsets. To keep the offset separate from the original profiles you can use IfcDerivedProfileDef.

  • ArvArv
    edited February 9

    Hi @Andrej730
    I've done a simple test to create a mirrored profile from a u-profile and assign it to a beam type.
    This is my code below
    I'hv also shared the error message on opening the ifc file.
    Is the shape creation for IfcMirroredProfileDef failing?
    I'm also attaching the test ifc file fyr

    import ifcopenshell
    path = '/home/arun/Desktop/mirror_test_u.ifc'
    
    f = ifcopenshell.open(path)
    beam_type = ifcopenshell.api.run('root.create_entity', f, ifc_class='IfcBeamType')
    
    u_profile = f.by_type('IfcUShapeProfileDef')[0]
    
    u_profile_mirrored = f.createIfcMirroredProfileDef()
    u_profile_mirrored.ProfileType = 'AREA'
    u_profile_mirrored.ParentProfile = u_profile
    
    material_set = ifcopenshell.api.run('material.add_material_set', f, name=None, set_type='IfcMaterialProfileSet')
    ifcopenshell.api.run('material.add_profile', f, profile_set=material_set, material=None, profile=u_profile_mirrored)
    ifcopenshell.api.run('material.assign_material', f, product=beam_type, material=material_set)
    
    f.write(path)
    
    Python: Traceback (most recent call last):
      File "/home/arun/.config/blender/4.0/scripts/addons/blenderbim/bim/module/project/operator.py", line 642, in execute
        return self.finish_loading_project(context)
      File "/home/arun/.config/blender/4.0/scripts/addons/blenderbim/bim/module/project/operator.py", line 657, in finish_loading_project
        bpy.ops.bim.load_project_elements()
      File "/home/arun/Apps/blender-4.0.1-linux-x64/4.0/scripts/modules/bpy/ops.py", line 109, in __call__
        ret = _op_call(self.idname_py(), kw)
    RuntimeError: Error: Python: Traceback (most recent call last):
      File "/home/arun/.config/blender/4.0/scripts/addons/blenderbim/bim/module/project/operator.py", line 740, in execute
        tool.Project.load_default_thumbnails()
      File "/home/arun/.config/blender/4.0/scripts/addons/blenderbim/tool/project.py", line 54, in load_default_thumbnails
        bpy.ops.bim.load_type_thumbnails(ifc_class=ifc_class, offset=0, limit=9)
      File "/home/arun/Apps/blender-4.0.1-linux-x64/4.0/scripts/modules/bpy/ops.py", line 109, in __call__
        ret = _op_call(self.idname_py(), kw)
    RuntimeError: Error: Python: Traceback (most recent call last):
      File "/home/arun/.config/blender/4.0/scripts/addons/blenderbim/tool/ifc.py", line 207, in execute
        IfcStore.execute_ifc_operator(self, context)
      File "/home/arun/.config/blender/4.0/scripts/addons/blenderbim/bim/ifc.py", line 341, in execute_ifc_operator
        result = getattr(operator, "_execute")(context)
      File "/home/arun/.config/blender/4.0/scripts/addons/blenderbim/bim/module/model/product.py", line 389, in _execute
        if tool.Model.update_thumbnail_for_element(element):
      File "/home/arun/.config/blender/4.0/scripts/addons/blenderbim/tool/model.py", line 780, in update_thumbnail_for_element
        tool.Profile.draw_image_for_ifc_profile(draw, profile, size)
      File "/home/arun/.config/blender/4.0/scripts/addons/blenderbim/tool/profile.py", line 34, in draw_image_for_ifc_profile
        shape = ifcopenshell.geom.create_shape(settings, profile)
      File "/home/arun/.config/blender/4.0/scripts/addons/blenderbim/libs/site/packages/ifcopenshell/geom/main.py", line 210, in create_shape
        ifcopenshell_wrapper.create_shape(settings, inst.wrapped_data, repr.wrapped_data if repr is not None else None),
      File "/home/arun/.config/blender/4.0/scripts/addons/blenderbim/libs/site/packages/ifcopenshell/ifcopenshell_wrapper.py", line 1817, in create_shape
        return _ifcopenshell_wrapper.create_shape(settings, instance, representation)
    RuntimeError: Token * at offset 3,316 invalid instance name
    Location: /home/arun/Apps/blender-4.0.1-linux-x64/4.0/scripts/modules/bpy/ops.py:109
    Location: /home/arun/Apps/blender-4.0.1-linux-x64/4.0/scripts/modules/bpy/ops.py:109
    
    
  • I think it's a bug, started an issue on github - https://github.com/IfcOpenShell/IfcOpenShell/issues/4307

    Arv
  • @Arv
    Tested - mirrored profiles are now supported too. Feel free to reopen issue on github if you find any related issues.

    Arv
Sign In or Register to comment.