mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 19:27:10 +00:00
Minor fix
This commit is contained in:
@@ -21,6 +21,7 @@ import numpy as np
|
|||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.util.placement
|
import ifcopenshell.util.placement
|
||||||
|
|
||||||
|
|
||||||
class Patcher:
|
class Patcher:
|
||||||
def __init__(self, src, file, logger, args=None):
|
def __init__(self, src, file, logger, args=None):
|
||||||
self.src = src
|
self.src = src
|
||||||
@@ -31,21 +32,21 @@ class Patcher:
|
|||||||
def patch(self):
|
def patch(self):
|
||||||
absolute_placements = []
|
absolute_placements = []
|
||||||
|
|
||||||
for product in self.file.by_type('IfcProduct'):
|
for product in self.file.by_type("IfcProduct"):
|
||||||
if not product.ObjectPlacement:
|
if not product.ObjectPlacement:
|
||||||
continue
|
continue
|
||||||
absolute_placement = self.get_absolute_placement(product.ObjectPlacement)
|
absolute_placement = self.get_absolute_placement(product.ObjectPlacement)
|
||||||
if absolute_placement.is_a('IfcLocalPlacement'):
|
if absolute_placement.is_a("IfcLocalPlacement"):
|
||||||
absolute_placements.append(absolute_placement)
|
absolute_placements.append(absolute_placement)
|
||||||
absolute_placements = set(absolute_placements)
|
absolute_placements = set(absolute_placements)
|
||||||
|
|
||||||
transformation = self.identity_matrix()
|
transformation = self.identity_matrix()
|
||||||
if len(self.args) == 4:
|
if len(self.args) == 4:
|
||||||
angle = self.args[3]
|
angle = float(self.args[3])
|
||||||
if angle:
|
if angle:
|
||||||
transformation = self.z_rotation_matrix(math.radians(angle), transformation)
|
transformation = self.z_rotation_matrix(math.radians(angle), transformation)
|
||||||
elif len(self.args) == 6:
|
elif len(self.args) == 6:
|
||||||
for arg in (("x", self.args[3]), ("y", self.args[4]), ("z", self.args[5])):
|
for arg in (("x", float(self.args[3])), ("y", float(self.args[4])), ("z", float(self.args[5]))):
|
||||||
if arg[1]:
|
if arg[1]:
|
||||||
transformation = getattr(self, f"{arg[0]}_rotation_matrix")(math.radians(arg[1]), transformation)
|
transformation = getattr(self, f"{arg[0]}_rotation_matrix")(math.radians(arg[1]), transformation)
|
||||||
transformation[0][3] += float(self.args[0])
|
transformation[0][3] += float(self.args[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user