BBIM Feature to import resources data from CSV

This commit is contained in:
bosonprojets
2022-09-09 02:23:53 +01:00
parent 6d6b893db2
commit 4689cc858a
6 changed files with 38 additions and 15 deletions
@@ -48,6 +48,7 @@ classes = (
operator.DisableEditingResourceQuantity,
operator.DisableEditingResourceCostValue,
operator.CalculateResourceWork,
operator.ImportResources,
prop.Resource,
prop.BIMResourceProperties,
prop.BIMResourceTreeProperties,
@@ -330,3 +330,18 @@ class EditResourceQuantity(bpy.types.Operator, tool.Ifc.Operator):
tool.Resource, tool.Ifc, physical_quantity=tool.Ifc.get().by_id(self.physical_quantity)
)
class ImportResources(bpy.types.Operator, tool.Ifc.Operator, ImportHelper):
bl_idname = "import_resources.bim"
bl_label = "Import P6"
bl_options = {"REGISTER", "UNDO"}
filename_ext = ".csv"
filter_glob: bpy.props.StringProperty(default="*.csv", options={"HIDDEN"})
@classmethod
def poll(cls, context):
ifc_file = tool.Ifc.get()
return ifc_file is not None
def _execute(self, context):
core.import_resources(tool.Resource, file_path=self.filepath)
@@ -54,10 +54,12 @@ class BIM_PT_resources(Panel):
row.operator("bim.disable_resource_editing_ui", text="", icon="CANCEL")
else:
row.operator("bim.load_resources", text="Load Resources", icon="GREASEPENCIL")
row.operator("import_resources.bim", text="Import Resources", icon="IMPORT")
if not self.props.is_editing:
return
self.draw_resource_operators()
self.layout.template_list(
"BIM_UL_resources",
"",
+1
View File
@@ -427,6 +427,7 @@ class Resource:
def get_resource_quantity_attributes(cls): pass
def expand_resource(cls, resource): pass
def contract_resource(cls, resource): pass
def import_resources(cls, file_path): pass
@interface
class Root: