#1153 You can now add / remove / open schedules, implemented as IFC documents

This commit is contained in:
Dion Moult
2022-04-28 14:16:39 +10:00
parent 9ea6499b5a
commit 3f28ae18c0
12 changed files with 305 additions and 61 deletions
+59
View File
@@ -87,6 +87,13 @@ class TestDisableEditingDrawings(NewFile):
assert bpy.context.scene.DocProperties.is_editing_drawings == False
class TestDisableEditingSchedules(NewFile):
def test_run(self):
bpy.context.scene.DocProperties.is_editing_schedules = True
subject.disable_editing_schedules()
assert bpy.context.scene.DocProperties.is_editing_schedules == False
class TestDisableEditingSheets(NewFile):
def test_run(self):
bpy.context.scene.DocProperties.is_editing_sheets = True
@@ -125,6 +132,13 @@ class TestEnableEditingDrawings(NewFile):
assert bpy.context.scene.DocProperties.is_editing_drawings == True
class TestEnableEditingSchedules(NewFile):
def test_run(self):
bpy.context.scene.DocProperties.is_editing_schedules = False
subject.enable_editing_schedules()
assert bpy.context.scene.DocProperties.is_editing_schedules == True
class TestEnableEditingSheets(NewFile):
def test_run(self):
bpy.context.scene.DocProperties.is_editing_sheets = False
@@ -263,6 +277,22 @@ class TestGetName(NewFile):
assert subject.get_name(ifc.createIfcWall(Name="Foobar")) == "Foobar"
class TestGetScheduleLocation(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcProject")
schedule = ifcopenshell.api.run("document.add_information", ifc)
schedule.Location = "uri"
reference = ifcopenshell.api.run("document.add_reference", ifc, information=schedule)
subject.get_schedule_location(schedule) == "uri"
def test_run_ifc2x3(self):
ifc = ifcopenshell.file(schema="IFC2X3")
reference = ifc.createIfcDocumentReference(Location="uri")
schedule = ifc.createIfcDocumentInformation(DocumentReferences=[reference])
subject.get_sheet_filename(schedule) == "uri"
class TestGetSheetFilename(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
@@ -408,6 +438,30 @@ class TestImportDrawings(NewFile):
assert props.drawings[0].target_view == "PLAN_VIEW"
class TestImportSchedules(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
ifc.createIfcDocumentInformation(Identification="Y", Name="FOOBAZ")
document = ifc.createIfcDocumentInformation(Identification="X", Name="FOOBAR", Scope="SCHEDULE")
subject.import_schedules()
props = bpy.context.scene.DocProperties
assert props.schedules[0].ifc_definition_id == document.id()
assert props.schedules[0].identification == "X"
assert props.schedules[0].name == "FOOBAR"
def test_run_ifc2x3(self):
ifc = ifcopenshell.file(schema="IFC2X3")
tool.Ifc.set(ifc)
ifc.createIfcDocumentInformation(DocumentId="Y", Name="FOOBAZ")
document = ifc.createIfcDocumentInformation(DocumentId="X", Name="FOOBAR", Scope="SCHEDULE")
subject.import_schedules()
props = bpy.context.scene.DocProperties
assert props.schedules[0].ifc_definition_id == document.id()
assert props.schedules[0].identification == "X"
assert props.schedules[0].name == "FOOBAR"
class TestImportSheets(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
@@ -475,6 +529,11 @@ class TestImportTextProduct(NewFile):
assert label_obj.BIMTextProperties.relating_product is None
class TestOpenSchedule(NewFile):
def open_spreadsheet(self):
pass
class TestOpenSvg(NewFile):
def test_nothing(self):
pass