mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 06:21:40 +00:00
Create UI to assign and remove Psets
This commit is contained in:
@@ -31,7 +31,10 @@ classes = (
|
|||||||
operator.SelectExternalMaterialDir,
|
operator.SelectExternalMaterialDir,
|
||||||
operator.AssignSweptSolidProfile,
|
operator.AssignSweptSolidProfile,
|
||||||
operator.AssignSweptSolidExtrusion,
|
operator.AssignSweptSolidExtrusion,
|
||||||
|
operator.AssignPset,
|
||||||
|
operator.RemovePset,
|
||||||
ui.BIMProperties,
|
ui.BIMProperties,
|
||||||
|
ui.ObjectProperties,
|
||||||
ui.MaterialProperties,
|
ui.MaterialProperties,
|
||||||
ui.MeshProperties,
|
ui.MeshProperties,
|
||||||
ui.BIMPanel,
|
ui.BIMPanel,
|
||||||
@@ -54,6 +57,7 @@ def register():
|
|||||||
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
|
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
|
||||||
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
|
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
|
||||||
bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=ui.BIMProperties)
|
bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=ui.BIMProperties)
|
||||||
|
bpy.types.Object.ObjectProperties = bpy.props.PointerProperty(type=ui.ObjectProperties)
|
||||||
bpy.types.Material.MaterialProperties = bpy.props.PointerProperty(type=ui.MaterialProperties)
|
bpy.types.Material.MaterialProperties = bpy.props.PointerProperty(type=ui.MaterialProperties)
|
||||||
bpy.types.Mesh.MeshProperties = bpy.props.PointerProperty(type=ui.MeshProperties)
|
bpy.types.Mesh.MeshProperties = bpy.props.PointerProperty(type=ui.MeshProperties)
|
||||||
|
|
||||||
@@ -63,6 +67,7 @@ def unregister():
|
|||||||
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
|
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
|
||||||
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
|
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
|
||||||
del(bpy.types.Scene.BIMProperties)
|
del(bpy.types.Scene.BIMProperties)
|
||||||
|
del(bpy.types.Object.ObjectProperties)
|
||||||
del(bpy.types.Material.MaterialProperties)
|
del(bpy.types.Material.MaterialProperties)
|
||||||
del(bpy.types.Mesh.MeshProperties)
|
del(bpy.types.Mesh.MeshProperties)
|
||||||
|
|
||||||
|
|||||||
@@ -201,6 +201,25 @@ class SelectAudited(bpy.types.Operator):
|
|||||||
object.select_set(True)
|
object.select_set(True)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
class AssignPset(bpy.types.Operator):
|
||||||
|
bl_idname = 'bim.assign_pset'
|
||||||
|
bl_label = 'Assign Pset'
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
for object in bpy.context.selected_objects:
|
||||||
|
object[bpy.context.scene.BIMProperties.pset_name] = bpy.context.scene.BIMProperties.pset_file
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
class RemovePset(bpy.types.Operator):
|
||||||
|
bl_idname = 'bim.remove_pset'
|
||||||
|
bl_label = 'Remove Pset'
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
for object in bpy.context.selected_objects:
|
||||||
|
if bpy.context.scene.BIMProperties.pset_name in object.keys():
|
||||||
|
del(object[bpy.context.scene.BIMProperties.pset_name])
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
class AssignSweptSolidProfile(bpy.types.Operator):
|
class AssignSweptSolidProfile(bpy.types.Operator):
|
||||||
bl_idname = 'bim.assign_swept_solid_profile'
|
bl_idname = 'bim.assign_swept_solid_profile'
|
||||||
bl_label = 'Assign Profile'
|
bl_label = 'Assign Profile'
|
||||||
|
|||||||
@@ -25,6 +25,16 @@ class BIMProperties(bpy.types.PropertyGroup):
|
|||||||
continue
|
continue
|
||||||
return [(e, e, '') for e in attribute['enum_values']]
|
return [(e, e, '') for e in attribute['enum_values']]
|
||||||
|
|
||||||
|
def getPsetNames(self, context):
|
||||||
|
files = os.listdir(bpy.context.scene.BIMProperties.data_dir + 'pset/')
|
||||||
|
return [(f, f, '') for f in files]
|
||||||
|
|
||||||
|
def getPsetFiles(self, context):
|
||||||
|
if not bpy.context.scene.BIMProperties.pset_name:
|
||||||
|
return []
|
||||||
|
files = os.listdir(bpy.context.scene.BIMProperties.data_dir + 'pset/{}/'.format(bpy.context.scene.BIMProperties.pset_name))
|
||||||
|
return [(f.replace('.csv', ''), f.replace('.csv', ''), '') for f in files]
|
||||||
|
|
||||||
schema_dir: bpy.props.StringProperty(default=cwd + 'schema/', name="Schema Directory")
|
schema_dir: bpy.props.StringProperty(default=cwd + 'schema/', name="Schema Directory")
|
||||||
data_dir: bpy.props.StringProperty(default=cwd + 'data/', name="Data Directory")
|
data_dir: bpy.props.StringProperty(default=cwd + 'data/', name="Data Directory")
|
||||||
ifc_class: bpy.props.EnumProperty(items = getIfcClasses, name="Class")
|
ifc_class: bpy.props.EnumProperty(items = getIfcClasses, name="Class")
|
||||||
@@ -33,7 +43,12 @@ class BIMProperties(bpy.types.PropertyGroup):
|
|||||||
name="Predefined Type", default=None)
|
name="Predefined Type", default=None)
|
||||||
ifc_userdefined_type: bpy.props.StringProperty(name="Userdefined Type")
|
ifc_userdefined_type: bpy.props.StringProperty(name="Userdefined Type")
|
||||||
export_has_representations: bpy.props.BoolProperty(name="Export Representations", default=True)
|
export_has_representations: bpy.props.BoolProperty(name="Export Representations", default=True)
|
||||||
qa_reject_element_reason: bpy.props.StringProperty(name="Element rejection reason")
|
qa_reject_element_reason: bpy.props.StringProperty(name="Element Rejection Reason")
|
||||||
|
pset_name: bpy.props.EnumProperty(items=getPsetNames, name="Pset Name")
|
||||||
|
pset_file: bpy.props.EnumProperty(items=getPsetFiles, name="Pset File")
|
||||||
|
|
||||||
|
class ObjectProperties(bpy.types.PropertyGroup):
|
||||||
|
global_id: bpy.props.StringProperty(name="GlobalId")
|
||||||
|
|
||||||
class MaterialProperties(bpy.types.PropertyGroup):
|
class MaterialProperties(bpy.types.PropertyGroup):
|
||||||
is_external: bpy.props.BoolProperty(name="Has External Definition")
|
is_external: bpy.props.BoolProperty(name="Has External Definition")
|
||||||
@@ -125,6 +140,16 @@ class BIMPanel(bpy.types.Panel):
|
|||||||
row.operator("bim.select_class")
|
row.operator("bim.select_class")
|
||||||
row.operator("bim.select_type")
|
row.operator("bim.select_type")
|
||||||
|
|
||||||
|
layout.label(text="Property Sets:")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(bim_properties, "pset_name")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(bim_properties, "pset_file")
|
||||||
|
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.operator("bim.assign_pset")
|
||||||
|
row.operator("bim.remove_pset")
|
||||||
|
|
||||||
layout.label(text="Quality Auditing:")
|
layout.label(text="Quality Auditing:")
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
|||||||
Reference in New Issue
Block a user