If you're reading this, we've just migrated servers! If anything looks broken please email dion@thinkmoult.com :)

Object representation and location is not saved correctly to IFC File

When I import my IFC file into a new project many of my objects do not have the correct representations of locations and some deleted objects are still in the ifc file. Any ideas? I know I must be missing a some steps in the process...

Comments

  • are you importing the IFC from another BIM program, or did you model this from scratch in BB?

  • edited May 2023

    If you modeled it from scratch i would suggest starting with one thing, perhaps the truss assembly, and seeing if it 'roundtrips' in/out of BB.
    If it doesn't, and/or the locations are wrong, i would do a videocast of your workflow, so others can see what you're doing exactly.
    I often save the IFC and reopen it in BB quite frequently, just to make sure everything looks as intended. Because, yes, these quirky things can happen... although BB's getting a lot more stable in this regard.
    ...
    Also, although i'm not 100 certain this was the cause of your problem, i would suggest creating your IfcMemberTypes, IfcBeamTypes, IfcColumnTypes, etc. with a IfcMaterialProfileSet, vs a IfcMaterialLayerSet. Allows for better miter/butt joints and you can edit the single line axis, as well.

    dbrundage
  • @theoryshaw said:
    If you modeled it from scratch i would suggest starting with one thing, perhaps the truss assembly, and seeing if it 'roundtrips' in/out of BB.
    If it doesn't, and/or the locations are wrong, i would do a videocast of your workflow, so others can see what you're doing exactly.
    I often save the IFC and reopen it in BB quite frequently, just to make sure everything looks as intended. Because, yes, these quirky things can happen... although BB's getting a lot more stable in this regard.
    ...
    Also, although i'm not 100 certain this was the cause of your problem, i would suggest creating your IfcMemberTypes, IfcBeamTypes, IfcColumnTypes, etc. with a IfcMaterialProfileSet, vs a IfcMaterialLayerSet. Allows for better miter/butt joints and you can edit the single line axis, as well.

    Thank you. I clearly have lots to learn still. You were spot on. I followed your video in https://community.osarch.org/discussion/1038/blenderbim-ifc-custom-defined-beamtype-from-ifcmaterialprofileset and that worked.

    I was also having the issue of ifc entities not being deleted. Possibly from using the delete key instead of IFC Delete... wrote a script to clean it up though and it seemed to work alright....

    import bpy
    import ifcopenshell
    
    ifc_file_path = ""
    ifc_backup_path = ""
    ifc_file = ifcopenshell.open(ifc_file_path)
    ifc_file.write(ifc_backup_path)
    
    blender_object_ids = set(
        obj.BIMObjectProperties.ifc_definition_id
        for obj in bpy.context.scene.objects
        if obj.BIMObjectProperties.ifc_definition_id
    )
    
    ifc_object_ids = set(item.id() for item in ifc_file.by_type("IfcObject"))
    unused_object_ids = ifc_object_ids - blender_object_ids
    
    print("un",unused_object_ids)
    # Delete all unused objects in the IFC file
    for obj_id in unused_object_ids:
        print("id", obj_id)
        obj = ifc_file.by_id(obj_id)
        refs = set(item.id() for item in ifc_file.get_inverse(obj))
        print("refs",refs)
        ifc_file.remove(obj)
        for id in refs:
            ref_obj = ifc_file.by_id(id)
            ifc_file.remove(ref_obj)
    
    # Save the modified IFC file
    ifc_file.write("ifc_file_path")
    
    
  • I was also having the issue of ifc entities not being deleted. Possibly from using the delete key instead of IFC Delete... wrote a script to clean it up though and it seemed to work alright....

    @dbrundage You could also try ifcopenshell.api.run('root.remove_product', ifc_file, product=element)
    check the doc for reference

Sign In or Register to comment.