OSArch Community

[IfcOpenShell-Python] How to optimize the ifc file?

  1. M

    So i have created from this obj file https://github.com/Martin15135215/git_ifc_test/blob/main/test_obj_cubus/cubus_b.obj with this script https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/blenderbim/scripts/obj2ifc-meshlab.py an ifc file https://github.com/Martin15135215/git_ifc_test/blob/main/test_obj_cubus/cubus_b.ifc.

    What I have noticed, for example, is that this IFCCARTESIANPOINT((-1.,1.,3.384652)) appears five times in the ifc file. Of course for this small ifc file it doesn't make that big a difference, but if the ifc file is bigger, this duplicate IFCCARTESIANPOINT unnecessarily makes the document bigger than it needs to be.

    Is there already a command for the optimization that I can execute before it is saved on line 83 in an ifc file?

    Somthing like ifcopenshell.api.run("optimize.remove_duplicate", file=self.file).

    i have found nothing in my research. i am happy if someone points it out to me.

  2. T

    There's this patch discussed here, among other things.

  3. T
  4. M

    Thanks for the help @theoryshaw

    So i did add this code to the script:

    And it did manage to reduce the file size:

    6 to 4, it is like 30 %. not bad ?

  5. M

    @Martin156131 you can run it again to optimise it further (with diminishing returns).

Login or Register to reply.