This commit is contained in:
Andrej730
2024-11-12 14:53:36 +05:00
parent 77fc2a89d0
commit e2bf611c17
3 changed files with 15 additions and 6 deletions
@@ -155,18 +155,26 @@ class AddProfileDef(bpy.types.Operator, tool.Ifc.Operator):
obj = context.scene.BIMProfileProperties.object_to_profile
if obj:
if len(obj.data.polygons) != 1:
self.report({"WARNING"}, "This mesh is invalid to create a profile. Select a flat mesh with no more then one face.")
self.report(
{"WARNING"},
"This mesh is invalid to create a profile. Select a flat mesh with no more then one face.",
)
return
for v in obj.data.polygons[0].vertices:
vert = obj.data.vertices[v]
if vert.co.z > 0:
self.report({"WARNING"}, "This mesh is invalid to create a profile. Select a flat mesh with all its vertices at z=0")
self.report(
{"WARNING"},
"This mesh is invalid to create a profile. Select a flat mesh with all its vertices at z=0",
)
return
obj_points.append((vert.co.x, vert.co.y))
if obj_points:
obj_points.append(obj_points[0])
obj_points = [(v[0] - obj_points[0][0], v[1] - obj_points[0][1]) for v in obj_points] # Make sure the first point is (0, 0)
obj_points = [
(v[0] - obj_points[0][0], v[1] - obj_points[0][1]) for v in obj_points
] # Make sure the first point is (0, 0)
props = context.scene.BIMProfileProperties
profile_class = props.profile_classes
if profile_class == "IfcArbitraryClosedProfileDef":
+3 -1
View File
@@ -72,7 +72,9 @@ class BIMProfileProperties(PropertyGroup):
description="Check to only show IfcProfileDefs attached to IfcMaterialProfiles",
update=lambda self, context: bpy.ops.bim.load_profiles(),
)
object_to_profile: PointerProperty(name="Object to profile", type=bpy.types.Object, description="Object to copy the mesh to a profile")
object_to_profile: PointerProperty(
name="Object to profile", type=bpy.types.Object, description="Object to copy the mesh to a profile"
)
def generate_thumbnail_for_active_profile():
@@ -2503,7 +2503,6 @@ class ClearMeasurement(bpy.types.Operator):
def poll(cls, context):
return len(context.scene.BIMPolylineProperties.measurement_polyline) > 0
def execute(self, context):
context.scene.BIMPolylineProperties.measurement_polyline.clear()
MeasureDecorator.uninstall()