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

Error on spreadsheet import #4495

Closed
theoryshaw opened this issue Apr 1, 2024 · 1 comment
Closed

Error on spreadsheet import #4495

theoryshaw opened this issue Apr 1, 2024 · 1 comment

Comments

@theoryshaw
Copy link
Member

theoryshaw commented Apr 1, 2024

Tried to import the following spreadsheet into the following files, got the following error

spreadsheet
ifc
blend

Open .blend file first and go to the 'Layout' tab.

Python: Traceback (most recent call last):
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\bim\module\csv\operator.py", line 275, in execute
    ifc_csv.Import(
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifccsv.py", line 392, in Import
    self.import_ods(ifc_file, table, attributes, null, empty, bool_true, bool_false)
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifccsv.py", line 426, in import_ods
    self.import_pd(ifc_file, df, attributes, null, empty, bool_true, bool_false)
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifccsv.py", line 437, in import_pd
    self.process_row(ifc_file, row.tolist(), headers, attributes, null, empty, bool_true, bool_false)
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifccsv.py", line 467, in process_row
    ifcopenshell.util.selector.set_element_value(ifc_file, element, key, value)
  File "C:\Users\Ryan Schultz\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\util\selector.py", line 464, in set_element_value
    cls.set_element_value(ifc_file, v, keys[i + 1 :], value)
NameError: name 'cls' is not defined

Andrej730 added a commit that referenced this issue May 17, 2024
Andrej730 added a commit that referenced this issue May 17, 2024
E.g. previously set_element_value with query "material.item.Material.Name" would fail with error "Material property is expecting an IFC entity and not a string".

But now it will detect that "Material" property is not a last key in the query and will pass `.Material` value forward and try to set it's `.Name` attribute with value.

The main goal is to make sure get_element_value and set_element_value would have a same result for same queries.
@Andrej730
Copy link
Contributor

Should be fixed now. Though there is a caveat - you'd need to change query to material.item.0.Material.Name from material.item.Material.Name.0 to ensure that it will work during csv import. I've created a separate issue about this #4687

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

2 participants