From 98afb72ba3686465108cc80ebffbbfd2ddaa26b0 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 27 Jun 2024 11:45:46 +1000 Subject: [PATCH] Prefer MapConversionScaled in IFC4X3 for SetFalseOrigin --- src/ifcpatch/ifcpatch/recipes/SetFalseOrigin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ifcpatch/ifcpatch/recipes/SetFalseOrigin.py b/src/ifcpatch/ifcpatch/recipes/SetFalseOrigin.py index fef0c546a0..a67463a586 100644 --- a/src/ifcpatch/ifcpatch/recipes/SetFalseOrigin.py +++ b/src/ifcpatch/ifcpatch/recipes/SetFalseOrigin.py @@ -73,17 +73,20 @@ class Patcher: def patch(self): SetWorldCoordinateSystem.Patcher(self.src, self.file, self.logger, x=0, y=0, z=0, ax=0, ay=0, az=0).patch() - map_conversion = { + coordinate_operation = { "Eastings": self.e, "Northings": self.n, "OrthogonalHeight": self.h, } if self.gn_angle: a, o = ifcopenshell.util.geolocation.angle2xaxis(self.gn_angle) - map_conversion.update({"XAxisAbscissa": a, "XAxisOrdinate": o}) - ifcopenshell.api.georeference.add_georeferencing(self.file) + coordinate_operation.update({"XAxisAbscissa": a, "XAxisOrdinate": o}) + ifc_class = "IfcMapConversionScaled" + if self.file.schema in ("IFC4", "IFC2X3"): + ifc_class = "IfcMapConversion" + ifcopenshell.api.georeference.add_georeferencing(self.file, ifc_class=ifc_class) ifcopenshell.api.georeference.edit_georeferencing( - self.file, projected_crs={"Name": self.name}, map_conversion=map_conversion + self.file, projected_crs={"Name": self.name}, coordinate_operation=coordinate_operation ) OffsetObjectPlacements.Patcher( self.src,