#1153 Reimplement ability to build SVG tables from referenced ODS documents

This commit is contained in:
Dion Moult
2022-04-28 19:57:47 +10:00
parent 952d1c3b79
commit 6bcf00ef31
8 changed files with 65 additions and 48 deletions
+2 -2
View File
@@ -114,8 +114,8 @@ class TestAddSheet:
class TestOpenSheet:
def test_run(self, drawing):
drawing.get_sheet_filename("sheet").should_be_called().will_return("filename")
drawing.open_svg("filename").should_be_called()
drawing.get_document_uri("sheet").should_be_called().will_return("uri")
drawing.open_svg("uri").should_be_called()
subject.open_sheet(drawing, sheet="sheet")
+23 -14
View File
@@ -51,7 +51,7 @@ class TestCreateCamera(NewFile):
class TestCreateSvgSheet(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
document = ifc.createIfcDocumentInformation(Identification="X", Name="FOOBAR")
document = ifc.createIfcDocumentInformation(Identification="X", Name="FOOBAR", Scope="DOCUMENTATION")
subject.create_svg_sheet(document, "A1")
assert os.path.isfile(os.path.join(bpy.context.scene.BIMProperties.data_dir, "sheets", "X - FOOBAR.svg"))
@@ -221,6 +221,26 @@ class TestGetBodyContext(NewFile):
assert subject.get_body_context() == context
class TestGetDocumentUri(NewFile):
def test_get_sheet_uri(self):
ifc = ifcopenshell.file()
document = ifc.createIfcDocumentInformation(Identification="X", Name="FOOBAR", Scope="DOCUMENTATION")
result = subject.get_document_uri(document)
assert result == os.path.join(bpy.context.scene.BIMProperties.data_dir, "sheets", "X - FOOBAR.svg")
def test_get_schedule_uri(self):
ifc = ifcopenshell.file()
document = ifc.createIfcDocumentInformation(Identification="X", Name="FOOBAR", Scope="SCHEDULE")
result = subject.get_document_uri(document)
assert result == os.path.join(bpy.context.scene.BIMProperties.data_dir, "schedules", "X - FOOBAR.svg")
def test_run_ifc2x3(self):
ifc = ifcopenshell.file(schema="IFC2X3")
document = ifc.createIfcDocumentInformation(DocumentId="X", Name="FOOBAR", Scope="DOCUMENTATION")
result = subject.get_document_uri(document)
assert result == os.path.join(bpy.context.scene.BIMProperties.data_dir, "sheets", "X - FOOBAR.svg")
class TestGetDrawingCollection(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
@@ -288,21 +308,10 @@ class TestGetScheduleLocation(NewFile):
def test_run_ifc2x3(self):
ifc = ifcopenshell.file(schema="IFC2X3")
tool.Ifc.set(ifc)
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()
document = ifc.createIfcDocumentInformation(Identification="X", Name="FOOBAR", Scope="DOCUMENTATION")
subject.get_sheet_filename(document) == "X - FOOBAR"
def test_run_ifc2x3(self):
ifc = ifcopenshell.file(schema="IFC2X3")
document = ifc.createIfcDocumentInformation(DocumentId="X", Name="FOOBAR", Scope="DOCUMENTATION")
subject.get_sheet_filename(document) == "X - FOOBAR"
subject.get_schedule_location(schedule) == "uri"
class TestGenerateDrawingMatrix(NewFile):