Skip to content
New issue

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

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

Already on GitHub? # to your account

Sharing ItemShapeDataOCC thoughout different ProductShapeDataOCC #194

Open
JeanbaptisteVincent opened this issue Aug 26, 2020 · 2 comments

Comments

@JeanbaptisteVincent
Copy link

Lets say I have an IFC representing 3 IFCDoors, each of those IFCDoor share the same visual representation in the viewer and in the .ifc file but at a different location.

Is it possible that the loader identify that there is only one representation so it creates only one ItemShapeDataOCC that keeps being reused by the RepresentationDataOCC and the ProductShapeDataOCC ?

From what I can see the converter creates a new ItemShapeDataOCC for each ProductShapeDataOCC which is not very efficient if the geometry is repeating a lot throughout the model.

here is how I load and convert the ifc file:

`
shared_ptr ifc_model(new BuildingModel());

shared_ptr<ReaderSTEP> step_reader(new ReaderSTEP());

step_reader->loadModelFromFile(filePath, ifc_model);

shared_ptr<GeometryConverterOCC> geometry_converter(new GeometryConverterOCC(ifc_model));

`

Best regards,
JB

@ifcquery
Copy link
Owner

It would indeed reduce memory and loading time if the ItemShape would be created only once for IfcRepresentationItems with the same ID.
But the problem is, that these items can be a part of an IfcMappedItem, with a local transformation. That transformation needs to be applied to the (carve or OCC) mesh of the item, because in the end and also before all boolean operations, the geometry needs to be in global coordinates.
So at some point, each item needs to be an actual copy of the geometry with all transformations multiplied.
In a scenegraph, such copies can be avoided with transform nodes, but Carve and OCC need actual copies of the mesh with transformations applied.
If you find a solution to avoid that, feel free to share it here :)

@JeanbaptisteVincent
Copy link
Author

Thank you for your quick and very informative answer,

I am not sure to understand what the IfcMappedItem is here for, any clarification would be appreciated.

If you represent the scene as a flat list of mesh I agree, applying the transformation to the geometry directly is good approach but as you said in a scenegraph the transformations can be applied to the nodes instead of the geometry.

Fortunately OCC have the capability to do that using the XDE system (also referred has XCAF) this system allows you to define reference (the actual geometry) and instances that refers to the reference geometry with a different transformation. such a scene can be built under an XCAF document which is actually what I'm trying to do here.

Not sure to know what Carve is and provide compare to OCC.

Best Regards,
JB

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants