mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Partial implementation of project library information
This commit is contained in:
@@ -56,7 +56,9 @@ classes = (
|
||||
operator.AssignClassification,
|
||||
operator.UnassignClassification,
|
||||
operator.RemoveClassification,
|
||||
operator.FetchLibraryInformation,
|
||||
prop.BIMProperties,
|
||||
prop.BIMLibrary,
|
||||
prop.MapConversion,
|
||||
prop.TargetCRS,
|
||||
prop.Attribute,
|
||||
@@ -70,6 +72,7 @@ classes = (
|
||||
prop.BIMMeshProperties,
|
||||
ui.BIM_PT_bim,
|
||||
ui.BIM_PT_qa,
|
||||
ui.BIM_PT_library,
|
||||
ui.BIM_PT_gis,
|
||||
ui.BIM_PT_diff,
|
||||
ui.BIM_PT_mvd,
|
||||
|
||||
@@ -168,6 +168,7 @@ class IfcParser():
|
||||
self.resolve_boolean_modifiers()
|
||||
self.map_conversion = self.get_map_conversion()
|
||||
self.target_crs = self.get_target_crs()
|
||||
self.library_information = self.get_library_information()
|
||||
self.spatial_structure_elements_tree = self.get_spatial_structure_elements_tree(
|
||||
self.project['raw'].children, self.collection_name_filter)
|
||||
|
||||
@@ -577,6 +578,21 @@ class IfcParser():
|
||||
}
|
||||
}
|
||||
|
||||
def get_library_information(self):
|
||||
scene = bpy.context.scene
|
||||
if not scene.BIMProperties.has_library:
|
||||
return {}
|
||||
return {
|
||||
'ifc': None,
|
||||
'attributes': {
|
||||
'Name': scene.BIMLibrary.name,
|
||||
'Version': scene.BIMLibrary.version,
|
||||
'VersionDate': scene.BIMLibrary.version_date,
|
||||
'Location': scene.BIMLibrary.location,
|
||||
'Description': scene.BIMLibrary.description
|
||||
}
|
||||
}
|
||||
|
||||
def get_spatial_structure_elements(self):
|
||||
elements = []
|
||||
for collection in bpy.data.collections:
|
||||
@@ -849,6 +865,7 @@ class IfcExporter():
|
||||
self.create_units()
|
||||
self.create_people()
|
||||
self.create_organisations()
|
||||
self.create_library_information()
|
||||
self.create_rep_context()
|
||||
self.create_project()
|
||||
self.create_documents()
|
||||
@@ -980,6 +997,12 @@ class IfcExporter():
|
||||
results.append(self.file.create_entity('IfcTelecomAddress', **address))
|
||||
return results
|
||||
|
||||
def create_library_information(self):
|
||||
information = self.ifc_parser.library_information
|
||||
if not information:
|
||||
return
|
||||
# TODO
|
||||
|
||||
def create_documents(self):
|
||||
for document in self.ifc_parser.documents.values():
|
||||
document['ifc'] = self.file.create_entity(
|
||||
|
||||
@@ -614,6 +614,7 @@ class AssignClassification(bpy.types.Operator):
|
||||
classification.identification = bpy.context.scene.BIMProperties.reference
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class UnassignClassification(bpy.types.Operator):
|
||||
bl_idname = 'bim.unassign_classification'
|
||||
bl_label = 'Unassign Classification'
|
||||
@@ -627,6 +628,7 @@ class UnassignClassification(bpy.types.Operator):
|
||||
obj.BIMObjectProperties.classification = ''
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class RemoveClassification(bpy.types.Operator):
|
||||
bl_idname = 'bim.remove_classification'
|
||||
bl_label = 'Remove Classification'
|
||||
@@ -635,3 +637,12 @@ class RemoveClassification(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
bpy.context.active_object.BIMObjectProperties.classifications.remove(self.classification_index)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class FetchLibraryInformation(bpy.types.Operator):
|
||||
bl_idname = 'bim.fetch_library_information'
|
||||
bl_label = 'Fetch Library Information'
|
||||
|
||||
def execute(self, context):
|
||||
# TODO
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -127,7 +127,6 @@ def getApplicableDocuments(self, context):
|
||||
|
||||
|
||||
class BIMProperties(PropertyGroup):
|
||||
|
||||
schema_dir: StringProperty(default=os.path.join(cwd ,'schema') + os.path.sep, name="Schema Directory")
|
||||
data_dir: StringProperty(default=os.path.join(cwd, 'data') + os.path.sep, name="Data Directory")
|
||||
ifc_class: EnumProperty(items=getIfcClasses, name="Class", update=refreshPredefinedTypes)
|
||||
@@ -144,6 +143,7 @@ class BIMProperties(PropertyGroup):
|
||||
pset_name: EnumProperty(items=getPsetNames, name="Pset Name", update=refreshPsetFiles)
|
||||
pset_file: EnumProperty(items=getPsetFiles, name="Pset File")
|
||||
has_georeferencing: BoolProperty(name="Has Georeferencing", default=False)
|
||||
has_library: BoolProperty(name="Has Project Library", default=False)
|
||||
global_id: StringProperty(name="GlobalId")
|
||||
features_dir: StringProperty(default='', name="Features Directory")
|
||||
diff_json_file: StringProperty(default='', name="Diff JSON File")
|
||||
@@ -169,6 +169,15 @@ class TargetCRS(PropertyGroup):
|
||||
map_zone: StringProperty(name="Map Zone")
|
||||
map_unit: StringProperty(name="Map Unit")
|
||||
|
||||
class BIMLibrary(PropertyGroup):
|
||||
name: StringProperty(name="Name")
|
||||
version: StringProperty(name="Version")
|
||||
publisher: StringProperty(name="Publisher")
|
||||
version_date: StringProperty(name="Version Date")
|
||||
location: StringProperty(name="Location")
|
||||
description: StringProperty(name="Description")
|
||||
|
||||
|
||||
class Attribute(PropertyGroup):
|
||||
name: StringProperty(name="Name")
|
||||
data_type: StringProperty(name="Data Type")
|
||||
|
||||
@@ -299,6 +299,29 @@ class BIM_PT_qa(Panel):
|
||||
row = layout.row()
|
||||
row.operator("bim.select_audited")
|
||||
|
||||
class BIM_PT_library(Panel):
|
||||
bl_label = "BIM Server Library"
|
||||
bl_idname = "BIM_PT_library"
|
||||
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
|
||||
bim_properties = scene.BIMProperties
|
||||
|
||||
layout.row().prop(scene.BIMProperties, 'has_georeferencing')
|
||||
|
||||
layout.label(text="Project Library:")
|
||||
layout.row().prop(scene.BIMLibrary, 'location')
|
||||
layout.row().operator("bim.fetch_library_information")
|
||||
layout.row().prop(scene.BIMLibrary, 'name')
|
||||
layout.row().prop(scene.BIMLibrary, 'version')
|
||||
layout.row().prop(scene.BIMLibrary, 'version_date')
|
||||
layout.row().prop(scene.BIMLibrary, 'description')
|
||||
|
||||
class BIM_PT_diff(Panel):
|
||||
bl_label = "IFC Diff"
|
||||
|
||||
Reference in New Issue
Block a user