mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
minor changes
This commit is contained in:
@@ -50,10 +50,8 @@ classes = (
|
|||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
bpy.types.Scene.BIMSearchProperties = bpy.props.PointerProperty(
|
bpy.types.Scene.BIMSearchProperties = bpy.props.PointerProperty(type=prop.BIMSearchProperties)
|
||||||
type=prop.BIMSearchProperties)
|
bpy.types.Scene.IfcSelectorProperties = bpy.props.PointerProperty(type=prop.IfcSelectorProperties)
|
||||||
bpy.types.Scene.IfcSelectorProperties = bpy.props.PointerProperty(
|
|
||||||
type=prop.IfcSelectorProperties)
|
|
||||||
|
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ class EditBlenderCollection(bpy.types.Operator):
|
|||||||
getattr(context.bim_prop_group, self.collection).add()
|
getattr(context.bim_prop_group, self.collection).add()
|
||||||
else:
|
else:
|
||||||
getattr(context.bim_prop_group, self.collection).remove(self.index)
|
getattr(context.bim_prop_group, self.collection).remove(self.index)
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
@@ -104,8 +103,7 @@ class SelectIfcClass(bpy.types.Operator):
|
|||||||
for obj in context.visible_objects:
|
for obj in context.visible_objects:
|
||||||
if not obj.BIMObjectProperties.ifc_definition_id or obj.is_library_indirect:
|
if not obj.BIMObjectProperties.ifc_definition_id or obj.is_library_indirect:
|
||||||
continue
|
continue
|
||||||
element = self.file.by_id(
|
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||||
obj.BIMObjectProperties.ifc_definition_id)
|
|
||||||
if does_keyword_exist(self.ifc_class, element.is_a(), context):
|
if does_keyword_exist(self.ifc_class, element.is_a(), context):
|
||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@@ -126,12 +124,10 @@ class SelectAttribute(bpy.types.Operator):
|
|||||||
for obj in context.visible_objects:
|
for obj in context.visible_objects:
|
||||||
if not obj.BIMObjectProperties.ifc_definition_id:
|
if not obj.BIMObjectProperties.ifc_definition_id:
|
||||||
continue
|
continue
|
||||||
element = self.file.by_id(
|
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||||
obj.BIMObjectProperties.ifc_definition_id)
|
|
||||||
if context.scene.BIMSearchProperties.should_ignorecase:
|
if context.scene.BIMSearchProperties.should_ignorecase:
|
||||||
data = element.get_info()
|
data = element.get_info()
|
||||||
value = next((v for k, v in data.items()
|
value = next((v for k, v in data.items() if k.lower() == attribute_name.lower()), None)
|
||||||
if k.lower() == attribute_name.lower()), None)
|
|
||||||
else:
|
else:
|
||||||
value = getattr(element, attribute_name, None)
|
value = getattr(element, attribute_name, None)
|
||||||
if does_keyword_exist(pattern, value, context):
|
if does_keyword_exist(pattern, value, context):
|
||||||
@@ -155,8 +151,7 @@ class SelectPset(bpy.types.Operator):
|
|||||||
for obj in context.visible_objects:
|
for obj in context.visible_objects:
|
||||||
if not obj.BIMObjectProperties.ifc_definition_id:
|
if not obj.BIMObjectProperties.ifc_definition_id:
|
||||||
continue
|
continue
|
||||||
element = self.file.by_id(
|
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||||
obj.BIMObjectProperties.ifc_definition_id)
|
|
||||||
psets = ifcopenshell.util.element.get_psets(element)
|
psets = ifcopenshell.util.element.get_psets(element)
|
||||||
if search_pset_name == "":
|
if search_pset_name == "":
|
||||||
props = {}
|
props = {}
|
||||||
@@ -164,10 +159,8 @@ class SelectPset(bpy.types.Operator):
|
|||||||
else:
|
else:
|
||||||
props = None
|
props = None
|
||||||
if context.scene.BIMSearchProperties.should_ignorecase:
|
if context.scene.BIMSearchProperties.should_ignorecase:
|
||||||
props = props or next(
|
props = props or next((v for k, v in psets.items() if k.lower() == search_pset_name.lower()), {})
|
||||||
(v for k, v in psets.items() if k.lower() == search_pset_name.lower()), {})
|
value = str(next((v for k, v in props.items() if k.lower() == search_prop_name.lower()), None))
|
||||||
value = str(next((v for k, v in props.items()
|
|
||||||
if k.lower() == search_prop_name.lower()), None))
|
|
||||||
else:
|
else:
|
||||||
props = props or psets.get(search_pset_name, {})
|
props = props or psets.get(search_pset_name, {})
|
||||||
value = props.get(search_prop_name, None)
|
value = props.get(search_prop_name, None)
|
||||||
@@ -539,8 +532,8 @@ class FilterModelElements(bpy.types.Operator):
|
|||||||
|
|
||||||
selection += "["
|
selection += "["
|
||||||
|
|
||||||
if f.selector == "Pset-Property":
|
if f.selector == "IfcPropertySet":
|
||||||
selection += f'{f.active_option}.{f.active_sub_option} {"!" if f.negation else ""} ="{f.value}"'
|
selection += f'{f.active_option.split(": ")[1]}.{f.active_sub_option.split(": ")[1]} {"!" if f.negation else ""}="{f.value}"'
|
||||||
elif f.selector == "Attribute":
|
elif f.selector == "Attribute":
|
||||||
selection += f'{f.attribute} {"!" if f.negation else ""}= "{f.value}"'
|
selection += f'{f.attribute} {"!" if f.negation else ""}= "{f.value}"'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user