New SetFalseOrigin patch recipe to make it easy to "Just Fix It!"

This combines the best practices of a few other patch recipes to make it easy to say "this point here is this world coordinate".
This commit is contained in:
Dion Moult
2024-06-19 23:41:46 +10:00
parent fab3ee70dd
commit fcf2c37432
2 changed files with 101 additions and 10 deletions
@@ -42,7 +42,8 @@ def add_georeferencing(file: ifcopenshell.file) -> None:
ifcopenshell.api.run("georeference.add_georeferencing", model)
"""
if file.by_type("IfcProjectedCRS"):
return
source_crs = None
for context in file.by_type("IfcGeometricRepresentationContext", include_subtypes=False):
if context.ContextType == "Model":
@@ -50,14 +51,7 @@ def add_georeferencing(file: ifcopenshell.file) -> None:
break
if not source_crs:
return
projected_crs = file.create_entity("IfcProjectedCRS", **{"Name": ""})
projected_crs = file.create_entity("IfcProjectedCRS", Name="")
file.create_entity(
"IfcMapConversion",
**{
"SourceCRS": source_crs,
"TargetCRS": projected_crs,
"Eastings": 0,
"Northings": 0,
"OrthogonalHeight": 0,
}
"IfcMapConversion", SourceCRS=source_crs, TargetCRS=projected_crs, Eastings=0, Northings=0, OrthogonalHeight=0
)