mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 15:38:03 +00:00
New UI in Blender to run IFCPatch
This commit is contained in:
@@ -262,6 +262,21 @@ endif
|
|||||||
# Provides IFCCSV functionality
|
# Provides IFCCSV functionality
|
||||||
cd dist/blenderbim/libs/site/packages/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifccsv/ifccsv.py
|
cd dist/blenderbim/libs/site/packages/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifccsv/ifccsv.py
|
||||||
|
|
||||||
|
# Provides IFCPatch functionality
|
||||||
|
cd dist/blenderbim/libs/site/packages/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcpatch/ifcpatch.py
|
||||||
|
|
||||||
|
# Required by IFCPatch
|
||||||
|
cd dist/blenderbim/libs/site/packages/ && mkdir recipes
|
||||||
|
cd dist/blenderbim/libs/site/packages/recipes && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcpatch/recipes/__init__.py
|
||||||
|
cd dist/blenderbim/libs/site/packages/recipes && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcpatch/recipes/OffsetObjectPlacements.py
|
||||||
|
cd dist/blenderbim/libs/site/packages/recipes && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcpatch/recipes/OffsetStoreyElevations.py
|
||||||
|
cd dist/blenderbim/libs/site/packages/recipes && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcpatch/recipes/RecycleNonRootedElements.py
|
||||||
|
cd dist/blenderbim/libs/site/packages/recipes && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcpatch/recipes/RemoveSiteRepresentation.py
|
||||||
|
cd dist/blenderbim/libs/site/packages/recipes && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcpatch/recipes/ResetAbsoluteCoordinates.py
|
||||||
|
cd dist/blenderbim/libs/site/packages/recipes && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcpatch/recipes/ResetSpatialElementLocations.py
|
||||||
|
cd dist/blenderbim/libs/site/packages/recipes && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcpatch/recipes/SetRefElevation.py
|
||||||
|
cd dist/blenderbim/libs/site/packages/recipes && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.6.0/src/ifcpatch/recipes/SplitByBuildingStorey.py
|
||||||
|
|
||||||
cd dist/blenderbim && sed -i "s/999999/$(VERSION)/" __init__.py
|
cd dist/blenderbim && sed -i "s/999999/$(VERSION)/" __init__.py
|
||||||
cd dist && zip -r blender28-bim-$(VERSION)-$(PLATFORM).zip ./*
|
cd dist && zip -r blender28-bim-$(VERSION)-$(PLATFORM).zip ./*
|
||||||
rm -rf dist/blenderbim
|
rm -rf dist/blenderbim
|
||||||
|
|||||||
@@ -166,6 +166,9 @@ if bpy is not None:
|
|||||||
operator.BIMTesterPurge,
|
operator.BIMTesterPurge,
|
||||||
operator.SelectCobieIfcFile,
|
operator.SelectCobieIfcFile,
|
||||||
operator.ExecuteIfcCobie,
|
operator.ExecuteIfcCobie,
|
||||||
|
operator.SelectIfcPatchInput,
|
||||||
|
operator.SelectIfcPatchOutput,
|
||||||
|
operator.ExecuteIfcPatch,
|
||||||
prop.StrProperty,
|
prop.StrProperty,
|
||||||
prop.Variable,
|
prop.Variable,
|
||||||
prop.Role,
|
prop.Role,
|
||||||
@@ -226,6 +229,7 @@ if bpy is not None:
|
|||||||
ui.BIM_PT_gis,
|
ui.BIM_PT_gis,
|
||||||
ui.BIM_PT_diff,
|
ui.BIM_PT_diff,
|
||||||
ui.BIM_PT_cobie,
|
ui.BIM_PT_cobie,
|
||||||
|
ui.BIM_PT_patch,
|
||||||
ui.BIM_PT_mvd,
|
ui.BIM_PT_mvd,
|
||||||
ui.BIM_PT_material,
|
ui.BIM_PT_material,
|
||||||
ui.BIM_PT_mesh,
|
ui.BIM_PT_mesh,
|
||||||
|
|||||||
@@ -1338,6 +1338,23 @@ class ExecuteIfcCobie(bpy.types.Operator):
|
|||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
class ExecuteIfcPatch(bpy.types.Operator):
|
||||||
|
bl_idname = 'bim.execute_ifc_patch'
|
||||||
|
bl_label = 'Execute IFCPatch'
|
||||||
|
file_format: bpy.props.StringProperty()
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
import ifcpatch
|
||||||
|
ifcpatch.execute({
|
||||||
|
'input': bpy.context.scene.BIMProperties.ifc_patch_input,
|
||||||
|
'output': bpy.context.scene.BIMProperties.ifc_patch_output,
|
||||||
|
'recipe': bpy.context.scene.BIMProperties.ifc_patch_recipes,
|
||||||
|
'arguments': json.loads('[' + bpy.context.scene.BIMProperties.ifc_patch_args + ']'),
|
||||||
|
'log': bpy.context.scene.BIMProperties.data_dir + 'process.log'
|
||||||
|
})
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class SelectDiffJsonFile(bpy.types.Operator):
|
class SelectDiffJsonFile(bpy.types.Operator):
|
||||||
bl_idname = "bim.select_diff_json_file"
|
bl_idname = "bim.select_diff_json_file"
|
||||||
bl_label = "Select Diff JSON File"
|
bl_label = "Select Diff JSON File"
|
||||||
@@ -3267,3 +3284,33 @@ class BIMTesterPurge(bpy.types.Operator):
|
|||||||
bimtester.TestPurger().purge()
|
bimtester.TestPurger().purge()
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
class SelectIfcPatchInput(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.select_ifc_patch_input"
|
||||||
|
bl_label = "Select IFC Patch Input"
|
||||||
|
filter_glob: bpy.props.StringProperty(default="*.ifc", options={'HIDDEN'})
|
||||||
|
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
bpy.context.scene.BIMProperties.ifc_patch_input = self.filepath
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
def invoke(self, context, event):
|
||||||
|
context.window_manager.fileselect_add(self)
|
||||||
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
|
|
||||||
|
class SelectIfcPatchOutput(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.select_ifc_patch_output"
|
||||||
|
bl_label = "Select IFC Patch Output"
|
||||||
|
filename_ext = '.ifc'
|
||||||
|
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
bpy.context.scene.BIMProperties.ifc_patch_output = self.filepath
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
def invoke(self, context, event):
|
||||||
|
context.window_manager.fileselect_add(self)
|
||||||
|
return {'RUNNING_MODAL'}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ profiledef_enum = []
|
|||||||
classes_enum = []
|
classes_enum = []
|
||||||
types_enum = []
|
types_enum = []
|
||||||
availablematerialpsets_enum = []
|
availablematerialpsets_enum = []
|
||||||
|
ifcpatchrecipes_enum = []
|
||||||
featuresfiles_enum = []
|
featuresfiles_enum = []
|
||||||
scenarios_enum = []
|
scenarios_enum = []
|
||||||
psetnames_enum = []
|
psetnames_enum = []
|
||||||
@@ -173,6 +174,18 @@ def getAvailableMaterialPsets(self, context):
|
|||||||
return availablematerialpsets_enum
|
return availablematerialpsets_enum
|
||||||
|
|
||||||
|
|
||||||
|
def getIfcPatchRecipes(self, context):
|
||||||
|
global ifcpatchrecipes_enum
|
||||||
|
if len(ifcpatchrecipes_enum) < 1:
|
||||||
|
ifcpatchrecipes_enum.clear()
|
||||||
|
for filename in Path(os.path.join(cwd, '..', 'libs', 'site', 'packages', 'recipes')).glob('*.py'):
|
||||||
|
f = str(filename.stem)
|
||||||
|
if f == '__init__':
|
||||||
|
continue
|
||||||
|
ifcpatchrecipes_enum.append((f, f, ''))
|
||||||
|
return ifcpatchrecipes_enum
|
||||||
|
|
||||||
|
|
||||||
def getFeaturesFiles(self, context):
|
def getFeaturesFiles(self, context):
|
||||||
global featuresfiles_enum
|
global featuresfiles_enum
|
||||||
if len(featuresfiles_enum) < 1:
|
if len(featuresfiles_enum) < 1:
|
||||||
@@ -1070,6 +1083,10 @@ class BIMProperties(PropertyGroup):
|
|||||||
active_clash_set_index: IntProperty(name='Active Clash Set Index')
|
active_clash_set_index: IntProperty(name='Active Clash Set Index')
|
||||||
constraints: CollectionProperty(name='Constraints', type=Constraint)
|
constraints: CollectionProperty(name='Constraints', type=Constraint)
|
||||||
active_constraint_index: IntProperty(name='Active Constraint Index')
|
active_constraint_index: IntProperty(name='Active Constraint Index')
|
||||||
|
ifc_patch_recipes: EnumProperty(items=getIfcPatchRecipes, name="Recipes")
|
||||||
|
ifc_patch_input: StringProperty(default='', name='IFC Patch Input IFC')
|
||||||
|
ifc_patch_output: StringProperty(default='', name='IFC Patch Output IFC')
|
||||||
|
ifc_patch_args: StringProperty(default='', name='Arguments')
|
||||||
|
|
||||||
|
|
||||||
class BCFProperties(PropertyGroup):
|
class BCFProperties(PropertyGroup):
|
||||||
|
|||||||
@@ -1469,6 +1469,36 @@ class BIM_PT_cobie(Panel):
|
|||||||
op.file_format = 'xlsx'
|
op.file_format = 'xlsx'
|
||||||
|
|
||||||
|
|
||||||
|
class BIM_PT_patch(Panel):
|
||||||
|
bl_label = "IFC Patch"
|
||||||
|
bl_idname = "BIM_PT_patch"
|
||||||
|
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
|
||||||
|
|
||||||
|
scene = context.scene
|
||||||
|
props = scene.BIMProperties
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, 'ifc_patch_recipes')
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.prop(props, 'ifc_patch_input')
|
||||||
|
row.operator("bim.select_ifc_patch_input", icon="FILE_FOLDER", text="")
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.prop(props, 'ifc_patch_output')
|
||||||
|
row.operator("bim.select_ifc_patch_output", icon="FILE_FOLDER", text="")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, 'ifc_patch_args')
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
op = row.operator('bim.execute_ifc_patch')
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_mvd(Panel):
|
class BIM_PT_mvd(Panel):
|
||||||
bl_label = "Model View Definitions (MVD)"
|
bl_label = "Model View Definitions (MVD)"
|
||||||
bl_idname = "BIM_PT_mvd"
|
bl_idname = "BIM_PT_mvd"
|
||||||
|
|||||||
Reference in New Issue
Block a user