yorikvanhavre / FreeCAD-NativeIFC

A FreeCAD module to work with IFC files natively
GNU General Public License v3.0
66 stars 12 forks source link

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

Closed berndhahnebach closed 6 months ago

berndhahnebach commented 1 year ago

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.

yorikvanhavre commented 1 year ago

yes, in any case, sooner or later that module would need to be split. we can also make an ifc_tools folder module and inside, different submodules..

Moult commented 1 year ago

I think it is also worthwhile considering what can be upstreamed to ifcopenshell.util.

yorikvanhavre commented 1 year ago

excellent idea. We should have a look and upstream everything we can!

yorikvanhavre commented 1 year ago

I'm looking at this again, and actually almost all of our functions deal with FreeCAD :sweat_smile: There are a couple that can be isolated, though. I think it's best to first separate then into a separate file, then see from there what should go upstream...

berndhahnebach commented 1 year ago

I will go for it once I get back to native IFC.

BTW: How about a ArchIFCTools.py file in FreeCAD Arch. All pure ifc code will be in there. It will work like a gate between FreeCAD IFC code and IfcOpenShell. Much simpler from one module to move upstream to IfcOpneShell than from multiple modules. ATM we have at least 3 or more modules with IFC code and I have own one as well.

yorikvanhavre commented 1 year ago

Great! I began already by indicating a note in each ifc_tools.py function that is pure IFC so they could be moved away. But there are very few, and mostly not very useful outside this NativeIFC environment, so I'm not sure how useful it would be to do something about it. Nevertheless, ifc_tools is becoming big so it might make sense to separate.

Of course we have way too many IFC/ifcopenshell modules in FreeCAD :) Ideally I would like to unify everything. The way I see it:

Also that would make the "default" FreeCAD much more dependent on ifcopenshell, so we'd need proper handling of that.

Also, @Moult showed me this: https://blenderbim.org/docs-python/autoapi/ifcopenshell/api/geometry/index.html basically there is already one module that converts blender geometry to IFC, and another that does the same with sverchok geometry. We would ultimately need a third for FreeCAD :)

yorikvanhavre commented 6 months ago

I will close this one because the code is getting very consolidated and well split now and there is not much point in splitting any further...