mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-29 11:46:33 +00:00
Ran into error when attempting to append EnumProperty. How is that done?
This commit is contained in:
@@ -199,6 +199,9 @@ if bpy is not None:
|
|||||||
operator.SetViewportShadowFromSun,
|
operator.SetViewportShadowFromSun,
|
||||||
operator.SetNorthOffset,
|
operator.SetNorthOffset,
|
||||||
operator.GetNorthOffset,
|
operator.GetNorthOffset,
|
||||||
|
operator.AddPresentationLayer,
|
||||||
|
operator.AddToPresentationLayer,
|
||||||
|
operator.RemovePresentationLayer,
|
||||||
operator.AddDrawingStyleAttribute,
|
operator.AddDrawingStyleAttribute,
|
||||||
operator.RemoveDrawingStyleAttribute,
|
operator.RemoveDrawingStyleAttribute,
|
||||||
operator.CopyPropertyToSelection,
|
operator.CopyPropertyToSelection,
|
||||||
@@ -235,6 +238,7 @@ if bpy is not None:
|
|||||||
prop.BcfTopicDocumentReference,
|
prop.BcfTopicDocumentReference,
|
||||||
prop.BcfTopicRelatedTopic,
|
prop.BcfTopicRelatedTopic,
|
||||||
prop.Subcontext,
|
prop.Subcontext,
|
||||||
|
prop.PresentationLayer,
|
||||||
prop.BIMProperties,
|
prop.BIMProperties,
|
||||||
prop.BIMDebugProperties,
|
prop.BIMDebugProperties,
|
||||||
prop.BCFProperties,
|
prop.BCFProperties,
|
||||||
@@ -245,7 +249,6 @@ if bpy is not None:
|
|||||||
prop.Attribute,
|
prop.Attribute,
|
||||||
prop.IfcParameter,
|
prop.IfcParameter,
|
||||||
prop.BoundaryCondition,
|
prop.BoundaryCondition,
|
||||||
prop.PresentationLayer,
|
|
||||||
prop.PsetQto,
|
prop.PsetQto,
|
||||||
prop.GlobalId,
|
prop.GlobalId,
|
||||||
prop.RepresentationItem,
|
prop.RepresentationItem,
|
||||||
@@ -275,6 +278,7 @@ if bpy is not None:
|
|||||||
ui.BIM_PT_qa,
|
ui.BIM_PT_qa,
|
||||||
ui.BIM_PT_library,
|
ui.BIM_PT_library,
|
||||||
ui.BIM_PT_gis,
|
ui.BIM_PT_gis,
|
||||||
|
ui.BIM_PT_presentation_layers,
|
||||||
ui.BIM_PT_diff,
|
ui.BIM_PT_diff,
|
||||||
ui.BIM_PT_cobie,
|
ui.BIM_PT_cobie,
|
||||||
ui.BIM_PT_patch,
|
ui.BIM_PT_patch,
|
||||||
@@ -282,7 +286,7 @@ if bpy is not None:
|
|||||||
ui.BIM_PT_debug,
|
ui.BIM_PT_debug,
|
||||||
ui.BIM_PT_material,
|
ui.BIM_PT_material,
|
||||||
ui.BIM_PT_mesh,
|
ui.BIM_PT_mesh,
|
||||||
ui.BIM_PT_presentation,
|
ui.BIM_PT_presentation_layer_data,
|
||||||
ui.BIM_PT_object,
|
ui.BIM_PT_object,
|
||||||
ui.BIM_PT_object_material,
|
ui.BIM_PT_object_material,
|
||||||
ui.BIM_PT_object_psets,
|
ui.BIM_PT_object_psets,
|
||||||
@@ -301,6 +305,7 @@ if bpy is not None:
|
|||||||
ui.BIM_UL_generic,
|
ui.BIM_UL_generic,
|
||||||
ui.BIM_UL_clash_sets,
|
ui.BIM_UL_clash_sets,
|
||||||
ui.BIM_UL_constraints,
|
ui.BIM_UL_constraints,
|
||||||
|
ui.BIM_UL_presentation_layers,
|
||||||
ui.BIM_UL_document_information,
|
ui.BIM_UL_document_information,
|
||||||
ui.BIM_UL_document_references,
|
ui.BIM_UL_document_references,
|
||||||
ui.BIM_UL_topics,
|
ui.BIM_UL_topics,
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ def set_active_camera_resolution(scene):
|
|||||||
if not scene.camera or "/" not in scene.camera.name or not scene.DocProperties.drawings:
|
if not scene.camera or "/" not in scene.camera.name or not scene.DocProperties.drawings:
|
||||||
return
|
return
|
||||||
if (
|
if (
|
||||||
scene.render.resolution_x != scene.camera.data.BIMCameraProperties.raster_x
|
scene.render.resolution_x != scene.camera.data.BIMCameraProperties.raster_x
|
||||||
or scene.render.resolution_y != scene.camera.data.BIMCameraProperties.raster_y
|
or scene.render.resolution_y != scene.camera.data.BIMCameraProperties.raster_y
|
||||||
):
|
):
|
||||||
scene.render.resolution_x = scene.camera.data.BIMCameraProperties.raster_x
|
scene.render.resolution_x = scene.camera.data.BIMCameraProperties.raster_x
|
||||||
scene.render.resolution_y = scene.camera.data.BIMCameraProperties.raster_y
|
scene.render.resolution_y = scene.camera.data.BIMCameraProperties.raster_y
|
||||||
@@ -145,8 +145,9 @@ class SelectGlobalId(bpy.types.Operator):
|
|||||||
for obj in bpy.context.visible_objects:
|
for obj in bpy.context.visible_objects:
|
||||||
index = obj.BIMObjectProperties.attributes.find("GlobalId")
|
index = obj.BIMObjectProperties.attributes.find("GlobalId")
|
||||||
if (
|
if (
|
||||||
index != -1
|
index != -1
|
||||||
and obj.BIMObjectProperties.attributes[index].string_value == bpy.context.scene.BIMProperties.global_id
|
and obj.BIMObjectProperties.attributes[
|
||||||
|
index].string_value == bpy.context.scene.BIMProperties.global_id
|
||||||
):
|
):
|
||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
break
|
break
|
||||||
@@ -167,9 +168,9 @@ class SelectAttribute(bpy.types.Operator):
|
|||||||
continue
|
continue
|
||||||
value = object.BIMObjectProperties.attributes[index].string_value
|
value = object.BIMObjectProperties.attributes[index].string_value
|
||||||
if (
|
if (
|
||||||
bpy.context.scene.BIMProperties.search_regex
|
bpy.context.scene.BIMProperties.search_regex
|
||||||
and bpy.context.scene.BIMProperties.search_ignorecase
|
and bpy.context.scene.BIMProperties.search_ignorecase
|
||||||
and re.search(search_value, value, flags=re.IGNORECASE)
|
and re.search(search_value, value, flags=re.IGNORECASE)
|
||||||
):
|
):
|
||||||
object.select_set(True)
|
object.select_set(True)
|
||||||
elif bpy.context.scene.BIMProperties.search_regex and re.search(search_value, value):
|
elif bpy.context.scene.BIMProperties.search_regex and re.search(search_value, value):
|
||||||
@@ -200,9 +201,9 @@ class SelectPset(bpy.types.Operator):
|
|||||||
continue
|
continue
|
||||||
value = object.BIMObjectProperties.psets[pset_index].properties[prop_index].string_value
|
value = object.BIMObjectProperties.psets[pset_index].properties[prop_index].string_value
|
||||||
if (
|
if (
|
||||||
bpy.context.scene.BIMProperties.search_regex
|
bpy.context.scene.BIMProperties.search_regex
|
||||||
and bpy.context.scene.BIMProperties.search_ignorecase
|
and bpy.context.scene.BIMProperties.search_ignorecase
|
||||||
and re.search(search_value, value, flags=re.IGNORECASE)
|
and re.search(search_value, value, flags=re.IGNORECASE)
|
||||||
):
|
):
|
||||||
object.select_set(True)
|
object.select_set(True)
|
||||||
elif bpy.context.scene.BIMProperties.search_regex and re.search(search_value, value):
|
elif bpy.context.scene.BIMProperties.search_regex and re.search(search_value, value):
|
||||||
@@ -301,9 +302,9 @@ class SelectClass(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
for object in bpy.context.visible_objects:
|
for object in bpy.context.visible_objects:
|
||||||
if (
|
if (
|
||||||
"/" in object.name
|
"/" in object.name
|
||||||
and object.name[0:3] == "Ifc"
|
and object.name[0:3] == "Ifc"
|
||||||
and object.name.split("/")[0] == bpy.context.scene.BIMProperties.ifc_class
|
and object.name.split("/")[0] == bpy.context.scene.BIMProperties.ifc_class
|
||||||
):
|
):
|
||||||
object.select_set(True)
|
object.select_set(True)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@@ -316,19 +317,19 @@ class SelectType(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
for object in bpy.context.visible_objects:
|
for object in bpy.context.visible_objects:
|
||||||
if (
|
if (
|
||||||
"/" in object.name
|
"/" in object.name
|
||||||
and object.name[0:3] == "Ifc"
|
and object.name[0:3] == "Ifc"
|
||||||
and object.name.split("/")[0] == bpy.context.scene.BIMProperties.ifc_class
|
and object.name.split("/")[0] == bpy.context.scene.BIMProperties.ifc_class
|
||||||
and "PredefinedType" in object.BIMObjectProperties.attributes
|
and "PredefinedType" in object.BIMObjectProperties.attributes
|
||||||
and object.BIMObjectProperties.attributes["PredefinedType"].string_value
|
and object.BIMObjectProperties.attributes["PredefinedType"].string_value
|
||||||
== bpy.context.scene.BIMProperties.ifc_predefined_type
|
== bpy.context.scene.BIMProperties.ifc_predefined_type
|
||||||
):
|
):
|
||||||
if bpy.context.scene.BIMProperties.ifc_predefined_type != "USERDEFINED":
|
if bpy.context.scene.BIMProperties.ifc_predefined_type != "USERDEFINED":
|
||||||
object.select_set(True)
|
object.select_set(True)
|
||||||
elif (
|
elif (
|
||||||
"ObjectType" in object.BIMObjectProperties.attributes
|
"ObjectType" in object.BIMObjectProperties.attributes
|
||||||
and object.BIMObjectProperties.attributes["ObjectType"].string_value
|
and object.BIMObjectProperties.attributes["ObjectType"].string_value
|
||||||
== bpy.context.scene.BIMProperties.ifc_userdefined_type
|
== bpy.context.scene.BIMProperties.ifc_userdefined_type
|
||||||
):
|
):
|
||||||
object.select_set(True)
|
object.select_set(True)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@@ -423,8 +424,8 @@ class QAHelper:
|
|||||||
is_in_scenario = False
|
is_in_scenario = False
|
||||||
for source_line in source:
|
for source_line in source:
|
||||||
if (
|
if (
|
||||||
"Scenario: " in source_line
|
"Scenario: " in source_line
|
||||||
and bpy.context.scene.BIMProperties.scenario == source_line.strip()[len("Scenario: ") :]
|
and bpy.context.scene.BIMProperties.scenario == source_line.strip()[len("Scenario: "):]
|
||||||
):
|
):
|
||||||
is_in_scenario = True
|
is_in_scenario = True
|
||||||
elif is_in_scenario:
|
elif is_in_scenario:
|
||||||
@@ -715,7 +716,7 @@ class ActivateBcfViewpoint(bpy.types.Operator):
|
|||||||
def hex_to_rgb(self, value):
|
def hex_to_rgb(self, value):
|
||||||
value = value.lstrip("#")
|
value = value.lstrip("#")
|
||||||
lv = len(value)
|
lv = len(value)
|
||||||
t = tuple(int(value[i : i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
t = tuple(int(value[i: i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||||
return [t[0] / 255.0, t[1] / 255.0, t[2] / 255.0, 1]
|
return [t[0] / 255.0, t[1] / 255.0, t[2] / 255.0, 1]
|
||||||
|
|
||||||
|
|
||||||
@@ -2394,12 +2395,12 @@ class CutSection(bpy.types.Operator):
|
|||||||
obj.hide_set(True)
|
obj.hide_set(True)
|
||||||
for obj in bpy.context.visible_objects:
|
for obj in bpy.context.visible_objects:
|
||||||
if (
|
if (
|
||||||
not obj.data
|
not obj.data
|
||||||
or isinstance(obj.data, bpy.types.Camera)
|
or isinstance(obj.data, bpy.types.Camera)
|
||||||
or "IfcGrid/" in obj.name
|
or "IfcGrid/" in obj.name
|
||||||
or "IfcGridAxis/" in obj.name
|
or "IfcGridAxis/" in obj.name
|
||||||
or "IfcOpeningElement/" in obj.name
|
or "IfcOpeningElement/" in obj.name
|
||||||
or self.does_obj_have_target_view_representation(obj, camera)
|
or self.does_obj_have_target_view_representation(obj, camera)
|
||||||
):
|
):
|
||||||
previous_visibility[obj.name] = obj.hide_get()
|
previous_visibility[obj.name] = obj.hide_get()
|
||||||
obj.hide_set(True)
|
obj.hide_set(True)
|
||||||
@@ -2544,8 +2545,8 @@ class ActivateView(bpy.types.Operator):
|
|||||||
# We assume a convention that the 'Views' collection is directly
|
# We assume a convention that the 'Views' collection is directly
|
||||||
# in the project collection
|
# in the project collection
|
||||||
if (
|
if (
|
||||||
"Views" in project_collection.children
|
"Views" in project_collection.children
|
||||||
and collection.name in project_collection.children["Views"].children
|
and collection.name in project_collection.children["Views"].children
|
||||||
):
|
):
|
||||||
project_collection.children["Views"].children[collection.name].hide_viewport = True
|
project_collection.children["Views"].children[collection.name].hide_viewport = True
|
||||||
bpy.data.collections.get(collection.name).hide_render = True
|
bpy.data.collections.get(collection.name).hide_render = True
|
||||||
@@ -2604,9 +2605,9 @@ class SwitchContext(bpy.types.Operator):
|
|||||||
has_context = False
|
has_context = False
|
||||||
for context in self.obj.BIMObjectProperties.representation_contexts:
|
for context in self.obj.BIMObjectProperties.representation_contexts:
|
||||||
if (
|
if (
|
||||||
context.context == self.context
|
context.context == self.context
|
||||||
and context.name == self.subcontext
|
and context.name == self.subcontext
|
||||||
and context.target_view == self.target_view
|
and context.target_view == self.target_view
|
||||||
):
|
):
|
||||||
has_context = True
|
has_context = True
|
||||||
break
|
break
|
||||||
@@ -2633,16 +2634,16 @@ class SwitchContext(bpy.types.Operator):
|
|||||||
|
|
||||||
for rep in element.Representation.Representations:
|
for rep in element.Representation.Representations:
|
||||||
if (
|
if (
|
||||||
rep.ContextOfItems.is_a("IfcGeometricRepresentationSubContext")
|
rep.ContextOfItems.is_a("IfcGeometricRepresentationSubContext")
|
||||||
and rep.ContextOfItems.ContextType == self.context
|
and rep.ContextOfItems.ContextType == self.context
|
||||||
and rep.ContextOfItems.ContextIdentifier == self.subcontext
|
and rep.ContextOfItems.ContextIdentifier == self.subcontext
|
||||||
and rep.ContextOfItems.TargetView == self.target_view
|
and rep.ContextOfItems.TargetView == self.target_view
|
||||||
):
|
):
|
||||||
break
|
break
|
||||||
elif (
|
elif (
|
||||||
rep.ContextOfItems.is_a("IfcGeometricRepresentationContext")
|
rep.ContextOfItems.is_a("IfcGeometricRepresentationContext")
|
||||||
and rep.ContextOfItems.ContextType == self.context
|
and rep.ContextOfItems.ContextType == self.context
|
||||||
and rep.ContextOfItems.ContextIdentifier == self.subcontext
|
and rep.ContextOfItems.ContextIdentifier == self.subcontext
|
||||||
):
|
):
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -2977,7 +2978,8 @@ class AddSectionPlane(bpy.types.Operator):
|
|||||||
section.show_in_front = True
|
section.show_in_front = True
|
||||||
if bpy.context.active_object.select_get() and isinstance(bpy.context.active_object.data, bpy.types.Camera):
|
if bpy.context.active_object.select_get() and isinstance(bpy.context.active_object.data, bpy.types.Camera):
|
||||||
section.matrix_world = (
|
section.matrix_world = (
|
||||||
bpy.context.active_object.matrix_world @ Euler((radians(180.0), 0.0, 0.0), "XYZ").to_matrix().to_4x4()
|
bpy.context.active_object.matrix_world @ Euler((radians(180.0), 0.0, 0.0),
|
||||||
|
"XYZ").to_matrix().to_4x4()
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
section.rotation_euler = Euler((radians(180.0), 0.0, 0.0), "XYZ")
|
section.rotation_euler = Euler((radians(180.0), 0.0, 0.0), "XYZ")
|
||||||
@@ -3394,12 +3396,12 @@ class GenerateReferences(bpy.types.Operator):
|
|||||||
if self.camera.data.BIMCameraProperties.raster_x > self.camera.data.BIMCameraProperties.raster_y:
|
if self.camera.data.BIMCameraProperties.raster_x > self.camera.data.BIMCameraProperties.raster_y:
|
||||||
width = self.camera.data.ortho_scale
|
width = self.camera.data.ortho_scale
|
||||||
height = (
|
height = (
|
||||||
width / self.camera.data.BIMCameraProperties.raster_x * self.camera.data.BIMCameraProperties.raster_y
|
width / self.camera.data.BIMCameraProperties.raster_x * self.camera.data.BIMCameraProperties.raster_y
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
height = self.camera.data.ortho_scale
|
height = self.camera.data.ortho_scale
|
||||||
width = (
|
width = (
|
||||||
height / self.camera.data.BIMCameraProperties.raster_y * self.camera.data.BIMCameraProperties.raster_x
|
height / self.camera.data.BIMCameraProperties.raster_y * self.camera.data.BIMCameraProperties.raster_x
|
||||||
)
|
)
|
||||||
level_obj = annotation.Annotator.get_annotation_obj("Section Level", "curve")
|
level_obj = annotation.Annotator.get_annotation_obj("Section Level", "curve")
|
||||||
|
|
||||||
@@ -3585,9 +3587,9 @@ class PushRepresentation(bpy.types.Operator):
|
|||||||
|
|
||||||
def is_current_context(self, element):
|
def is_current_context(self, element):
|
||||||
return (
|
return (
|
||||||
element.ContextType == self.context
|
element.ContextType == self.context
|
||||||
and element.ContextIdentifier == self.subcontext
|
and element.ContextIdentifier == self.subcontext
|
||||||
and element.TargetView == self.target_view
|
and element.TargetView == self.target_view
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -3678,7 +3680,7 @@ class GuessQuantity(bpy.types.Operator):
|
|||||||
elif bpy.context.scene.unit_settings.system == "METRIC":
|
elif bpy.context.scene.unit_settings.system == "METRIC":
|
||||||
if bpy.context.scene.unit_settings.length_unit == "METERS":
|
if bpy.context.scene.unit_settings.length_unit == "METERS":
|
||||||
return None, "METRE"
|
return None, "METRE"
|
||||||
return bpy.context.scene.unit_settings.length_unit[0 : -len("METERS")], "METRE"
|
return bpy.context.scene.unit_settings.length_unit[0: -len("METERS")], "METRE"
|
||||||
|
|
||||||
|
|
||||||
class ExecuteBIMTester(bpy.types.Operator):
|
class ExecuteBIMTester(bpy.types.Operator):
|
||||||
@@ -3909,7 +3911,7 @@ class ActivateDrawingStyle(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
if context.scene.camera.data.BIMCameraProperties.active_drawing_style_index < len(
|
if context.scene.camera.data.BIMCameraProperties.active_drawing_style_index < len(
|
||||||
bpy.context.scene.DocProperties.drawing_styles
|
bpy.context.scene.DocProperties.drawing_styles
|
||||||
):
|
):
|
||||||
self.drawing_style = bpy.context.scene.DocProperties.drawing_styles[
|
self.drawing_style = bpy.context.scene.DocProperties.drawing_styles[
|
||||||
context.scene.camera.data.BIMCameraProperties.active_drawing_style_index
|
context.scene.camera.data.BIMCameraProperties.active_drawing_style_index
|
||||||
@@ -4187,7 +4189,7 @@ class SetViewportShadowFromSun(bpy.types.Operator):
|
|||||||
# The vector used for the light direction is a bit funny
|
# The vector used for the light direction is a bit funny
|
||||||
mat = Matrix(((-1.0, 0.0, 0.0, 0.0), (0.0, 0, 1.0, 0.0), (-0.0, -1.0, 0, 0.0), (0.0, 0.0, 0.0, 1.0)))
|
mat = Matrix(((-1.0, 0.0, 0.0, 0.0), (0.0, 0, 1.0, 0.0), (-0.0, -1.0, 0, 0.0), (0.0, 0.0, 0.0, 1.0)))
|
||||||
context.scene.display.light_direction = mat.inverted() @ (
|
context.scene.display.light_direction = mat.inverted() @ (
|
||||||
context.active_object.matrix_world.to_quaternion() @ Vector((0, 0, -1))
|
context.active_object.matrix_world.to_quaternion() @ Vector((0, 0, -1))
|
||||||
)
|
)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -4217,6 +4219,57 @@ class GetNorthOffset(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
class AddToPresentationLayer(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.add_to_presentation_layer"
|
||||||
|
bl_label = "Add To Presentation Layer"
|
||||||
|
index: bpy.props.IntProperty()
|
||||||
|
guid: bpy.props.StringProperty()
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
presentation_layers = bpy.context.scene.BIMProperties.presentation_layers
|
||||||
|
new = presentation_layers[self.index]
|
||||||
|
new.assigned_items.items.append(self.guid)
|
||||||
|
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
class AddPresentationLayer(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.add_presentation_layer"
|
||||||
|
bl_label = "Add Presentation Layer"
|
||||||
|
|
||||||
|
_name = 'New Presentation Layer'
|
||||||
|
descript = 'A Description'
|
||||||
|
identifier = 'Something'
|
||||||
|
assigned_items = bpy.props.EnumProperty(items=[])
|
||||||
|
layer_on = True
|
||||||
|
layer_frozen = False
|
||||||
|
layer_blocked = False
|
||||||
|
layer_styles = bpy.props.EnumProperty(items=[])
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
new = bpy.context.scene.BIMProperties.presentation_layers.add()
|
||||||
|
new.name = self._name
|
||||||
|
new.description = self.descript
|
||||||
|
new.identifier = self.identifier
|
||||||
|
new.layer_on = self.layer_on
|
||||||
|
new.layer_frozen = self.layer_frozen
|
||||||
|
new.layer_blocked = self.layer_blocked
|
||||||
|
# new.assigned_items = self.assigned_items
|
||||||
|
# new.layer_styles = self.layer_styles
|
||||||
|
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
class RemovePresentationLayer(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.remove_presentation_layer"
|
||||||
|
bl_label = "Remove Presentation Layer"
|
||||||
|
index: bpy.props.IntProperty()
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
bpy.context.scene.BIMProperties.presentation_layers.remove(self.index)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class AddDrawingStyleAttribute(bpy.types.Operator):
|
class AddDrawingStyleAttribute(bpy.types.Operator):
|
||||||
bl_idname = "bim.add_drawing_style_attribute"
|
bl_idname = "bim.add_drawing_style_attribute"
|
||||||
bl_label = "Add Drawing Style Attribute"
|
bl_label = "Add Drawing Style Attribute"
|
||||||
@@ -4266,7 +4319,7 @@ class SelectHighPolygonMeshes(bpy.types.Operator):
|
|||||||
results = {}
|
results = {}
|
||||||
for obj in bpy.data.objects:
|
for obj in bpy.data.objects:
|
||||||
if not isinstance(obj.data, bpy.types.Mesh) or len(obj.data.polygons) < int(
|
if not isinstance(obj.data, bpy.types.Mesh) or len(obj.data.polygons) < int(
|
||||||
bpy.context.scene.BIMDebugProperties.number_of_polygons
|
bpy.context.scene.BIMDebugProperties.number_of_polygons
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -1555,6 +1555,7 @@ class BIMProperties(PropertyGroup):
|
|||||||
override_colour: FloatVectorProperty(
|
override_colour: FloatVectorProperty(
|
||||||
name="Override Colour", subtype="COLOR", default=(1, 0, 0, 1), min=0.0, max=1.0, size=4
|
name="Override Colour", subtype="COLOR", default=(1, 0, 0, 1), min=0.0, max=1.0, size=4
|
||||||
)
|
)
|
||||||
|
active_presentation_layer_index: IntProperty(name="Active Presentation Layer Index")
|
||||||
presentation_layers: CollectionProperty(name="Presentation Layers", type=PresentationLayer)
|
presentation_layers: CollectionProperty(name="Presentation Layers", type=PresentationLayer)
|
||||||
|
|
||||||
|
|
||||||
@@ -1671,6 +1672,7 @@ class BIMObjectProperties(PropertyGroup):
|
|||||||
qto_name: EnumProperty(items=getQtoNames, name="Qto Name")
|
qto_name: EnumProperty(items=getQtoNames, name="Qto Name")
|
||||||
has_boundary_condition: BoolProperty(name="Has Boundary Condition")
|
has_boundary_condition: BoolProperty(name="Has Boundary Condition")
|
||||||
boundary_condition: PointerProperty(name="Boundary Condition", type=BoundaryCondition)
|
boundary_condition: PointerProperty(name="Boundary Condition", type=BoundaryCondition)
|
||||||
|
active_presentation_layer_index: IntProperty(name="Active Presentation Layer Index")
|
||||||
presentation_layer: PointerProperty(name="Presentation Layer", type=PresentationLayer)
|
presentation_layer: PointerProperty(name="Presentation Layer", type=PresentationLayer)
|
||||||
structural_member_connection: PointerProperty(name="Structural Member Connection", type=bpy.types.Object)
|
structural_member_connection: PointerProperty(name="Structural Member Connection", type=bpy.types.Object)
|
||||||
representation_contexts: CollectionProperty(name="Representation Contexts", type=Subcontext)
|
representation_contexts: CollectionProperty(name="Representation Contexts", type=Subcontext)
|
||||||
|
|||||||
@@ -219,11 +219,11 @@ class BIM_PT_object_qto(Panel):
|
|||||||
row.prop(prop, "name", text="")
|
row.prop(prop, "name", text="")
|
||||||
row.prop(prop, "string_value", text="")
|
row.prop(prop, "string_value", text="")
|
||||||
if (
|
if (
|
||||||
"length" in prop.name.lower()
|
"length" in prop.name.lower()
|
||||||
or "width" in prop.name.lower()
|
or "width" in prop.name.lower()
|
||||||
or "height" in prop.name.lower()
|
or "height" in prop.name.lower()
|
||||||
or "depth" in prop.name.lower()
|
or "depth" in prop.name.lower()
|
||||||
or "perimeter" in prop.name.lower()
|
or "perimeter" in prop.name.lower()
|
||||||
):
|
):
|
||||||
op = row.operator("bim.guess_quantity", icon="IPO_EASE_IN_OUT", text="")
|
op = row.operator("bim.guess_quantity", icon="IPO_EASE_IN_OUT", text="")
|
||||||
op.qto_index = index
|
op.qto_index = index
|
||||||
@@ -670,9 +670,9 @@ class BIM_PT_mesh(Panel):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return (
|
return (
|
||||||
context.active_object is not None
|
context.active_object is not None
|
||||||
and context.active_object.type == "MESH"
|
and context.active_object.type == "MESH"
|
||||||
and hasattr(context.active_object.data, "BIMMeshProperties")
|
and hasattr(context.active_object.data, "BIMMeshProperties")
|
||||||
)
|
)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
@@ -726,7 +726,7 @@ class BIM_PT_mesh(Panel):
|
|||||||
row.prop(props, "swept_solids")
|
row.prop(props, "swept_solids")
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_presentation(Panel):
|
class BIM_PT_presentation_layer_data(Panel):
|
||||||
bl_label = "IFC Presentation Layers"
|
bl_label = "IFC Presentation Layers"
|
||||||
bl_idname = "BIM_PT_presentation"
|
bl_idname = "BIM_PT_presentation"
|
||||||
bl_space_type = "PROPERTIES"
|
bl_space_type = "PROPERTIES"
|
||||||
@@ -736,25 +736,39 @@ class BIM_PT_presentation(Panel):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return (
|
return (
|
||||||
context.active_object is not None
|
context.active_object is not None
|
||||||
and context.active_object.type == "MESH"
|
and context.active_object.type == "MESH"
|
||||||
and hasattr(context.active_object.data, "BIMMeshProperties")
|
and hasattr(context.active_object.data, "BIMMeshProperties")
|
||||||
)
|
)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not context.active_object.data:
|
if not context.active_object.data:
|
||||||
return
|
return
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
props = context.active_object.data.BIMMeshProperties
|
curr_props = context.active_object.data.BIMMeshProperties.presentation_layer
|
||||||
|
|
||||||
row = layout.row(align=True)
|
# if len(curr_props.values()) > 0:
|
||||||
row.prop(props.presentation_layer, "name")
|
|
||||||
row = layout.row()
|
layout.row(align=True).prop(curr_props, "name")
|
||||||
row.prop(props.presentation_layer, "description")
|
layout.row().prop(curr_props, "description")
|
||||||
row = layout.row()
|
layout.row().prop(curr_props, "identifier")
|
||||||
row.prop(props.presentation_layer, "identifier")
|
layout.row().prop(curr_props, "layer_on")
|
||||||
row = layout.row()
|
layout.row().prop(curr_props, "layer_frozen")
|
||||||
row.prop(props.presentation_layer, "layer_on")
|
layout.row().prop(curr_props, "layer_blocked")
|
||||||
|
layout.row().prop(curr_props, "layer_styles")
|
||||||
|
|
||||||
|
props = context.scene.BIMProperties
|
||||||
|
cur_elem = bpy.context.active_object.BIMObjectProperties
|
||||||
|
if props.presentation_layers:
|
||||||
|
layout.template_list("BIM_UL_presentation_layers", "", props, "presentation_layers", props,
|
||||||
|
"active_presentation_layer_index")
|
||||||
|
pres_layer = props.presentation_layers[props.active_presentation_layer_index]
|
||||||
|
if pres_layer.name in bpy.context.scene.BIMProperties.presentation_layers:
|
||||||
|
op = layout.row().operator("bim.add_to_presentation_layer")
|
||||||
|
op.index = props.active_presentation_layer_index
|
||||||
|
op.guid = cur_elem.attributes['GlobalId'].string_value
|
||||||
|
else:
|
||||||
|
layout.label(text="Presentation Layer is invalid")
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_material(Panel):
|
class BIM_PT_material(Panel):
|
||||||
@@ -873,6 +887,52 @@ class BIM_PT_gis(Panel):
|
|||||||
row.operator("bim.set_north_offset")
|
row.operator("bim.set_north_offset")
|
||||||
|
|
||||||
|
|
||||||
|
class BIM_PT_presentation_layers(Panel):
|
||||||
|
bl_label = "IFC Presentation Layers"
|
||||||
|
bl_idname = "BIM_PT_presentation_layer"
|
||||||
|
bl_options = {"DEFAULT_CLOSED"}
|
||||||
|
bl_space_type = "PROPERTIES"
|
||||||
|
bl_region_type = "WINDOW"
|
||||||
|
bl_context = "scene"
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
layout.use_property_split = True
|
||||||
|
props = context.scene.BIMProperties
|
||||||
|
|
||||||
|
layout.row().prop(props, "presentation_layers")
|
||||||
|
layout.row().operator("bim.add_presentation_layer")
|
||||||
|
|
||||||
|
if props.presentation_layers:
|
||||||
|
layout.template_list("BIM_UL_presentation_layers", "", props, "presentation_layers", props,
|
||||||
|
"active_presentation_layer_index")
|
||||||
|
pres_layer = props.presentation_layers[props.active_presentation_layer_index]
|
||||||
|
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.prop(pres_layer, "name")
|
||||||
|
if pres_layer.name in bpy.context.scene.BIMProperties.presentation_layers:
|
||||||
|
pres_layer = bpy.context.scene.BIMProperties.presentation_layers[pres_layer.name]
|
||||||
|
row.operator(
|
||||||
|
"bim.remove_presentation_layer", icon="X", text=""
|
||||||
|
).index = props.active_presentation_layer_index
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(pres_layer, "description")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(pres_layer, "assigned_items")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(pres_layer, "identifier")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(pres_layer, "layer_on")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(pres_layer, "layer_frozen")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(pres_layer, "layer_blocked")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(pres_layer, "layer_styles")
|
||||||
|
else:
|
||||||
|
layout.label(text="Presentation Layer is invalid")
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_drawings(Panel):
|
class BIM_PT_drawings(Panel):
|
||||||
bl_label = "SVG Drawings"
|
bl_label = "SVG Drawings"
|
||||||
bl_idname = "BIM_PT_drawings"
|
bl_idname = "BIM_PT_drawings"
|
||||||
@@ -1576,7 +1636,7 @@ class BIM_PT_bcf(Panel):
|
|||||||
layout.label(text="Document References:")
|
layout.label(text="Document References:")
|
||||||
for index, doc in enumerate(props.topic_document_references):
|
for index, doc in enumerate(props.topic_document_references):
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(doc, "name", text=f"File {index+1} URI")
|
row.prop(doc, "name", text=f"File {index + 1} URI")
|
||||||
if doc.is_external:
|
if doc.is_external:
|
||||||
row.operator("bim.open_bcf_document_reference", icon="URL", text="").data = "{}/{}".format(
|
row.operator("bim.open_bcf_document_reference", icon="URL", text="").data = "{}/{}".format(
|
||||||
props.topic_guid, index
|
props.topic_guid, index
|
||||||
@@ -1586,7 +1646,7 @@ class BIM_PT_bcf(Panel):
|
|||||||
props.topic_guid, index
|
props.topic_guid, index
|
||||||
)
|
)
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(doc, "description", text=f"File {index+1} Description:")
|
row.prop(doc, "description", text=f"File {index + 1} Description:")
|
||||||
|
|
||||||
layout.label(text="Related Topics:")
|
layout.label(text="Related Topics:")
|
||||||
for topic in props.topic_related_topics:
|
for topic in props.topic_related_topics:
|
||||||
@@ -1933,6 +1993,15 @@ class BIM_UL_constraints(bpy.types.UIList):
|
|||||||
layout.label(text="", translate=False)
|
layout.label(text="", translate=False)
|
||||||
|
|
||||||
|
|
||||||
|
class BIM_UL_presentation_layers(bpy.types.UIList):
|
||||||
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||||
|
ob = data
|
||||||
|
if item:
|
||||||
|
layout.prop(item, "name", text="", emboss=False)
|
||||||
|
else:
|
||||||
|
layout.label(text="", translate=False)
|
||||||
|
|
||||||
|
|
||||||
class BIM_UL_document_information(bpy.types.UIList):
|
class BIM_UL_document_information(bpy.types.UIList):
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||||
ob = data
|
ob = data
|
||||||
|
|||||||
Reference in New Issue
Block a user