mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
You can now import work schedules from csv
This commit is contained in:
@@ -81,6 +81,7 @@ classes = (
|
||||
operator.GenerateGanttChart,
|
||||
operator.GuessDateRange,
|
||||
operator.ImportMSP,
|
||||
operator.ImportCSV,
|
||||
operator.ImportP6,
|
||||
operator.ImportP6XER,
|
||||
operator.ImportPP,
|
||||
@@ -148,6 +149,7 @@ def menu_func_export(self, context):
|
||||
|
||||
|
||||
def menu_func_import(self, context):
|
||||
self.layout.operator(operator.ImportCSV.bl_idname, text="Work Schedule (.csv)")
|
||||
self.layout.operator(operator.ImportP6.bl_idname, text="P6 (.xml)")
|
||||
self.layout.operator(operator.ImportP6XER.bl_idname, text="P6 (.xer)")
|
||||
self.layout.operator(operator.ImportPP.bl_idname, text="Powerproject (.pp)")
|
||||
|
||||
@@ -527,6 +527,31 @@ class DisableEditingWorkCalendar(bpy.types.Operator):
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class ImportCSV(bpy.types.Operator, tool.Ifc.Operator, ImportHelper):
|
||||
bl_idname = "import_csv.bim"
|
||||
bl_label = "Import CSV"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
filename_ext = ".csv"
|
||||
filter_glob: bpy.props.StringProperty(default="*.csv", options={"HIDDEN"})
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ifc_file = IfcStore.get_file()
|
||||
return ifc_file is not None
|
||||
|
||||
def execute(self, context):
|
||||
from ifc4d.csv4d2ifc import Csv2Ifc
|
||||
|
||||
self.file = tool.Ifc.get()
|
||||
start = time.time()
|
||||
csv2ifc = Csv2Ifc()
|
||||
csv2ifc.csv = self.filepath
|
||||
csv2ifc.file = self.file
|
||||
csv2ifc.execute()
|
||||
print("Imported in %s seconds" % (time.time() - start))
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class ImportP6(bpy.types.Operator, ImportHelper):
|
||||
bl_idname = "import_p6.bim"
|
||||
bl_label = "Import P6"
|
||||
|
||||
Reference in New Issue
Block a user