Unrotate and use absolute brep coordinates in ifc

edited March 26 in General

First of all, I am a complete noob in IfcOpenShell so my apologies for possible incorrect terminology. I am trying to make a tool for ifc files containing prefabricated concrete elements. We receive 1 ifc file containing the entire building (IfcProject, IfcSite, IfcBuilding, IfcBuildingStorey).

The first step has succeeded
Split every unique prefabricated element with all ElementAssemblies and Accessories in the correct structure

  • Get a list of all unique elements
  • List all connected parts and accessories with “ifcopenshell.util.element.get_decomposition(element)”
  • Use ifcpatch recipe “ExtractElements" to place them in 1 ifc file
    -> File _K19.ifc

The location of this element should be 0,0,0 without rotation.
To calculate the correct formwork I base the rotation of everything to the rotation of my biggest concrete element (“IfcColumn” in this specific case) and get rid of all the “IfcProject, IfcSite, IfcBuilding, IfcBuildingStorey” placements and rotation.
I tried this using various ways

  • ifcopenshell.geom.settings() - USE_WORLD_COORDS (same output)
  • ifcopenshell.geom.settings() - BUILDING_LOCAL_PLACEMENT (same output)
  • ifcopenshell.geom.settings() - SITE_LOCAL_PLACEMENT (same output)
  • ifcopenshell.geom.settings() - USE_BREP_DATA (same output)
  • ifcopenshell.geom.settings() - USE_PYTHON_OPENCASCADE (same output)
  • ifcpatch – ResetSpatialElementLocations (only resets 1 of many IFCCARTESIANPOINTS)
  • ifcpatch – SetWorldCoordinateSystem "arguments": [0,0,0,0,0,0] (same output)
  • IfcPatch – OffsetObjectPlacements with scipy.spatial.transform.Rotation.as_euler (does not give the expected outcome after extensive testing)

These settings either give the same ifc output as the original or did not change the ifc file as expected.

The only piece of code that seems to works is IfcPatch - OffsetObjectPlacements

  • Get the direction of the biggest concrete element with “ifcopenshell.util.placement.get_local_placement(biggestconcreteelement.ObjectPlacement)”
  • Offset using IfcPatch – OffsetObjectPlacements with "arguments": [0,0,0,False,0,0,0] which adds a global location and direction to the end of the file.
  • Reverse the rotation (i did this manually by adjusting the DirectionRatios), while keeping the z-axis orientation.
    #8664=IFCCARTESIANPOINT((-177556.685383467,-198018.589999756,1290.));
    #8665=IFCDIRECTION((0.,0.,1.));
    #8666=IFCDIRECTION((0.788225611989142,-0.615386370180835,0.));
    #8667=IFCAXIS2PLACEMENT3D(#8664,#8665,#8666);

-> File _K19_rotated.ifc

My questions

  • I have reversed the rotation manually by using the 4x4 matrix and adjusting the outputed IFCDIRECTION values while keeping the z-axis orientation. How can I calculate the necessary rotation from the 4x4 matrix so I can use them in ifcpatch OffsetObjectPlacements – Or does an “unrotated function” exist?
  • For further processing I need to get rid of all the ifcproject, IfcSite, … locations and directions, so the IFCCARTESIANPOINTS for the Brep faces contain absolute coordinates (maybe a different output format ?). Is this possible?
Sign In or Register to comment.