mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-20 04:04:00 +00:00
document.assign_document - support batching #4474
This commit is contained in:
@@ -109,7 +109,7 @@ def remove_document(ifc, document_tool, document=None):
|
||||
|
||||
|
||||
def assign_document(ifc, product=None, document=None):
|
||||
ifc.run("document.assign_document", product=product, document=document)
|
||||
ifc.run("document.assign_document", products=[product], document=document)
|
||||
|
||||
|
||||
def unassign_document(ifc, product=None, document=None):
|
||||
|
||||
@@ -241,7 +241,7 @@ def add_drawing(ifc, collector, drawing, target_view=None, location_hint=None):
|
||||
attributes = {"Identification": "X", "Name": drawing_name, "Scope": "DRAWING"}
|
||||
ifc.run("document.edit_information", information=information, attributes=attributes)
|
||||
ifc.run("document.edit_reference", reference=reference, attributes={"Location": uri})
|
||||
ifc.run("document.assign_document", product=element, document=reference)
|
||||
ifc.run("document.assign_document", products=[element], document=reference)
|
||||
drawing.import_drawings()
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ def duplicate_drawing(ifc, drawing_tool, drawing=None, should_duplicate_annotati
|
||||
attributes = {"Identification": "X", "Name": drawing_name, "Scope": "DRAWING"}
|
||||
ifc.run("document.edit_information", information=information, attributes=attributes)
|
||||
ifc.run("document.edit_reference", reference=reference, attributes={"Location": uri})
|
||||
ifc.run("document.assign_document", product=new_drawing, document=reference)
|
||||
ifc.run("document.assign_document", products=[new_drawing], document=reference)
|
||||
|
||||
drawing_tool.import_drawings()
|
||||
return new_drawing
|
||||
|
||||
@@ -133,7 +133,7 @@ class TestRemoveDocument:
|
||||
|
||||
class TestAssignDocument:
|
||||
def test_run(self, ifc):
|
||||
ifc.run("document.assign_document", product="product", document="document").should_be_called()
|
||||
ifc.run("document.assign_document", products=["product"], document="document").should_be_called()
|
||||
subject.assign_document(ifc, product="product", document="document")
|
||||
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ class TestAddDrawing:
|
||||
attributes={"Identification": "X", "Name": "name", "Scope": "DRAWING"},
|
||||
).should_be_called()
|
||||
ifc.run("document.edit_reference", reference="reference", attributes={"Location": "uri"}).should_be_called()
|
||||
ifc.run("document.assign_document", product="element", document="reference").should_be_called()
|
||||
ifc.run("document.assign_document", products=["element"], document="reference").should_be_called()
|
||||
drawing.import_drawings().should_be_called()
|
||||
subject.add_drawing(ifc, collector, drawing, target_view="target_view", location_hint="location_hint")
|
||||
|
||||
@@ -405,7 +405,7 @@ class TestDuplicateDrawing:
|
||||
ifc.run(
|
||||
"document.edit_reference", reference="reference", attributes={"Location": "drawing_path"}
|
||||
).should_be_called()
|
||||
ifc.run("document.assign_document", product="new_drawing", document="reference").should_be_called()
|
||||
ifc.run("document.assign_document", products=["new_drawing"], document="reference").should_be_called()
|
||||
|
||||
drawing.import_drawings().should_be_called()
|
||||
subject.duplicate_drawing(ifc, drawing, drawing="drawing", should_duplicate_annotations=True)
|
||||
|
||||
Reference in New Issue
Block a user