References for adding external svgs to the sheets

It works exactly the same as schedules - you add some .svg file, path to it stored in ifc and you can attach it to the sheet.

UI - https://i.imgur.com/tGbCGBb.png

Still need to add some tests for references
This commit is contained in:
Andrej730
2023-06-01 21:41:06 +05:00
parent 3c9f09f246
commit 0fd94d291b
11 changed files with 275 additions and 60 deletions
+7 -7
View File
@@ -159,7 +159,7 @@ class TestRemoveSheet:
class TestLoadSchedules:
def test_run(self, drawing):
drawing.import_schedules().should_be_called()
drawing.import_documents("SCHEDULE").should_be_called()
drawing.enable_editing_schedules().should_be_called()
subject.load_schedules(drawing)
@@ -182,8 +182,8 @@ class TestAddSchedule:
attributes={"Identification": "X", "Name": "UNTITLED", "Scope": "SCHEDULE"},
).should_be_called()
ifc.run("document.edit_reference", reference="reference", attributes={"Location": "uri"}).should_be_called()
drawing.import_schedules().should_be_called()
subject.add_schedule(ifc, drawing, uri="uri")
drawing.import_documents("SCHEDULE").should_be_called()
subject.add_document(ifc, drawing, "SCHEDULE", uri="uri")
def test_using_a_document_id_in_ifc2x3(self, ifc, drawing):
ifc.run("document.add_information").should_be_called().will_return("schedule")
@@ -196,15 +196,15 @@ class TestAddSchedule:
attributes={"DocumentId": "X", "Name": "UNTITLED", "Scope": "SCHEDULE"},
).should_be_called()
ifc.run("document.edit_reference", reference="reference", attributes={"Location": "uri"}).should_be_called()
drawing.import_schedules().should_be_called()
subject.add_schedule(ifc, drawing, uri="uri")
drawing.import_documents("SCHEDULE").should_be_called()
subject.add_document(ifc, drawing, "SCHEDULE", uri="uri")
class TestRemoveSchedule:
def test_run(self, ifc, drawing):
ifc.run("document.remove_information", information="schedule").should_be_called()
drawing.import_schedules().should_be_called()
subject.remove_schedule(ifc, drawing, schedule="schedule")
drawing.import_documents("SCHEDULE").should_be_called()
subject.remove_document(ifc, drawing, "SCHEDULE", document="schedule")
class TestOpenSchedule:
+2 -4
View File
@@ -479,7 +479,7 @@ class TestImportSchedules(NewFile):
tool.Ifc.set(ifc)
ifc.createIfcDocumentInformation(Identification="Y", Name="FOOBAZ")
document = ifc.createIfcDocumentInformation(Identification="X", Name="FOOBAR", Scope="SCHEDULE")
subject.import_schedules()
subject.import_documents("SCHEDULE")
props = bpy.context.scene.DocProperties
assert props.schedules[0].ifc_definition_id == document.id()
assert props.schedules[0].identification == "X"
@@ -490,7 +490,7 @@ class TestImportSchedules(NewFile):
tool.Ifc.set(ifc)
ifc.createIfcDocumentInformation(DocumentId="Y", Name="FOOBAZ")
document = ifc.createIfcDocumentInformation(DocumentId="X", Name="FOOBAR", Scope="SCHEDULE")
subject.import_schedules()
subject.import_documents("SCHEDULE")
props = bpy.context.scene.DocProperties
assert props.schedules[0].ifc_definition_id == document.id()
assert props.schedules[0].identification == "X"
@@ -778,5 +778,3 @@ class TestDrawingStyles(NewFile):
self.setup_project_with_drawing()
bpy.ops.bim.reload_drawing_styles()
assert len(self.drawing_styles) == 3