Point of Origin of an IFC element

edited July 2024 in General


Hello!

I am creating a 3D model of a house using ifcopenshell, which includes walls, doors, and windows. Currently, the origin of the generated doors and windows is at the bottom corner of each element. I want to change the origin to the geometric center of these elements. How can I achieve this using "IfcOpenShell-Python"?

I am using "geometry.add_window_representation" to generate the window.

Comments

  • edited July 2024

    @Manasvi Right click on the selected element, Set Origin > Origin to Centre of Mass (Surface or Volume) has worked for me, although there may be a better way

  • edited July 2024

    I don't think there is anything stopping you from doing that but you should know your enityt then wouldn't follow the convention on object origin of IfcWindow which BlenderBIM loosely enforces by setting it up correctly by default.

    Since you seem to be using the BlenderBIM addon, you can simply right click in the 3D viewport while your window is selected, go to the bottom of the context popup, select "Ifc Set Origin" then "Ifc Origin to Geometry". This should work but I just noted it doesn't on my version, my just be a me problem.

    John
  • @John, @Gorgious
    I am using BlenderBIM only for visualization and generating the IFC file through a Python script.
    Would you know how I can set the origin through code?

  • If you're generating the IFC from Python, then it depends on how you're generating the geometry. In short, you'll set the object placement to the "point of origin", and then you'll need to offset your geometry's coordinates such that it's still where you desire it to be. However that process depends on what your geometry is. If you're using a mesh, you'll need to offset your verts.

    If you're doing any parametric layered elements, do not change the object placement, there are rules in IFC as to the local axes and placements.

  • @Moult
    I am a beginner at this, is there a reference or example I could follow?
    As I said I am currently getting the geometry using "geometry.add_window_representation", and using "shape builder" to build the representation

Sign In or Register to comment.