Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IFC does not open in BB. Might be related to #4124 #4255

Closed
theoryshaw opened this issue Jan 26, 2024 · 8 comments
Closed

IFC does not open in BB. Might be related to #4124 #4255

theoryshaw opened this issue Jan 26, 2024 · 8 comments

Comments

@theoryshaw
Copy link
Member

theoryshaw commented Jan 26, 2024

Similar to #4124 the following IFC does not open in BB. It might be related.

It 'acts' like it opens, but nothing is in the outliner.

file: https://www.dropbox.com/scl/fi/p4y4uu1qiiqgescpxglqv/Restaurant_Pewaukee.ifc?rlkey=yhktwk5urs70xu5zpcy7265sc&dl=1

@theoryshaw
Copy link
Member Author

theoryshaw commented Feb 2, 2024

Here's the console output, as well, if it will help.

Read prefs: "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\config\userpref.blend"
register_class(...):
Warning: 'bc.main_panel' does not contain '_PT_' with prefix and suffix
register_class(...):
Warning: 'bc.repair_panel' does not contain '_PT_' with prefix and suffix
register_class(...):
Warning: 'bc.limdiss_panel' does not contain '_PT_' with prefix and suffix
register_class(...):
Warning: 'bc.topology_panel' does not contain '_PT_' with prefix and suffix
register_class(...):
Warning: 'bc.normals_panel' does not contain '_PT_' with prefix and suffix
register_class(...):
Warning: 'bc.objectdata_panel' does not contain '_PT_' with prefix and suffix
Starting import process :: 0.00
Loading file :: 0.00
Calculate unit scale :: 0.00
Process context filter :: 0.00
Calculate model offset :: 0.02
Predict dense mesh :: 1.88
Set units :: 0.01
Create project :: 0.00
Process element filter :: 0.03
Create collections :: 0.00
Create materials :: 0.03
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
WARNING. Couldn't find texture by path C:\Users\Ryan Schultz\Desktop\OD_Textures\Closed (Encrypted)\menu.png, it will be skipped.
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'C:\Users\Ryan Schultz\Desktop\OD_Textures\Materials.blend'
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
Create styles :: 0.29
Traceback (most recent call last):
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\module\project\operator.py", line 734, in execute
    ifc_importer.execute()
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\import_ifc.py", line 247, in execute
    self.parse_native_elements()
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\import_ifc.py", line 457, in parse_native_elements
    if self.is_native(element):
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\import_ifc.py", line 490, in is_native
    rep_matrix = ifcopenshell.util.placement.get_mappeditem_transformation(rep.Items[0])
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\util\placement.py", line 166, in get_mappeditem_transformation
    m4 = get_axis2placement(item.MappingSource.MappingOrigin)
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\util\placement.py", line 63, in get_axis2placement
    o = placement.Location.Coordinates
AttributeError: 'NoneType' object has no attribute 'Coordinates'
Error: Python: Traceback (most recent call last):
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\module\project\operator.py", line 734, in execute
    ifc_importer.execute()
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\import_ifc.py", line 247, in execute
    self.parse_native_elements()
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\import_ifc.py", line 457, in parse_native_elements
    if self.is_native(element):
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\import_ifc.py", line 490, in is_native
    rep_matrix = ifcopenshell.util.placement.get_mappeditem_transformation(rep.Items[0])
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\util\placement.py", line 166,Traceback (most recent call last):
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\module\project\operator.py", line 630, in load_handler
    self.finish_loading_project(context)
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\module\project\operator.py", line 657, in finish_loading_project
    bpy.ops.bim.load_project_elements()
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\modules\bpy\ops.py", line 113, in __call__
    ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Error: Python: Traceback (most recent call last):
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\module\project\operator.py", line 734, in execute
    ifc_importer.execute()
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\import_ifc.py", line 247, in execute
    self.parse_native_elements()
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\import_ifc.py", line 457, in parse_native_elements
    if self.is_native(element):
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\import_ifc.py", line 490, in is_native
    rep_matrix = ifcopenshell.util.placement.get_mappeditem_transformation(rep.Items[0])
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\util\placement.py", line 166, in get_mappeditem_transformation
    m4 = get_axis2placement(item.MappingSource.MappingOrigin)
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\util\placement.py", line 63, in get_axis2placement
    o = placement.Location.Coordinates
AttributeError: 'NoneType' object has no attribute 'Coordinates'
Location: C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\modules\bpy\ops.py:113


@aothms
Copy link
Member

aothms commented Feb 5, 2024

o = placement.Location.Coordinates
AttributeError: 'NoneType' object has no attribute 'Coordinates'

This would potentially be rather easy to fix:

f = ifcopenshell.open(...)
for inst in f.by_type("IfcPlacement"):
  dim = int([c for c in inst.is_a() if c.isdigit()][0])
  if inst.Location is None:
    inst.Location = f.createIfcCartesianPoint([0.] * dim)
f.write(...)

@Andrej730
Copy link
Contributor

This would potentially be rather easy to fix:

In this case it's 1 IfcAxis2Placement3D element and dim = int([c for c in inst.is_a() if c.isdigit()][0]) will result in 2d point for it instead of 3d 🤔


@theoryshaw you can run snippet below from Blender scripting tab and it will manually fix the problem and file will load.

import ifcopenshell
filepath = r"C:\Restaurant_Pewaukee - Copy.ifc"
f = ifcopenshell.open(filepath)
for inst in f.by_type("IfcPlacement"):
  if inst.Location is None:
    inst.Location = f.createIfcCartesianPoint([0.] * 3)
f.write(filepath)

The problem was with just 1 placement element not having location (though it's not optional). This placement is part of Body/Tessellation representation of element
#2850821=IFCFURNITURETYPE('3ZuQlI_kTCWgpWkLFPrpam',#2848690,'Chair - Deja 1',$,$,(#2848692),(#2850761,#2850811,#2885073),'3606448',$,.NOTDEFINED.,.NOTDEFINED.);. Any ideas what could have caused this?

Affected placement line:
image

@theoryshaw
Copy link
Member Author

Thanks Guys, this script seems to work.

Any ideas what could have caused this?

Unfortunately nothing comes to mind. I'll keep my eyes open, if this happens again.

@theoryshaw
Copy link
Member Author

theoryshaw commented Feb 15, 2024

This happened again, unfort.

@Andrej730
How did you debug and troubleshoot to find the following problematic object?
#2850821=IFCFURNITURETYPE('3ZuQlI_kTCWgpWkLFPrpam',#2848690,'Chair - Deja 1',$,$,(#2848692),(#2850761,#2850811,#2885073),'3606448',$,.NOTDEFINED.,.NOTDEFINED.);

I use VScode, so I can try to do it on my side to figure out what object(s) it is, and it might jog my memory as what I might have 'did to it' to have it lose its coordinates.

@theoryshaw
Copy link
Member Author

Did you debug while running the script? or while opening the file?

@theoryshaw
Copy link
Member Author

I think i figured out a way...
put a breakpoint here...
image

and then just found the ID number of the inst, and then just searched that ID in the .ifc file.

@Andrej730
Copy link
Contributor

Andrej730 commented Feb 15, 2024

Prior to finding https://github.com/hextantstudios/hextant_python_debugger I usually would put a breakpoint() around the line that failed and debug it from system console. With the addon debugger it's now possible to add those checkpoints from VS Code.

Another note that typically many errors like this when something is missing some IFC attribute occur due invalid IFC file - it's possible to run the validation and search the either for missing attribute or for some entity name (e.g. "Placement") and find something related.

    o = placement.Location.Coordinates
AttributeError: 'NoneType' object has no attribute 'Coordinates'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants