mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 14:02:27 +00:00
Experimental support to proxy one shape for another in IFC
This commit is contained in:
@@ -58,6 +58,7 @@ classes = (
|
|||||||
operator.RemoveClassification,
|
operator.RemoveClassification,
|
||||||
operator.FetchLibraryInformation,
|
operator.FetchLibraryInformation,
|
||||||
operator.FetchExternalMaterial,
|
operator.FetchExternalMaterial,
|
||||||
|
operator.FetchObjectPassport,
|
||||||
prop.BIMProperties,
|
prop.BIMProperties,
|
||||||
prop.BIMLibrary,
|
prop.BIMLibrary,
|
||||||
prop.MapConversion,
|
prop.MapConversion,
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"blender": {
|
||||||
|
"uri": "high-res.blend",
|
||||||
|
"identification": "high-res"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -680,3 +680,29 @@ class FetchLibraryInformation(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
# TODO
|
# TODO
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
class FetchObjectPassport(bpy.types.Operator):
|
||||||
|
bl_idname = 'bim.fetch_object_passport'
|
||||||
|
bl_label = 'Fetch Object Passport'
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
for document in bpy.context.active_object.BIMObjectProperties.documents:
|
||||||
|
if not document.file[-6:] == '.opass':
|
||||||
|
continue
|
||||||
|
with open(os.path.join(bpy.context.scene.BIMProperties.data_dir, 'doc', document.file)) as f:
|
||||||
|
self.object_pass = json.load(f)
|
||||||
|
if 'blender' in self.object_pass:
|
||||||
|
self.fetch_blender()
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
def fetch_blender(self):
|
||||||
|
identification = self.object_pass['blender']['identification']
|
||||||
|
uri = os.path.join(bpy.context.scene.BIMProperties.data_dir,
|
||||||
|
'doc',
|
||||||
|
self.object_pass['blender']['uri'])
|
||||||
|
bpy.ops.wm.link(
|
||||||
|
filename=identification,
|
||||||
|
directory=os.path.join(uri, 'Mesh')
|
||||||
|
)
|
||||||
|
bpy.context.active_object.data = bpy.data.meshes[identification]
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ class BIM_PT_object(Panel):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.active_object is not None and hasattr(context.active_object, "BIMObjectProperties")
|
return context.active_object is not None and hasattr(context.active_object, "BIMObjectProperties")
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
|
|
||||||
if context.active_object is None:
|
if context.active_object is None:
|
||||||
return
|
return
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
@@ -55,6 +55,9 @@ class BIM_PT_object(Panel):
|
|||||||
row.prop(props, 'applicable_documents', text='')
|
row.prop(props, 'applicable_documents', text='')
|
||||||
row.operator('bim.add_document')
|
row.operator('bim.add_document')
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.operator('bim.fetch_object_passport')
|
||||||
|
|
||||||
for index, document in enumerate(props.documents):
|
for index, document in enumerate(props.documents):
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(document, 'file', text='')
|
row.prop(document, 'file', text='')
|
||||||
@@ -86,7 +89,7 @@ class BIM_PT_mesh(Panel):
|
|||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.active_object is not None and context.active_object.type == "MESH" and \
|
return context.active_object is not None and context.active_object.type == "MESH" and \
|
||||||
hasattr(context.active_object.data, "BIMMeshProperties")
|
hasattr(context.active_object.data, "BIMMeshProperties")
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not context.active_object.data:
|
if not context.active_object.data:
|
||||||
return
|
return
|
||||||
@@ -123,11 +126,11 @@ class BIM_PT_material(Panel):
|
|||||||
bl_space_type = 'PROPERTIES'
|
bl_space_type = 'PROPERTIES'
|
||||||
bl_region_type = 'WINDOW'
|
bl_region_type = 'WINDOW'
|
||||||
bl_context = 'material'
|
bl_context = 'material'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.active_object is not None and context.active_object.active_material is not None
|
return context.active_object is not None and context.active_object.active_material is not None
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not bpy.context.active_object.active_material:
|
if not bpy.context.active_object.active_material:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user