mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 22:31:55 +00:00
ResetAbsoluteCoordinates recipe now attempts to avoid changing object placement coordinates, instead focusing on geometry coordinates.
This prevents a double up when combining with the OffsetObjectPlacement recipe when doing tricky patching.
This commit is contained in:
@@ -6,6 +6,10 @@ class Patcher:
|
|||||||
self.args = args
|
self.args = args
|
||||||
|
|
||||||
def patch(self):
|
def patch(self):
|
||||||
|
placement_coord_ids = set()
|
||||||
|
for placement in self.file.by_type('IfcObjectPlacement'):
|
||||||
|
[placement_coord_ids.add(e.id()) for e in self.file.traverse(placement) if e.is_a('IfcCartesianPoint')]
|
||||||
|
|
||||||
# Arbitrary threshold based on experience
|
# Arbitrary threshold based on experience
|
||||||
self.threshold = 1000000
|
self.threshold = 1000000
|
||||||
if self.args and len(self.args) == 1:
|
if self.args and len(self.args) == 1:
|
||||||
@@ -44,6 +48,8 @@ class Patcher:
|
|||||||
for point in self.file.by_type('IfcCartesianPoint'):
|
for point in self.file.by_type('IfcCartesianPoint'):
|
||||||
if len(point.Coordinates) == 2 or not self.is_point_far_away(point):
|
if len(point.Coordinates) == 2 or not self.is_point_far_away(point):
|
||||||
continue
|
continue
|
||||||
|
if point.id() in placement_coord_ids:
|
||||||
|
continue
|
||||||
if not offset_point:
|
if not offset_point:
|
||||||
offset_point = (-point.Coordinates[0], -point.Coordinates[1], -point.Coordinates[2])
|
offset_point = (-point.Coordinates[0], -point.Coordinates[1], -point.Coordinates[2])
|
||||||
self.logger.info(f'Resetting absolute coordinates by {point}')
|
self.logger.info(f'Resetting absolute coordinates by {point}')
|
||||||
|
|||||||
Reference in New Issue
Block a user