mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-02 21:12:07 +00:00
@@ -1047,11 +1047,12 @@ class Loader(bonsai.core.tool.Loader):
|
|||||||
elif usage.LayerSetDirection == "AXIS3":
|
elif usage.LayerSetDirection == "AXIS3":
|
||||||
co = Vector((0.0, 0.0, offset))
|
co = Vector((0.0, 0.0, offset))
|
||||||
no = cls.get_extrusion_vector(element).normalized()
|
no = cls.get_extrusion_vector(element).normalized()
|
||||||
no = Vector([0.0, 0.0, 1.0 if no.z > 0 else -1.0])
|
no = Vector([0.0, 0.0, 1.0])
|
||||||
elif usage.LayerSetDirection == "AXIS3":
|
elif usage.LayerSetDirection == "AXIS1":
|
||||||
co = Vector((0.0, 0.0, offset))
|
co = Vector((0.0, 0.0, offset))
|
||||||
no = cls.get_extrusion_vector(element).normalized()
|
no = cls.get_extrusion_vector(element).normalized()
|
||||||
no = Vector([1.0 if no.x > 0 else -1.0, 0.0, 0.0])
|
no = Vector([1.0, 0.0, 0.0])
|
||||||
|
no *= sense_factor
|
||||||
# Cache this
|
# Cache this
|
||||||
body = ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Body", "MODEL_VIEW")
|
body = ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Body", "MODEL_VIEW")
|
||||||
styles = {}
|
styles = {}
|
||||||
@@ -1061,8 +1062,7 @@ class Loader(bonsai.core.tool.Loader):
|
|||||||
styles[style] = i
|
styles[style] = i
|
||||||
for layer in layer_set.MaterialLayers[:-1]:
|
for layer in layer_set.MaterialLayers[:-1]:
|
||||||
prev_co = co.copy()
|
prev_co = co.copy()
|
||||||
co += no * layer.LayerThickness * cls.unit_scale * sense_factor
|
co += no * layer.LayerThickness * cls.unit_scale
|
||||||
# co.y += layer.LayerThickness * cls.unit_scale * sense_factor
|
|
||||||
bisect_geom = bmesh.ops.bisect_plane(
|
bisect_geom = bmesh.ops.bisect_plane(
|
||||||
bm, geom=bm.verts[:] + bm.edges[:] + bm.faces[:], dist=0.0001, plane_co=co, plane_no=no
|
bm, geom=bm.verts[:] + bm.edges[:] + bm.faces[:], dist=0.0001, plane_co=co, plane_no=no
|
||||||
)
|
)
|
||||||
@@ -1074,7 +1074,6 @@ class Loader(bonsai.core.tool.Loader):
|
|||||||
for face in bisect_geom["geom"]:
|
for face in bisect_geom["geom"]:
|
||||||
if isinstance(face, bmesh.types.BMFace):
|
if isinstance(face, bmesh.types.BMFace):
|
||||||
center = face.calc_center_median()
|
center = face.calc_center_median()
|
||||||
# if center.y < co.y and center.y > prev_co.y:
|
|
||||||
if (center - co).dot(no) < 0 and (center - prev_co).dot(no) >= 0:
|
if (center - co).dot(no) < 0 and (center - prev_co).dot(no) >= 0:
|
||||||
face.material_index = material_index
|
face.material_index = material_index
|
||||||
has_layer_styles = True
|
has_layer_styles = True
|
||||||
@@ -1087,7 +1086,7 @@ class Loader(bonsai.core.tool.Loader):
|
|||||||
mesh.materials.append(tool.Ifc.get_object(style))
|
mesh.materials.append(tool.Ifc.get_object(style))
|
||||||
for face in bisect_geom["geom"]:
|
for face in bisect_geom["geom"]:
|
||||||
if isinstance(face, bmesh.types.BMFace):
|
if isinstance(face, bmesh.types.BMFace):
|
||||||
center = face.calc_center_median() * sense_factor
|
center = face.calc_center_median()
|
||||||
# if center.y > co.y:
|
# if center.y > co.y:
|
||||||
if (center - co).dot(no) >= 0:
|
if (center - co).dot(no) >= 0:
|
||||||
face.material_index = material_index
|
face.material_index = material_index
|
||||||
|
|||||||
Reference in New Issue
Block a user