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

Can't import IFC in Blender

I have been trying to model a traditional hay barrack in Blender and exported the IFC with BlenderBIM.
I never saved the .blend file because I want the IFC to be the single source of truth.
Import and exporting worked perfectly all the time, with deleting, moving, rotating object and using modifiers in Blender.
This is the IFC result so far.

Now I wanted to import the IFC in Blender again and I am completely clueless about the error.

It says instance #74 is not found, so I went to take a look in the IFC file with a text editor.

    #52=IFCAXIS2PLACEMENT3D(#49,#50,#51);
    #53=IFCLOCALPLACEMENT(#47,#52);
    #54=IFCFOOTING('0_wNcyxBTDYveCIR9WfDF2',$,'kolomvoet_350x350mm',$,$,#284,#72,$,.PILE_CAP.);
    #72=IFCPRODUCTDEFINITIONSHAPE($,$,(#293,#296));
    #73=IFCRELCONTAINEDINSPATIALSTRUCTURE('0gtnMjx_r5dvs_KZEnqMyF',$,$,$,(#54,#18388,#403,#4878,#13778,#9328,#428,#18401,#18448,#18568,#18603,#18628,#23083,#27538,#31993,#36448,#36526,#36561,#36586,#41041,#45496,#49951,#54406,#54489,#54524,#54549,#59004,#63459,#67914,#72369,#72447,#72490,#72538,#72569,#72830,#72934,#73386,#73542,#73576,#75062,#74985,#75093,#75135,#75136,#73843,#74220,#74659,#74688,#75106),#30);
    #79=IFCGRID('19d2Q$ilf29waioKA$NL7w',$,'Grid',$,$,#90,$,(#95,#99),(#107,#111),$,$);
    #85=IFCRELCONTAINEDINSPATIALSTRUCTURE('1aJm8I1W1E0A4aIOGnf9UP',$,$,$,(#79),#18);
    #86=IFCCARTESIANPOINT((0.,0.,0.));
    #87=IFCDIRECTION((0.,0.,1.));
    #88=IFCDIRECTION((1.,0.,0.));
    #89=IFCAXIS2PLACEMENT3D(#86,#87,#88);
    #90=IFCLOCALPLACEMENT(#41,#89);
    #92=IFCCARTESIANPOINT((-2000.,0.,0.));

And indeed #74 is missing, I have no idea what should have been here, I also can't find #74 references anywhere else in the IFC file. Any idea on how to restore this error without having a .blend file?

Comments

  • I just manually added this:

    #72=IFCPRODUCTDEFINITIONSHAPE($,$,(#293,#296));
    #73=
    #74=
    #73=IFCRELCONTAINEDINSPATIALSTRUCTURE('0gtnMjx_r5dvs_KZEnqMyF',$,$,$,(#54,#18388,#403,#4878,#13778,#9328,#428,#18401,#18448,#18568,#18603,#18628,#23083,#27538,#31993,#36448,#36526,#36561,#36586,#41041,#45496,#49951,#54406,#54489,#54524,#54549,#59004,#63459,#67914,#72369,#72447,#72490,#72538,#72569,#72830,#72934,#73386,#73542,#73576,#75062,#74985,#75093,#75135,#75136,#73843,#74220,#74659,#74688,#75106),#30);
    #79=IFCGRID('19d2Q$ilf29waioKA$NL7w',$,'Grid',$,$,#90,$,(#95,#99),(#107,#111),$,$);
    

    Then moved the .ifc file to another folder, imported it in Blender and it worked.

  • Bug happened again and for some odd reason it works again when I move the IFC file and import it again.

  • IFC doesn't require all numbers to exist, if #74 is not referenced anywhere in the file then you shouldn't have to fill the gaps like this

    Coen
  • A bug report with your file shared would be really appreciated :) Yes indeed there should be no need to fill in gaps. You say the error happens upon import, but the screenshot (though some is cropped) suggests that the error happens during geometry updating, which is not when importing. So perhaps that error occured when exporting, and there is a different error during importing? In any case, we have yet to narrow down the root cause of the problem.

  • I will see if I'm able to recreate the bug, then I will post it here. It seems to be appear when using the Boolean modifier extensively.

  • edited November 2021

    Can't export now, I think I now what caused it.

    Here is the the IFC I imported:

    The roof beams are under quite complex miter joins. It worked when I used the Boolean modifier one by one for each beam. And exported it each time to be safe. Then I became lazy. And thought I would try a quicker method.

    In Blender I decided to do the following:

    • Join Beams
    • Boolean modifier
    • Seperate beams by loose parts
    • Unlink Object
    • Deleted the two outer beams
      This is the result

    Now when trying to assing an IFC class again I get the following output in the console

    location: <unknown location>:-1
    Error: Python: Traceback (most recent call last):
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\bim\module\root\operator.py", line 128, in execute
        return IfcStore.execute_ifc_operator(self, context)
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\bim\ifc.py", line 278, in execute_ifc_operator
        result = getattr(operator, "_execute")(context)
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\bim\module\root\operator.py", line 139, in _execute
        self.assign_class(context, obj)
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\bim\module\root\operator.py", line 161, in assign_class
        blenderbim.core.geometry.add_representation(
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\core\geometry.py", line 59, in add_representation
        ifc.run(
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\tool\ifc.py", line 28, in run
        return ifcopenshell.api.run(command, IfcStore.get_file(), **kwargs)
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\api\__init__.py", line 46, in run
        result = usecase_class(ifc_file, **settings).execute()
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\api\style\assign_representation_styles.py", line 23, in execute
        name = style.Name
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\entity_instance.py", line 67, in __getattr__
        raise AttributeError(
    AttributeError: entity instance of type 'IfcIndexedPolygonalFace' has no attribute 'Name'
    
    location: <unknown location>:-1
    


    As show in the image above it made the first beam an IfcBeam, despite the console error. So I tried exporting it to IFC and I get the following error.

    location: <unknown location>:-1
    Error: Python: Traceback (most recent call last):
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\bim\module\project\operator.py", line 754, in invoke
        return self.execute(context)
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\bim\module\project\operator.py", line 762, in execute
        return IfcStore.execute_ifc_operator(self, context)
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\bim\ifc.py", line 278, in execute_ifc_operator
        result = getattr(operator, "_execute")(context)
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\bim\module\project\operator.py", line 789, in _execute
        ifc_exporter.export()
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\bim\export_ifc.py", line 48, in export
        self.sync_all_objects()
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\bim\export_ifc.py", line 109, in sync_all_objects
        tool.Collector.sync(obj)
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\blenderbim\tool\collector.py", line 32, in sync
        if element.is_a("IfcProject") or element.is_a("IfcGridAxis"):
    AttributeError: 'NoneType' object has no attribute 'is_a'
    
    location: <unknown location>:-1
    

    I think I made too many changes in the .blend file before exporting it to IFC. What would be a good solution?

Sign In or Register to comment.