mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 02:49:12 +00:00
Implement WCS consideration in XYZ <-> ENH conversions.
This commit is contained in:
@@ -81,28 +81,32 @@ def edit_georeferencing(
|
||||
if not (project := file.by_type("IfcProject")):
|
||||
return
|
||||
project = project[0]
|
||||
if crs := ifcopenshell.util.element.get_pset(project, "ePSet_ProjectedCRS"):
|
||||
crs = file.by_id(crs["id"])
|
||||
for k, v in projected_crs.items():
|
||||
if k == "Description":
|
||||
v = file.createIfcText(v)
|
||||
elif k == "Name":
|
||||
v = file.createIfcLabel(v)
|
||||
else:
|
||||
v = file.createIfcIdentifier(v)
|
||||
ifcopenshell.api.pset.edit_pset(file, crs, properties=projected_crs)
|
||||
if conversion := ifcopenshell.util.element.get_pset(project, "ePSet_MapConversion"):
|
||||
conversion = file.by_id(conversion["id"])
|
||||
for k, v in coordinate_operation.items():
|
||||
if k in ("XAxisAbscissa", "XAxisOrdinate", "Scale"):
|
||||
v = file.createIfcReal(v)
|
||||
else:
|
||||
v = file.createIfcLengthMeasure(v)
|
||||
ifcopenshell.api.pset.edit_pset(file, conversion, properties=coordinate_operation)
|
||||
if projected_crs:
|
||||
if crs := ifcopenshell.util.element.get_pset(project, "ePSet_ProjectedCRS"):
|
||||
crs = file.by_id(crs["id"])
|
||||
for k, v in projected_crs.items():
|
||||
if k == "Description":
|
||||
v = file.createIfcText(v)
|
||||
elif k == "Name":
|
||||
v = file.createIfcLabel(v)
|
||||
else:
|
||||
v = file.createIfcIdentifier(v)
|
||||
ifcopenshell.api.pset.edit_pset(file, crs, properties=projected_crs)
|
||||
if coordinate_operation:
|
||||
if conversion := ifcopenshell.util.element.get_pset(project, "ePSet_MapConversion"):
|
||||
conversion = file.by_id(conversion["id"])
|
||||
for k, v in coordinate_operation.items():
|
||||
if k in ("XAxisAbscissa", "XAxisOrdinate", "Scale"):
|
||||
v = file.createIfcReal(v)
|
||||
else:
|
||||
v = file.createIfcLengthMeasure(v)
|
||||
ifcopenshell.api.pset.edit_pset(file, conversion, properties=coordinate_operation)
|
||||
return
|
||||
conversion = file.by_type("IfcCoordinateOperation")[0]
|
||||
crs = file.by_type("IfcProjectedCRS")[0]
|
||||
for name, value in coordinate_operation.items():
|
||||
setattr(conversion, name, value)
|
||||
for name, value in projected_crs.items():
|
||||
setattr(crs, name, value)
|
||||
if projected_crs:
|
||||
crs = file.by_type("IfcProjectedCRS")[0]
|
||||
for name, value in projected_crs.items():
|
||||
setattr(crs, name, value)
|
||||
if coordinate_operation:
|
||||
conversion = file.by_type("IfcCoordinateOperation")[0]
|
||||
for name, value in coordinate_operation.items():
|
||||
setattr(conversion, name, value)
|
||||
|
||||
Reference in New Issue
Block a user