2019-09-26 21:55:30 +10:00
|
|
|
bl_info = {
|
2019-11-17 12:29:02 +11:00
|
|
|
"name": "BlenderBIM",
|
|
|
|
|
"description": "Author, import, and export files in the "
|
2019-09-26 21:55:30 +10:00
|
|
|
"Industry Foundation Classes (.ifc) file format",
|
|
|
|
|
"author": "Dion Moult, IfcOpenShell",
|
|
|
|
|
"blender": (2, 80, 0),
|
2019-11-17 12:40:14 +11:00
|
|
|
"version": (0, 0, 999999),
|
2019-11-17 12:29:02 +11:00
|
|
|
"location": "File > Export, File > Import, Scene / Object / Material / Mesh Properties",
|
2019-09-26 21:55:30 +10:00
|
|
|
"tracker_url": "https://sourceforge.net/p/ifcopenshell/"
|
|
|
|
|
"_list/tickets?source=navbar",
|
2019-10-07 21:11:11 +11:00
|
|
|
"category": "Import-Export"
|
|
|
|
|
}
|
2019-09-26 21:55:30 +10:00
|
|
|
|
2019-12-19 15:31:00 +11:00
|
|
|
# Check if we are running in Blender before loading, to allow for multiprocessing
|
2019-12-13 17:25:52 +11:00
|
|
|
import sys
|
2019-12-19 15:31:00 +11:00
|
|
|
import os
|
2019-12-13 17:25:52 +11:00
|
|
|
bpy = sys.modules.get('bpy')
|
2019-12-19 15:31:00 +11:00
|
|
|
|
2019-12-13 17:25:52 +11:00
|
|
|
if bpy is not None:
|
2019-12-19 15:31:00 +11:00
|
|
|
cwd = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
|
# This workaround is for Mac and Linux Conda builds, which have an rpath set
|
|
|
|
|
# to $ORIGIN/../../../
|
|
|
|
|
lib_dir = os.path.join(cwd, '..', 'lib')
|
|
|
|
|
if os.path.isdir(lib_dir):
|
|
|
|
|
import shutil
|
|
|
|
|
files = os.listdir(lib_dir)
|
|
|
|
|
for f in files:
|
2019-12-19 16:49:27 +11:00
|
|
|
shutil.move(os.path.join(lib_dir, f), os.path.join(lib_dir, '..', '..', '..'))
|
2019-12-19 15:31:00 +11:00
|
|
|
|
2019-12-13 17:25:52 +11:00
|
|
|
import bpy
|
|
|
|
|
from . import ui, prop, operator
|
2019-09-26 21:55:30 +10:00
|
|
|
|
2019-12-13 17:25:52 +11:00
|
|
|
classes = (
|
|
|
|
|
operator.AssignClass,
|
|
|
|
|
operator.SelectClass,
|
|
|
|
|
operator.SelectType,
|
|
|
|
|
operator.SelectFeaturesDir,
|
|
|
|
|
operator.SelectDiffJsonFile,
|
2020-01-07 14:27:34 +11:00
|
|
|
operator.SelectDiffNewFile,
|
|
|
|
|
operator.SelectDiffOldFile,
|
2019-12-13 17:25:52 +11:00
|
|
|
operator.SelectDataDir,
|
|
|
|
|
operator.SelectSchemaDir,
|
2020-01-29 11:42:43 +11:00
|
|
|
operator.SelectIfcFile,
|
2019-12-13 17:25:52 +11:00
|
|
|
operator.ExportIFC,
|
|
|
|
|
operator.ImportIFC,
|
|
|
|
|
operator.ColourByClass,
|
|
|
|
|
operator.ResetObjectColours,
|
|
|
|
|
operator.ApproveClass,
|
|
|
|
|
operator.RejectClass,
|
|
|
|
|
operator.SelectAudited,
|
|
|
|
|
operator.RejectElement,
|
|
|
|
|
operator.SelectExternalMaterialDir,
|
|
|
|
|
operator.AddSweptSolid,
|
|
|
|
|
operator.RemoveSweptSolid,
|
|
|
|
|
operator.AssignSweptSolidOuterCurve,
|
|
|
|
|
operator.SelectSweptSolidOuterCurve,
|
|
|
|
|
operator.AddSweptSolidInnerCurve,
|
|
|
|
|
operator.SelectSweptSolidInnerCurves,
|
|
|
|
|
operator.AssignSweptSolidExtrusion,
|
|
|
|
|
operator.SelectSweptSolidExtrusion,
|
|
|
|
|
operator.AssignPset,
|
|
|
|
|
operator.UnassignPset,
|
|
|
|
|
operator.AddPset,
|
|
|
|
|
operator.RemovePset,
|
2020-01-15 17:17:03 +11:00
|
|
|
operator.AddOverridePset,
|
|
|
|
|
operator.RemoveOverridePset,
|
2020-01-12 20:45:55 +11:00
|
|
|
operator.AddMaterialPset,
|
|
|
|
|
operator.RemoveMaterialPset,
|
2019-12-13 17:25:52 +11:00
|
|
|
operator.AddDocument,
|
|
|
|
|
operator.RemoveDocument,
|
|
|
|
|
operator.GenerateGlobalId,
|
|
|
|
|
operator.AddAttribute,
|
|
|
|
|
operator.RemoveAttribute,
|
2020-01-14 15:38:22 +11:00
|
|
|
operator.AddMaterialAttribute,
|
|
|
|
|
operator.RemoveMaterialAttribute,
|
2019-12-13 17:25:52 +11:00
|
|
|
operator.QuickProjectSetup,
|
|
|
|
|
operator.SelectGlobalId,
|
2020-02-19 17:24:01 +11:00
|
|
|
operator.SelectAttribute,
|
2020-02-20 17:31:38 +11:00
|
|
|
operator.SelectPset,
|
2019-12-13 17:25:52 +11:00
|
|
|
operator.CreateAggregate,
|
|
|
|
|
operator.EditAggregate,
|
|
|
|
|
operator.SaveAggregate,
|
2020-01-08 15:58:39 +11:00
|
|
|
operator.ExplodeAggregate,
|
2019-12-13 17:25:52 +11:00
|
|
|
operator.AssignClassification,
|
|
|
|
|
operator.UnassignClassification,
|
|
|
|
|
operator.RemoveClassification,
|
|
|
|
|
operator.FetchLibraryInformation,
|
|
|
|
|
operator.FetchExternalMaterial,
|
|
|
|
|
operator.FetchObjectPassport,
|
|
|
|
|
operator.AddSubcontext,
|
|
|
|
|
operator.RemoveSubcontext,
|
|
|
|
|
operator.CutSection,
|
|
|
|
|
operator.CreateSheets,
|
2019-12-20 10:43:39 +11:00
|
|
|
operator.GenerateDigitalTwin,
|
2020-01-06 11:46:42 +11:00
|
|
|
operator.CreateView,
|
2020-01-06 14:30:44 +11:00
|
|
|
operator.ActivateView,
|
2020-01-07 14:27:34 +11:00
|
|
|
operator.ExecuteIfcDiff,
|
2020-01-08 16:58:59 +11:00
|
|
|
operator.AssignContext,
|
2020-02-01 22:49:35 +11:00
|
|
|
operator.SetViewPreset1,
|
2019-12-13 17:25:52 +11:00
|
|
|
prop.Subcontext,
|
|
|
|
|
prop.BIMProperties,
|
|
|
|
|
prop.DocProperties,
|
|
|
|
|
prop.BIMLibrary,
|
|
|
|
|
prop.MapConversion,
|
|
|
|
|
prop.TargetCRS,
|
|
|
|
|
prop.Attribute,
|
2020-01-19 18:41:57 +11:00
|
|
|
prop.BoundaryCondition,
|
2019-12-13 17:25:52 +11:00
|
|
|
prop.Pset,
|
|
|
|
|
prop.Document,
|
|
|
|
|
prop.Classification,
|
|
|
|
|
prop.GlobalId,
|
|
|
|
|
prop.BIMObjectProperties,
|
|
|
|
|
prop.BIMMaterialProperties,
|
|
|
|
|
prop.SweptSolid,
|
|
|
|
|
prop.BIMMeshProperties,
|
2020-01-06 11:46:42 +11:00
|
|
|
prop.BIMCameraProperties,
|
2019-12-13 17:25:52 +11:00
|
|
|
ui.BIM_PT_documentation,
|
|
|
|
|
ui.BIM_PT_bim,
|
2020-02-19 17:24:01 +11:00
|
|
|
ui.BIM_PT_search,
|
2020-01-03 15:53:57 +11:00
|
|
|
ui.BIM_PT_owner,
|
2019-12-13 17:25:52 +11:00
|
|
|
ui.BIM_PT_context,
|
|
|
|
|
ui.BIM_PT_qa,
|
|
|
|
|
ui.BIM_PT_library,
|
|
|
|
|
ui.BIM_PT_gis,
|
|
|
|
|
ui.BIM_PT_diff,
|
|
|
|
|
ui.BIM_PT_mvd,
|
|
|
|
|
ui.BIM_PT_material,
|
|
|
|
|
ui.BIM_PT_mesh,
|
|
|
|
|
ui.BIM_PT_object,
|
2020-01-06 11:46:42 +11:00
|
|
|
ui.BIM_PT_camera,
|
2019-12-13 17:25:52 +11:00
|
|
|
)
|
2019-09-26 21:55:30 +10:00
|
|
|
|
2019-12-13 17:25:52 +11:00
|
|
|
def menu_func_export(self, context):
|
|
|
|
|
self.layout.operator(operator.ExportIFC.bl_idname,
|
|
|
|
|
text="Industry Foundation Classes (.ifc)")
|
2019-10-07 21:11:11 +11:00
|
|
|
|
2019-12-13 17:25:52 +11:00
|
|
|
def menu_func_import(self, context):
|
|
|
|
|
self.layout.operator(operator.ImportIFC.bl_idname,
|
|
|
|
|
text="Industry Foundation Classes (.ifc)")
|
2019-10-08 23:05:27 +11:00
|
|
|
|
2019-12-19 16:49:27 +11:00
|
|
|
def on_register(scene):
|
|
|
|
|
prop.setDefaultProperties(scene)
|
|
|
|
|
bpy.app.handlers.scene_update_post.remove(on_register)
|
|
|
|
|
|
2019-12-13 17:25:52 +11:00
|
|
|
def register():
|
|
|
|
|
for cls in classes:
|
|
|
|
|
bpy.utils.register_class(cls)
|
2019-12-19 16:49:27 +11:00
|
|
|
bpy.app.handlers.depsgraph_update_post.append(on_register)
|
2019-12-13 17:25:52 +11:00
|
|
|
bpy.app.handlers.load_post.append(prop.setDefaultProperties)
|
|
|
|
|
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
|
|
|
|
|
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
|
|
|
|
|
bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=prop.BIMProperties)
|
|
|
|
|
bpy.types.Scene.DocProperties = bpy.props.PointerProperty(type=prop.DocProperties)
|
|
|
|
|
bpy.types.Scene.BIMLibrary = bpy.props.PointerProperty(type=prop.BIMLibrary)
|
|
|
|
|
bpy.types.Scene.MapConversion = bpy.props.PointerProperty(type=prop.MapConversion)
|
|
|
|
|
bpy.types.Scene.TargetCRS = bpy.props.PointerProperty(type=prop.TargetCRS)
|
|
|
|
|
bpy.types.Object.BIMObjectProperties = bpy.props.PointerProperty(type=prop.BIMObjectProperties)
|
|
|
|
|
bpy.types.Collection.BIMObjectProperties = bpy.props.PointerProperty(type=prop.BIMObjectProperties)
|
|
|
|
|
bpy.types.Material.BIMMaterialProperties = bpy.props.PointerProperty(type=prop.BIMMaterialProperties)
|
|
|
|
|
bpy.types.Mesh.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties)
|
2020-01-06 11:46:42 +11:00
|
|
|
bpy.types.Camera.BIMCameraProperties = bpy.props.PointerProperty(type=prop.BIMCameraProperties)
|
2019-09-26 21:55:30 +10:00
|
|
|
|
2019-12-13 17:25:52 +11:00
|
|
|
def unregister():
|
|
|
|
|
for cls in reversed(classes):
|
|
|
|
|
bpy.utils.unregister_class(cls)
|
|
|
|
|
bpy.app.handlers.load_post.remove(prop.setDefaultProperties)
|
|
|
|
|
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
|
|
|
|
|
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
|
|
|
|
|
del(bpy.types.Scene.BIMProperties)
|
|
|
|
|
del(bpy.types.Scene.DocProperties)
|
|
|
|
|
del(bpy.types.Scene.MapConversion)
|
|
|
|
|
del(bpy.types.Scene.TargetCRS)
|
|
|
|
|
del(bpy.types.Object.BIMObjectProperties)
|
|
|
|
|
del(bpy.types.Collection.BIMObjectProperties)
|
|
|
|
|
del(bpy.types.Material.BIMMaterialProperties)
|
|
|
|
|
del(bpy.types.Mesh.BIMMeshProperties)
|
2020-01-06 11:46:42 +11:00
|
|
|
del(bpy.types.Mesh.BIMCameraProperties)
|
2019-09-26 21:55:30 +10:00
|
|
|
|
2019-12-13 17:25:52 +11:00
|
|
|
if __name__ == "__main__":
|
|
|
|
|
register()
|