Code Monkey home page Code Monkey logo

freecad-nativeifc's People

Contributors

berndhahnebach avatar carlopav avatar chennes avatar luzpaz avatar moult avatar syres916 avatar yorikvanhavre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

freecad-nativeifc's Issues

colors are lost on restore

When opening a FCStd file containing IFC objects with children, colors are lost.
Color dict should be rebuilt from children each time the shape changes...

Error Message on opening an IFC Native

I updated the Addon to 23.10.27

A test import gives this errors:

(I think I had the same Error also with the old version)

 flag
 flag2
 No stream support: No module named 'lark'
 Vorheriger Cache-Prozess wurde unterbrochen, wird neu gestartet...
 Git ist deaktiviert, Git-Makros werden übersprungen
 Fehler beim Verbinden mit dem Wiki, FreeCAD kann die Wiki-Makroliste zu diesem Zeitpunkt nicht abrufen
 Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_import.py", line 47, in open
insert(filename, doc.Name)
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_import.py", line 74, in insert
prj_obj = ifc_tools.create_document_object(
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 101, in create_document_object
create_children(obj, ifcfile, recursive=True, assemblies=False)
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 311, in create_children
result.extend(create_child(obj, child))
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 289, in create_child
subresult.extend(create_child(child, building))
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 301, in create_child
create_children(
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 311, in create_children
result.extend(create_child(obj, child))
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 301, in create_child
create_children(
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 311, in create_children
result.extend(create_child(obj, child))
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 279, in create_child
child = create_object(element, doc, ifcfile, mode)
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 253, in create_object
ifc_layers.add_layers(obj, ifcentity, ifcfile)
File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_layers.py", line 98, in add_layers
<class 'AttributeError'>: 'NoneType' object has no attribute 'Group'
OS: Windows 11 build 22621
Word size of FreeCAD: 64-bit
Version: 0.21.1.33668 +26 (Git)
Build type: Release
Branch: (HEAD detached at 0.21.1)
Hash: f6708547a9bb3f71a4aaade12109f511a72c207c
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: German/Switzerland (de_CH)
Installed mods:
* Assembly3 0.12.0
* BIM 2021.12.0
* dodo 1.0.0
* FreeCAD-NativeIFC 2023.10.27
* sheetmetal 0.3.1

Add a way to obtain an IFC diff

Add a way to obtain an IFC diff from the current state (compared to the saved version), so one can make sure everything went as planned. In a first moment text-only, but later then maybe graphically...

Import error: from ifcopenshell import api

Hello.

from ifcopenshell import api
<class 'ImportError'>: cannot import name 'api' from 'ifcopenshell' (G:\freecad\git\build\bin\lib\site-packages\ifcopenshell\__init__.py)
OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.0.32165 (Git)
Build type: Release
Branch: master
Hash: 0da14beb27357cc61584335bacbf47f3ef0cc66b
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * beso
  * BIM_Workbench 2021.12.0
  * civilTools
  * dodo 1.0.0
  * etabs_api
  * FreeCAD-Help
  * FreeCAD-NativeIFC 2022.10.20
  * git.7z
  * momen
  * OSAFE 2022.5.29

thanks

get properties, materials and other "expandable" structures

This is basically a stub to discuss implementaiton (and for @Moult to explain his visions ;) )

We now have a basic decomposition in the FreeCAD document: Project, site, building, storey, and their direct children. However, there is a lot more to fetch on demand from the IFC file. For ex:

  • Properties
  • Materials
  • Type
  • Geometry construction (extrusions, etc...)

In BlenderBIm you basically press some "Edit" buttons to reveal these things in the UI.

I'm not sure how to proceed here. Clearly, materials are FreeCAD objects (stored in a special group), Types too (should be stored in a special group too), geometry constructions should also become FreeCAD objects, and properties and property sets should become object properties (tied to style properties if applicable).

Error when right click on object and selecting "Expand property set"

After importing the IFC Schependomlaan.ifc file and selecting "Expand property set" with a right click at an object (i.e. dakpan (vlak)005) I see this error:

09:15:10  Traceback (most recent call last):
09:15:10    File "C:\Users\balrobs\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_viewproviders.py", line 209, in showProps
09:15:10      ifc_tools.show_psets(self.Object)
09:15:10    File "C:\Users\balrobs\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 1212, in show_psets
09:15:10      obj.addProperty("App::PropertyString", pname, gname)
09:15:10  NameError: {'sclassname': 'class Base::NameError', 'sErrMsg': "Invalid property name 'Home Story'", 'sfile': 'D:\\bld\\freecad_1684045270349\\work\\src\\App\\DynamicProperty.cpp', 'iline': 176, 'sfunction': 'class App::Property *__cdecl App::DynamicProperty::addDynamicProperty(class App::PropertyContainer &,const char *,const char *,const char *,const char *,short,bool,bool)', 'swhat': "Invalid property name 'Home Story'", 'btranslatable': False, 'breported': False}

screenshot

[Issue] Sync object visibility between tree-view and 3d-view

Steps to reproduce:

  1. Import MyHouse.ifc (created with Blenderbim)
  2. Select Slab001 in the tree view and press space bar to hide the slab
  3. Notice that Slab001 is hidden in the 3d view and is greyed out in the tree view. So far so good!
  4. The storey object EG is marked for a recompute (???) Do a recompute.
  5. Now select Slab001 in the tree view and press space bar to show the slab
  6. The slab turns visible in the 3d view but stays greyed out in the tree view. No recompute visible (???)

MyHouse.ifc.txt

import breaks on a IFC which has missing entrys

On a huge ifc from a architect I got problems. I have been used this ifc on various viewers including Solibrie, BIMCollabZoom, BIMVision and FreeCAD and BlenderBIM, as well as CAD Allplan. Noone returned big problems and all parts seams correct, BUT

dozens of objects missing the ObjectPlacement. Somehow all the programme did not have a problem with it. As an example some code attached ...

Python 3.10.9 | packaged by conda-forge | (main, Feb  2 2023, 20:14:58) [MSC v.1929 64 bit (AMD64)] on win32
Type 'help', 'copyright', 'credits' or 'license' for more information.
>>> 
>>> ### Begin command Std_Open
>>> import importIFCparse
>>> importIFCparse.open(u"C:/Users/BHA/Desktop/fehlerhaftes_ifc_laed_nicht_nativ_ifc/4130_ARC_ROHM01_20230203.ifc")
>>> import ifcopenshell
>>> ifcfile = ifc = ifcopenshell.open("C:/Users/BHA/Desktop/fehlerhaftes_ifc_laed_nicht_nativ_ifc/4130_ARC_ROHM01_20230203.ifc")
>>> print(ifc.by_type("IfcProject")[0])
>>> ### End command Std_Open
>>> 
>>> ifcfile[409407]
#409407=IfcSlab('1GQsvNK6n9e9nfjgTH$n8Z',#11,'Beton','Dach, 22 cm Stärke
22 Beton','Dach 22cm',#395870,#409405,$,.ROOF.)
>>> 
>>> ifcfile[409407].ObjectPlacement
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\0_BHA_privat\progr\FreeCAD\FreeCAD_0.21.xxxxx\bin\lib\site-packages\ifcopenshell\entity_instance.py", line 136, in __getattr__
    self.wrapped_data.get_argument(idx), self.wrapped_data.file
  File "C:\0_BHA_privat\progr\FreeCAD\FreeCAD_0.21.xxxxx\bin\lib\site-packages\ifcopenshell\ifcopenshell_wrapper.py", line 4833, in get_argument
    return _ifcopenshell_wrapper.entity_instance_get_argument(self, *args)
RuntimeError: Instance #395870 not found
>>> 
>>> ifcfile[395870]
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\0_BHA_privat\progr\FreeCAD\FreeCAD_0.21.xxxxx\bin\lib\site-packages\ifcopenshell\file.py", line 313, in __getitem__
    return entity_instance(self.wrapped_data.by_id(key), self)
  File "C:\0_BHA_privat\progr\FreeCAD\FreeCAD_0.21.xxxxx\bin\lib\site-packages\ifcopenshell\ifcopenshell_wrapper.py", line 4515, in by_id
    return _ifcopenshell_wrapper.file_by_id(self, id)
RuntimeError: Instance #395870 not found
>>>

the native IFC importer has problems with this or at least he is the only one who reports back the big problems ... But the representation of thes objects seams shown in 3Dview. IMHO we should inform the user but catch such problem.

Top level FC object

Another question:
Is top level object always an IfcProject?
Does it always have a Type attribute? and if so, its Type attribute is always "IfcProject"?

- IfcDocument
    - IfcProject
        - IfcSite
            - IfcBuilding

or:

- IfcProject
    - IfcSite
       - IfcBuilding

Current implementation looks more like the second one:
immagine

<class 'ValueError'>: too many values to unpack (expected 2)

OS: Windows 11 build 22621
Word size of FreeCAD: 64-bit
Version: 0.21.1.33694 (Git)
Build type: Release
Branch: (HEAD detached at 0.21.1)
Hash: f6708547a9bb3f71a4aaade12109f511a72c207c
Python 3.10.12, Qt 5.15.8, Coin 4.0.0, Vtk 9.2.5, OCC 7.6.3
Locale: German/Switzerland (de_CH)
Installed mods: 
  * FreeCAD-NativeIFC 2023.10.27

I uninstalled FreeCAD with User settings, an this FreeCAD runs a portable version in Windows
Is a different IFC file than the last times I wrote Issues.

10:31:43  DirectWrite: CreateFontFaceFromHDC() failed (Gibt einen Fehler in einer Eingabedatei an, zum Beispiel eine Schriftartdatei.) for QFontDef(Family="8514oem", pointsize=10, pixelsize=20, styleHint=5, weight=50, stretch=100, hintingPreference=0) LOGFONT("8514oem", lfWidth=0, lfHeight=-20) dpi=192
10:32:13  DirectWrite: CreateFontFaceFromHDC() failed (Gibt einen Fehler in einer Eingabedatei an, zum Beispiel eine Schriftartdatei.) for QFontDef(Family="8514oem", pointsize=10, pixelsize=20, styleHint=5, weight=75, stretch=100, hintingPreference=0) LOGFONT("8514oem", lfWidth=0, lfHeight=-20) dpi=192
10:33:27  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_import.py", line 48, in open
    insert(filename, doc.Name)
  File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_import.py", line 86, in insert
    ifc_psets.load_psets(prj_obj)
  File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_psets.py", line 232, in load_psets
    load_psets(child)
  File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_psets.py", line 232, in load_psets
    load_psets(child)
  File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_psets.py", line 232, in load_psets
    load_psets(child)
  [Previous line repeated 1 more time]
  File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_psets.py", line 226, in load_psets
    show_psets(obj)
  File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_psets.py", line 94, in show_psets
    ptype, value = pvalue.split("(", -1)
<class 'ValueError'>: too many values to unpack (expected 2)

follow Error flooded the log window

10:34:11  Traceback (most recent call last):
  File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_objects.py", line 129, in execute
    ifc_generator.generate_geometry(obj, cached=cached)
  File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_generator.py", line 65, in generate_geometry
    elements = get_decomposition(obj)
  File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_generator.py", line 316, in get_decomposition
    elements = get_decomposed_elements(element, obj)
  File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_generator.py", line 347, in get_decomposed_elements
    for child in ifcopenshell.util.element.get_decomposition(
<class 'TypeError'>: get_decomposition() got an unexpected keyword argument 'is_recursive'
10:35:09  Recompute failed!

geom iterator is not valid but ifcopenshell is able to return valid brep geometry

On several models from Architects I do have problem to import a geometry into FreeCAD native IFC. They work flawless with FreeCAD standard importer and with BlenderBIM. Attached a very simple file which shows the problem. Open the file with standard FreeCAD importer looks great. Open the file with native importer. The geometry is missing. After import in native importer run the following code. It returns False, thus no geometry ...

import ifcopenshell
import ifc_tools
from ifcopenshell import geom
settings = ifc_tools.get_settings(ifcfile)
iterator = ifcopenshell.geom.iterator(settings, ifcfile, 1, include=[ifcfile[83]])
iterator.initialize()

problem_nativeIFC.ifc.txt

I have not yet posted this on IfcOpenShell ... Just waiting for your opinion Yorik.

Import mod "shapemode" without any representation at all

How about another "shapemode" ... no geometry at all. Means the ifc will be parsed only and objects will be created in the regard of strategy pref. This is helpful for very large files if one only needs the ifcopenshell file object or some attributes but no geometry. Or geometry of a certyain element or spatial structure. Thus only the needed geometry could be loaded after import by right click load in tree view.

FreeCAD freeze when moving IFC object

Hi Yorik!
I found another strange behaviour:

  1. Import this IFC-file IFC_Test1.ifc.txt exportet from RFEM with this options:
    importOptions
  2. Import seems ok.
  3. When I select object "Member 1" and launch the transform-command I would expect to see the transform gizmo near "Member 1" and not at the 0,0,0 position.
  4. Now I can move the "Member 1", but when I press OK to exit the task FreeCAD freezes.

PS: BlenderBim handles the file without problems

Fails to open IfcOpenHouse

OS: macOS 10.16
Word size of FreeCAD: 64-bit
Version: 0.20.2.29603 (Git)
Build type: Release
Branch: (HEAD detached at 0.20.2)
Hash: 930dd9a76203a3260b1e6256c70c1c3cad8c5cb8
Python 3.10.8, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: C/Default (C)
Installed mods: 
  * FreeCAD-NativeIFC 2022.10.20

image

Handle spaces

IfcSpaces work at the same time as an own feature to represent a space, but also as an aggregator for some other objects. Currently they are discarded by the importer.

Get the structure!

This is basically for discussion.

Up to now, this happens:

  • Click menu File -> Open, select an IFC file, then select the bb_import importer
  • The file imports
  • One single object is created, which represents one IFC file + project. The shape of the object is calculated from its children

image

This is pretty fast, a medium file like schependomlaan (47Mb) imports in 23 seconds on a ryzen9. Further optimizations are possible, like caching, or even using only mesh representation

What should happen next:

  • One should be able to right-click the object, and select an Expand option
  • Upon expanding, the inner site should appear under the project
  • The shape of the project becomes instead a compound of its children
  • The site can be expanded again, and so on

Other ideas:

  • shapes should be cached on initial import, so expand operations just need to make a compound
  • alternative import modes so an initial expansion can be done

error while adding new object

Hi Yorik,
I am getting error while adding new object created in freecad to ifc. the error is same while trying to add from the UI and also through python console

06:22:44 Traceback (most recent call last): File "/home/arun/.local/share/FreeCAD/Mod/FreeCAD-NativeIFC/./ifc_viewproviders.py", line 246, in dropObject ifc_tools.aggregate(incoming_object, parent) File "/home/arun/.local/share/FreeCAD/Mod/FreeCAD-NativeIFC/./ifc_tools.py", line 921, in aggregate product = create_product(obj, parent, ifcfile) File "/home/arun/.local/share/FreeCAD/Mod/FreeCAD-NativeIFC/./ifc_tools.py", line 988, in create_product representation, placement, shapetype = exportIFC.getRepresentation( File "/tmp/.mount_FreeCAmo37dh/usr/Mod/Arch/exportIFC.py", line 2067, in getRepresentation profile = getProfile(ifcfile,pi) File "/tmp/.mount_FreeCAmo37dh/usr/Mod/Arch/exportIFC.py", line 1906, in getProfile pxvc = ifcbin.createIfcDirection(tuple(d)[:2]) <class 'NameError'>: name 'ifcbin' is not defined

split ifc_tools in pure ifc tools and tools including FreeCAD objects or methods

Would you support this?

I would like to move all methods which would run on pure IfcOpenShell without FreeCAD obj or FreeCAD methods (except such methods from importIFChelper which also would run on pure IfcOpenShell) in a separate module. These ones could be used outside of FreeCAD without importing FreeCAD. This would make it much easier to reuse thesm in other tools and programme because one does not need to create a FreeCAD document or a FreeCAD object to use them.

"ifc_tools" would be split in "ifc_tools_ifc" and "ifc_tools_fc" or if you prefere other names they does not really matter for me.

[Issue] Document containing an IfcProject and FreeCAD objects

Steps to reproduce:

  1. Start FreeCAD
  2. File->Open IfcProject_01.ifc.txt (with Native (ifc_import))
  3. Select BIM workbench
  4. Notice Lock-Status is ON
  5. Save file as IfcProject_01.FCStd
  6. Notice Lock-Status is OFF
  7. Draw line with line command
  8. When I click for the line end point I see this in the Report view
    pic_01
  9. And when I click on the Close-Button to terminate the line command I see this in the Report View
    pic_02
  10. Then FreeCAD crashes

Add a Part or PartDesign object to a IFC

I'm trying to add a Part or PartDesign object to a IFC.

The following code adds a wall to my project:

wall = Arch.makeWall(None,220,400,20)
ifc_tools.aggregate(wall, project)

However, when i run ifc_tools.aggregate(obj, project), where obj is a PartDesign object, i get the following error:

>>> ifc_tools.aggregate(obj, project)
Exception ignored in: <function entity_instance.__del__ at 0x7fd06c18bac0>
Traceback (most recent call last):
  File "/tmp/.mount_FreeCAUhQwpr/usr/lib/python3.10/site-packages/ifcopenshell/entity_instance.py", line 132, in __del__
    self.wrapped_data.file = None
  File "/tmp/.mount_FreeCAUhQwpr/usr/lib/python3.10/site-packages/ifcopenshell/entity_instance.py", line 143, in __getattr__
    attr_cat = self.wrapped_data.get_attribute_category(name)
  File "/tmp/.mount_FreeCAUhQwpr/usr/lib/python3.10/site-packages/ifcopenshell/entity_instance.py", line 143, in __getattr__
    attr_cat = self.wrapped_data.get_attribute_category(name)
  File "/tmp/.mount_FreeCAUhQwpr/usr/lib/python3.10/site-packages/ifcopenshell/entity_instance.py", line 143, in __getattr__
    attr_cat = self.wrapped_data.get_attribute_category(name)
  [Previous line repeated 995 more times]
  File "/tmp/.mount_FreeCAUhQwpr/usr/lib/python3.10/site-packages/ifcopenshell/entity_instance.py", line 142, in __getattr__
    INVALID, FORWARD, INVERSE = range(3)
RecursionError: maximum recursion depth exceeded in comparison
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/smr/.local/share/FreeCAD/Mod/FreeCAD-NativeIFC/./ifc_tools.py", line 893, in aggregate
    product = create_product(obj, parent, ifcfile)
  File "/home/smr/.local/share/FreeCAD/Mod/FreeCAD-NativeIFC/./ifc_tools.py", line 944, in create_product
    product = api_run("root.create_entity", ifcfile, ifc_class=ifcclass, name=name)
  File "/home/smr/.local/share/FreeCAD/Mod/FreeCAD-NativeIFC/./ifc_tools.py", line 229, in api_run
    result = ifcopenshell.api.run(*args, **kwargs)
  File "/tmp/.mount_FreeCAUhQwpr/usr/lib/python3.10/site-packages/ifcopenshell/api/__init__.py", line 66, in run
    result = usecase_class(ifc_file, **settings).execute()
  File "/tmp/.mount_FreeCAUhQwpr/usr/lib/python3.10/site-packages/ifcopenshell/api/root/create_entity.py", line 74, in execute
    element = self.file.create_entity(
  File "/tmp/.mount_FreeCAUhQwpr/usr/lib/python3.10/site-packages/ifcopenshell/file.py", line 318, in create_entity
    e = entity_instance((self.schema_identifier, type), self)
  File "/tmp/.mount_FreeCAUhQwpr/usr/lib/python3.10/site-packages/ifcopenshell/entity_instance.py", line 119, in __init__
    e = ifcopenshell_wrapper.new_IfcBaseClass(*e)
  File "/tmp/.mount_FreeCAUhQwpr/usr/lib/python3.10/site-packages/ifcopenshell/ifcopenshell_wrapper.py", line 4374, in new_IfcBaseClass
    return _ifcopenshell_wrapper.new_IfcBaseClass(schema_identifier, name)
ValueError: invalid null reference in method 'new_IfcBaseClass', argument 2 of type 'std::string const &'

Version

OS: Ubuntu 23.10 (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.35803 (Git) AppImage
Build type: Release
Branch: main
Hash: 90c90f705bec20faf4b8bb419574134c33c7d4b5
Python 3.10.13, Qt 5.15.8, Coin 4.0.2, Vtk 9.2.6, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * DynamicData 2.60.0
  * FreeCAD-NativeIFC 2023.10.27
  * BIM 2021.12.0

Error when creating a default project structure

Don't know if it's me missing the right workflow or if it's a bug:

  1. with latest BIM-addon and NativeIFC-addon create a new empty project
  2. activate BIM-addon
  3. from the menu select 3D/BIM->Project
  4. close dialog with Yes (should create a default structure: IfcProject->IfcSite->IfcBuilding->IfcBuildingStorey)
  5. this is what I see in the tree view:
    screenshot
  6. and these are the errors in the report view:
Traceback (most recent call last):
  File "C:\Users\balrobs\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_viewproviders.py", line 72, in claimChildren
    return self.Object.Group
<class 'AttributeError'>: 'FeaturePython' object has no attribute 'Group'
13:24:35  Running the Python command 'BIM_Project' failed:
Traceback (most recent call last):
  File "C:\Users\balrobs\AppData\Roaming\FreeCAD\Mod\BIM\.\BimWrappedTools.py", line 64, in Activated
    project = ifc_tools.create_document(FreeCAD.ActiveDocument)
  File "C:\Users\balrobs\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 90, in create_document
    site = aggregate(Arch.makeSite(), obj)
  File "C:\Users\balrobs\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 918, in aggregate
    product = create_product(obj, parent, ifcfile)
  File "C:\Users\balrobs\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 974, in create_product
    exportIFC.ifcbin = exportIFCHelper.recycler(ifcfile, template=False)

recycler.__init__() got an unexpected keyword argument 'template'

Iterator and geometry errors

when i import the IFC Schependomlaan.ifc file I see lots of errors I don't understand:

09:06:51  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject2216: Bnd_Box is void
09:06:56  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject2309: Bnd_Box is void
09:07:05  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject2466: Bnd_Box is void
09:07:07  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject2490: Bnd_Box is void
09:07:20  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject2653: Bnd_Box is void
09:07:28    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:28    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:28    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:28    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:31    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:31    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:35    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:35    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:35    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:35    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:35    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:35    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:35    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:35    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:35    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:38    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:38    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:53    DEBUG: ifc_tools.get_geom_iterator: Invalid iterator
09:07:53  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject2759: Bnd_Box is void
09:07:53  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject2862: Bnd_Box is void
09:07:53  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject2865: Bnd_Box is void
09:07:53  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject2879: Bnd_Box is void
09:07:53  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject2887: Bnd_Box is void
09:08:01  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject3105: Bnd_Box is void
09:08:01  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject3107: Bnd_Box is void
09:08:01  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject3109: Bnd_Box is void
09:08:01  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject3111: Bnd_Box is void
09:08:09  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject3187: Bnd_Box is void
09:08:09  <Part> ViewProviderExt.cpp(1267): Cannot compute Inventor representation for the shape of Unnamed#IfcObject3189: Bnd_Box is void
09:08:26  Debug: No Shape returned for object 1034437, IfcVirtualElement, IfcVirtualElement
09:08:26  Debug: No Shape returned for object 1040670, IfcVirtualElement, IfcVirtualElement001
09:08:26  Debug: No Shape returned for object 1047667, IfcVirtualElement, IfcVirtualElement002
09:08:26  Debug: No Shape returned for object 1047706, IfcVirtualElement, IfcVirtualElement003
09:08:26  Debug: No Shape returned for object 1052304, IfcVirtualElement, IfcVirtualElement004
09:08:26  Debug: No Shape returned for object 1056520, IfcVirtualElement, IfcVirtualElement005
09:08:26  Debug: No Shape returned for object 1059552, IfcVirtualElement, IfcVirtualElement006
09:08:26  Debug: No Shape returned for object 1059592, IfcVirtualElement, IfcVirtualElement007
09:08:26  Debug: No Shape returned for object 1063273, IfcVirtualElement, IfcVirtualElement008
09:08:26  Debug: No Shape returned for object 1066491, IfcVirtualElement, IfcVirtualElement009
09:08:26  Debug: No Shape returned for object 1066531, IfcVirtualElement, IfcVirtualElement010
09:08:26  Debug: No Shape returned for object 1073211, IfcVirtualElement, IfcVirtualElement011
09:08:26  Debug: No Shape returned for object 1078243, IfcVirtualElement, IfcVirtualElement012
09:08:26  Debug: No Shape returned for object 1078283, IfcVirtualElement, IfcVirtualElement013
09:08:26  Imported IFC Schependomlaan.ifc ( 47.0 Mb ) in 04:17

Make boolean objects editable

I've created a beam from the BlenderBIM demo project with a void and imported it to FreeCAD.

In the screenshot you can see how the Void/opening shows as a very small cube in FreeCAD.
Attached the IFC file.

Screenshot from 2023-08-10 11-41-01
Screenshot from 2023-08-10 11-41-17

test_demo.ifc.txt

Link placements

Link FreeCAD placements to underlying IFC placements.
We need the following functionality:

  • When the placement of a FreeCAD object changes, change the underlying IFC placement
  • IFC supports local placements. A local placement is a placement that refers to another placement as its "father". There is a decision to be taken here, how do we reflect this in FreeCAD
  • A change to any placement in the IFC file that affects a local placement should be reflected in the FreeCAD objects as well. Need to investigate if, for ex, a storey being moved 2 meters up affects the objects inside as well

IfcOpenShell related structures:
https://blenderbim.org/docs-python/autoapi/ifcopenshell/util/placement/index.html
https://blenderbim.org/docs-python/autoapi/ifcopenshell/api/geometry/edit_object_placement/index.html

IfcLocalPlacement

This is another point i'd like to understand: @Moult how much is local placement used generally in Ifcs out there?

reading from Geometry use definitions, ref. https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcgeometricconstraintresource/lexical/ifclocalplacement.htm there are conventions like:

  • IfcSite shall be placed absolutely within the world coordinate system established by the geometric representation context of the IfcProject
  • IfcBuilding shall be placed relative to the local placement of IfcSite
  • IfcBuildingStorey shall be placed relative to the local placement of IfcBuilding

In FreeCAD we have objects that can perfectly represent this @yorikvanhavre . I know we already discussed that in the past and we had different positions, should we adopt GeoFeatureGroups (Building, storey) or ShapeGroups (site) when IfcLocalPlacement is used? I think so, but what do you think?

new name?

"BlenderBIM workbench" is not a very good name. What about "IFC workbench" or "nativeIFC"?

Not sure it will have a workbench, though. I think we could simply seamlessly integrate it to the BIM workbench, so BIM tools become nativeIFC-aware...

Installed Addon not working on windows and Linux

I found this and tried using https://github.com/yorikvanhavre/FreeCAD-NativeIFC/blob/main/doc/installation.md

  1. uninstalled already installed FreeCAD
  2. Installed FreeCAD
    • Windows: winget install FreeCAD.FreeCAD (without root)
      No request for installing IfcOpenShell
    • Linux flatpack install org.freecadweb.FreeCAD
      Followed by a request to install IfcOpenShell - said YES
  3. followed instructions https://github.com/yorikvanhavre/FreeCAD-NativeIFC/blob/main/doc/installation.md
  4. Open an IFC Native
  5. Error appear:
    • Windows: class 'ImportError'>: cannot import name 'api' from 'ifcopenshell' (C:\Users\%username%\AppData\Local\Programs\FreeCAD 0.21\bin\lib\site-packages\ifcopenshell\__init__.py)
    • Linux: <class 'ImportError'>: IfcOpenShell not built for 'linux/64bit/python3.10'

[Issue] Wrong result when changing object placement

Steps to reproduce:

  1. Import MyHouse.ifc (created with Blenderbim) - see issue #41
  2. Select Wall001 and translate it along the x axis by changing its position from x/y/z=600cm/0cm/0cm to x/y/z=800cm/0cm/0cm
  3. This is the wrong result:
    screenshot
  4. Note that pressing undo gives then the expected result.
    screenshot01

Handle unreferenced objects

ATM a unreferenced objects does not get a IfcObject in FreeCAD after import. Best would be if they get a own group right under the IfcProject object. Expand child does not work at all because there is no structure in the file.

unreferenced_box.ifc.txt

roadmap

I was hanging around the code this morning and studying a bit BB ifc.py and import_ifc.py.

Shouldn't it be a matter of setting up an IfcStore and substituting Blender objects with FC objects? That is of course an enormous task, but I need to get the general idea of what we are up to :)

Enhancement Request - move Dialog in Task Area, add Stats window and create a Native IFC feature

In my opinion the Popup Dialog that appear if you open the IFC should be inside the Task Area.
At the End of the Importing I would Like to see a little statistic about containing data.

I propose to add a Feature to the "Tree View" that represent the original IFC-Filename.
Please add this feature into the context menu:

  • Show Stats and Properties
    Count of Mesh bodies:
    Count of geometric Bodies:
    Some Properties like GPS-Coordinates
    Name of Project
  • Hide/show mesh bodies
  • Hide/Show geometric Bodies
  • Update IFC data from linked file
  • Change Linked file path

Example:
01
02

Support IFC4.3.2 for infrastructure?

Any plans to support IFC4.3.2 for infrastructure? The reason I ask is that I've been adding geometry mapping to IfcOpenShell on the v0.8.0 branch, c++ code, for alignment and linear referencing.

Ultimately I want to make BlenderBIM or FreeCAD support infrastructure, bridges in particular. I'm thinking something along the lines of road, bridge, and rail workbenches supporting native IFC.

import ifcopenshell failed with error "signed with custom identity or adhoc?" on the macOS M1

Hello, team.

Does anyone know how to fix the error "signed with custom identity or ad-hoc?"
When I execute import ifcopenshell in the FreeCAD App, I got the following errors.

Best regards.

>>> import ifcopenshell
Traceback (most recent call last):
  File "/Users/user/Library/Application Support/FreeCAD/AdditionalPythonPackages/py310/ifcopenshell/__init__.py", line 61, in <module>
    from . import ifcopenshell_wrapper
  File "/Applications/FreeCAD.app/Contents/Resources/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
    return original_import(name, *args, **kwargs)
  File "/Users/user/Library/Application Support/FreeCAD/AdditionalPythonPackages/py310/ifcopenshell/ifcopenshell_wrapper.py", line 13, in <module>
    from . import _ifcopenshell_wrapper
  File "/Applications/FreeCAD.app/Contents/Resources/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
    return original_import(name, *args, **kwargs)
ImportError: dlopen(/Users/user/Library/Application Support/FreeCAD/AdditionalPythonPackages/py310/ifcopenshell/_ifcopenshell_wrapper.so, 0x0002): tried: '/Users/user/Library/Application Support/FreeCAD/AdditionalPythonPackages/py310/ifcopenshell/_ifcopenshell_wrapper.so' (code signature in <82625F66-0FB6-3B7B-9D0D-5D0C432ABD9D> '/Users/user/Library/Application Support/FreeCAD/AdditionalPythonPackages/py310/ifcopenshell/_ifcopenshell_wrapper.so' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/System/Volumes/Preboot/Cryptexes/OS/Users/user/Library/Application Support/FreeCAD/AdditionalPythonPackages/py310/ifcopenshell/_ifcopenshell_wrapper.so' (no such file), '/Users/user/Library/Application Support/FreeCAD/AdditionalPythonPackages/py310/ifcopenshell/_ifcopenshell_wrapper.so' (code signature in <82625F66-0FB6-3B7B-9D0D-5D0C432ABD9D> '/Users/user/Library/Application Support/FreeCAD/AdditionalPythonPackages/py310/ifcopenshell/_ifcopenshell_wrapper.so' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Applications/FreeCAD.app/Contents/Resources/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
    return original_import(name, *args, **kwargs)
  File "/Users/user/Library/Application Support/FreeCAD/AdditionalPythonPackages/py310/ifcopenshell/__init__.py", line 69, in <module>
    raise ImportError("IfcOpenShell not built for '%s'" % python_distribution)
ImportError: IfcOpenShell not built for 'darwin/64bit/python3.10'

In ipython

I succeed in loading iopenshell in the python 3.10.

ipython
Python 3.10.11 (main, May 17 2023, 13:56:28) [Clang 14.0.3 (clang-1403.0.22.14.1)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.15.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import sys

In [2]: sys.path.append("/Users/user/Library/Application Support/FreeCAD/Additi
   ...: onalPythonPackages/py310/")

In [3]: import ifcopenshell
No stream support: No module named 'lark'

In [4]: ifcopenshell.version
Out[4]: 'v0.7.0-6c9e130ca'

Environment

  • macOS: 13.6.1 (M1 mac)
  • FreeCAD: 0.21.1 33694
  • ifcopehshell: v0.7.0-6c9e130ca
  • NativeIFC: Fllow this instruction

AttributeError: 'NoneType' object has no attribute 'addObject'

I'm playing around with the sample-test files from buildingSMART.

the Clinic_Plumbing.ifc had this import error:

16:18:48  Traceback (most recent call last):
16:18:48    File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_viewproviders.py", line 158, in expandChildren
16:18:48      ifc_tools.create_children(
16:18:48    File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 320, in create_children
16:18:48      result.extend(create_child(obj, child))
16:18:48    File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 288, in create_child
16:18:48      child = create_object(element, doc, ifcfile, mode)
16:18:48    File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 262, in create_object
16:18:48      ifc_layers.add_layers(obj, ifcentity, ifcfile)
16:18:48    File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_layers.py", line 95, in add_layers
16:18:48      lay = get_layer(layer, proj)
16:18:48    File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_layers.py", line 55, in get_layer
16:18:48      group = ifc_tools.get_group(project, "IfcLayersGroup")
16:18:48    File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 1189, in get_group
16:18:48      group = add_object(doc, otype="group", oname=name)
16:18:48    File "C:\Users\%USERNAME%\AppData\Roaming\FreeCAD\Mod\FreeCAD-NativeIFC\.\ifc_tools.py", line 448, in add_object
16:18:48      obj = document.addObject(ftype, oname, proxy, vp, False)
16:18:48  AttributeError: 'NoneType' object has no attribute 'addObject'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.