mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 06:18:09 +00:00
New FM module in BlenderBIM Add-on for interacting with IfcFM.
This commit is contained in:
@@ -199,6 +199,8 @@ endif
|
|||||||
cp -r dist/working/IfcOpenShell-0.7.0/src/ifcbimtester/bimtester dist/blenderbim/libs/site/packages/
|
cp -r dist/working/IfcOpenShell-0.7.0/src/ifcbimtester/bimtester dist/blenderbim/libs/site/packages/
|
||||||
# Provides IFCTester functionality
|
# Provides IFCTester functionality
|
||||||
cp -r dist/working/IfcOpenShell-0.7.0/src/ifctester/ifctester dist/blenderbim/libs/site/packages/
|
cp -r dist/working/IfcOpenShell-0.7.0/src/ifctester/ifctester dist/blenderbim/libs/site/packages/
|
||||||
|
# Provides IFCFM functionality
|
||||||
|
cp -r dist/working/IfcOpenShell-0.7.0/src/ifcfm/ifcfm dist/blenderbim/libs/site/packages/
|
||||||
# Provides IFCCOBie functionality
|
# Provides IFCCOBie functionality
|
||||||
cp -r dist/working/IfcOpenShell-0.7.0/src/ifccobie/* dist/blenderbim/libs/site/packages/
|
cp -r dist/working/IfcOpenShell-0.7.0/src/ifccobie/* dist/blenderbim/libs/site/packages/
|
||||||
# Provides IFCDiff functionality
|
# Provides IFCDiff functionality
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ modules = {
|
|||||||
"void": None,
|
"void": None,
|
||||||
"aggregate": None,
|
"aggregate": None,
|
||||||
"geometry": None,
|
"geometry": None,
|
||||||
|
"fm": None,
|
||||||
"cobie": None,
|
"cobie": None,
|
||||||
"resource": None,
|
"resource": None,
|
||||||
"cost": None,
|
"cost": None,
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||||
|
# Copyright (C) 2023 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of BlenderBIM Add-on.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
from . import ui, prop, operator
|
||||||
|
|
||||||
|
classes = (
|
||||||
|
operator.SelectFMIfcFile,
|
||||||
|
operator.ExecuteIfcFM,
|
||||||
|
prop.BIMFMProperties,
|
||||||
|
ui.BIM_PT_fm,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def register():
|
||||||
|
bpy.types.Scene.BIMFMProperties = bpy.props.PointerProperty(type=prop.BIMFMProperties)
|
||||||
|
|
||||||
|
|
||||||
|
def unregister():
|
||||||
|
del bpy.types.Scene.BIMFMProperties
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||||
|
# Copyright (C) 2023 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of BlenderBIM Add-on.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import bpy
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
import tempfile
|
||||||
|
import webbrowser
|
||||||
|
import ifcopenshell
|
||||||
|
import blenderbim.tool as tool
|
||||||
|
|
||||||
|
|
||||||
|
class SelectFMIfcFile(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.select_fm_ifc_file"
|
||||||
|
bl_label = "Select FM IFC File"
|
||||||
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
filename_ext = ".ifc"
|
||||||
|
filter_glob: bpy.props.StringProperty(default="*.ifc;*.ifczip;*.ifcxml", options={"HIDDEN"})
|
||||||
|
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
context.scene.BIMFMProperties.ifc_file = self.filepath
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
def invoke(self, context, event):
|
||||||
|
context.window_manager.fileselect_add(self)
|
||||||
|
return {"RUNNING_MODAL"}
|
||||||
|
|
||||||
|
|
||||||
|
class ExecuteIfcFM(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.execute_ifcfm"
|
||||||
|
bl_label = "Execute IfcFM"
|
||||||
|
file_format: bpy.props.StringProperty()
|
||||||
|
filter_glob: bpy.props.StringProperty(default="*.csv;*.ods;*.xlsx", options={"HIDDEN"})
|
||||||
|
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
props = context.scene.BIMFMProperties
|
||||||
|
return props.should_load_from_memory or props.ifc_file
|
||||||
|
|
||||||
|
def invoke(self, context, event):
|
||||||
|
props = context.scene.BIMFMProperties
|
||||||
|
self.filepath = bpy.path.ensure_ext(bpy.data.filepath, f".{props.format}")
|
||||||
|
WindowManager = context.window_manager
|
||||||
|
WindowManager.fileselect_add(self)
|
||||||
|
return {"RUNNING_MODAL"}
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
import ifcfm
|
||||||
|
|
||||||
|
props = context.scene.BIMFMProperties
|
||||||
|
ifc_file = tool.Ifc.get()
|
||||||
|
if not (ifc_file and props.should_load_from_memory):
|
||||||
|
ifc_file = ifcopenshell.open(props.ifc_file)
|
||||||
|
|
||||||
|
parser = ifcfm.Parser(preset=props.engine)
|
||||||
|
parser.parse(ifc_file)
|
||||||
|
writer = ifcfm.Writer(parser)
|
||||||
|
writer.write()
|
||||||
|
if props.format == "csv":
|
||||||
|
writer.write_csv('tmp/')
|
||||||
|
elif props.format == "ods":
|
||||||
|
writer.write_ods(self.filepath)
|
||||||
|
elif props.format == "xlsx":
|
||||||
|
writer.write_xlsx(self.filepath)
|
||||||
|
return {"FINISHED"}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||||
|
# Copyright (C) 2023 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of BlenderBIM Add-on.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import bpy
|
||||||
|
from bpy.types import PropertyGroup
|
||||||
|
from bpy.props import (
|
||||||
|
PointerProperty,
|
||||||
|
StringProperty,
|
||||||
|
EnumProperty,
|
||||||
|
BoolProperty,
|
||||||
|
IntProperty,
|
||||||
|
FloatProperty,
|
||||||
|
FloatVectorProperty,
|
||||||
|
CollectionProperty,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class BIMFMProperties(PropertyGroup):
|
||||||
|
ifc_file: StringProperty(default="", name="IFC File")
|
||||||
|
should_load_from_memory: BoolProperty(default=False, name="Load from Memory")
|
||||||
|
engine: EnumProperty(
|
||||||
|
items=[
|
||||||
|
("aohbsem", "AOH-BSEM", ""),
|
||||||
|
("basic", "Basic", ""),
|
||||||
|
("cobie", "COBie 2.4", ""),
|
||||||
|
("cobie3", "COBie 3", ""),
|
||||||
|
],
|
||||||
|
name="Engine",
|
||||||
|
default="cobie",
|
||||||
|
)
|
||||||
|
format: EnumProperty(
|
||||||
|
items=[
|
||||||
|
("csv", "csv", ""),
|
||||||
|
("xlsx", "xlsx", ""),
|
||||||
|
("ods", "ods", ""),
|
||||||
|
],
|
||||||
|
name="Format",
|
||||||
|
default="ods",
|
||||||
|
)
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||||
|
# Copyright (C) 2023 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of BlenderBIM Add-on.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import blenderbim.tool as tool
|
||||||
|
from bpy.types import Panel
|
||||||
|
from blenderbim.bim.ifc import IfcStore
|
||||||
|
|
||||||
|
|
||||||
|
class BIM_PT_fm(Panel):
|
||||||
|
bl_label = "Facility Management"
|
||||||
|
bl_idname = "BIM_PT_fm"
|
||||||
|
bl_space_type = "PROPERTIES"
|
||||||
|
bl_region_type = "WINDOW"
|
||||||
|
bl_context = "scene"
|
||||||
|
bl_parent_id = "BIM_PT_tab_handover"
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
layout.use_property_split = True
|
||||||
|
|
||||||
|
scene = context.scene
|
||||||
|
props = scene.BIMFMProperties
|
||||||
|
|
||||||
|
if IfcStore.get_file():
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, "should_load_from_memory")
|
||||||
|
|
||||||
|
if not IfcStore.get_file() or not props.should_load_from_memory:
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.prop(props, "ifc_file")
|
||||||
|
row.operator("bim.select_fm_ifc_file", icon="FILE_FOLDER", text="")
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, "engine")
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(props, "format")
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
op = row.operator("bim.execute_ifcfm", text="Convert To Spreadsheet")
|
||||||
Reference in New Issue
Block a user