mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-06 12:26:26 +00:00
#1153 You can now add / remove / open schedules, implemented as IFC documents
This commit is contained in:
@@ -126,6 +126,71 @@ class TestRemoveSheet:
|
||||
subject.remove_sheet(ifc, drawing, sheet="sheet")
|
||||
|
||||
|
||||
class TestLoadSchedules:
|
||||
def test_run(self, drawing):
|
||||
drawing.import_schedules().should_be_called()
|
||||
drawing.enable_editing_schedules().should_be_called()
|
||||
subject.load_schedules(drawing)
|
||||
|
||||
|
||||
class TestDisableEditingSchedules:
|
||||
def test_run(self, drawing):
|
||||
drawing.disable_editing_schedules().should_be_called()
|
||||
subject.disable_editing_schedules(drawing)
|
||||
|
||||
|
||||
class TestAddSchedule:
|
||||
def test_run(self, ifc, drawing):
|
||||
ifc.run("document.add_information").should_be_called().will_return("schedule")
|
||||
ifc.run("document.add_reference", information="schedule").should_be_called().will_return("reference")
|
||||
ifc.get_schema().should_be_called().will_return("IFC4")
|
||||
ifc.run(
|
||||
"document.edit_information",
|
||||
information="schedule",
|
||||
attributes={"Identification": "X", "Name": "UNTITLED", "Scope": "SCHEDULE", "Location": "uri"},
|
||||
).should_be_called()
|
||||
drawing.import_schedules().should_be_called()
|
||||
subject.add_schedule(ifc, drawing, uri="uri")
|
||||
|
||||
def test_using_a_document_id_in_ifc2x3(self, ifc, drawing):
|
||||
ifc.run("document.add_information").should_be_called().will_return("schedule")
|
||||
ifc.run("document.add_reference", information="schedule").should_be_called().will_return("reference")
|
||||
ifc.get_schema().should_be_called().will_return("IFC2X3")
|
||||
ifc.run(
|
||||
"document.edit_information",
|
||||
information="schedule",
|
||||
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")
|
||||
|
||||
|
||||
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")
|
||||
|
||||
|
||||
class TestOpenSchedule:
|
||||
def test_run(self, drawing):
|
||||
drawing.get_schedule_location("schedule").should_be_called().will_return("uri")
|
||||
drawing.open_spreadsheet("uri").should_be_called()
|
||||
subject.open_schedule(drawing, schedule="schedule")
|
||||
|
||||
|
||||
class TestUpdateScheduleName:
|
||||
def test_do_not_update_if_name_unchanged(self, ifc, drawing):
|
||||
drawing.get_name("schedule").should_be_called().will_return("name")
|
||||
subject.update_drawing_name(ifc, drawing, schedule="schedule", name="name")
|
||||
|
||||
def test_run(self, ifc, drawing):
|
||||
drawing.get_name("schedule").should_be_called().will_return("oldname")
|
||||
ifc.run("document.edit_information", information="schedule", attributes={"Name": "name"}).should_be_called()
|
||||
subject.update_drawing_name(ifc, drawing, schedule="schedule", name="name")
|
||||
|
||||
|
||||
class TestLoadDrawings:
|
||||
def test_run(self, drawing):
|
||||
drawing.import_drawings().should_be_called()
|
||||
|
||||
@@ -60,8 +60,8 @@ class TestAddRepresentation:
|
||||
profile_set_usage="profile_set_usage",
|
||||
).should_be_called().will_return("representation")
|
||||
|
||||
# Styles are relevant for meshes with faces only
|
||||
geometry.does_object_have_mesh_with_faces("obj").should_be_called().will_return(True)
|
||||
# Styles are relevant for body representations only (as a simplification)
|
||||
geometry.is_body_representation("representation").should_be_called().will_return(True)
|
||||
|
||||
# Add styles
|
||||
geometry.get_object_materials_without_styles("obj").should_be_called().will_return(["material"])
|
||||
@@ -102,7 +102,7 @@ class TestAddRepresentation:
|
||||
== "representation"
|
||||
)
|
||||
|
||||
def test_not_handling_styles_if_representation_has_no_faces(self, ifc, geometry, style, surveyor):
|
||||
def test_not_handling_styles_if_not_a_body_representation(self, ifc, geometry, style, surveyor):
|
||||
TestEditObjectPlacement.predict(self, ifc, geometry, surveyor)
|
||||
|
||||
# Add representation
|
||||
@@ -126,8 +126,8 @@ class TestAddRepresentation:
|
||||
profile_set_usage="profile_set_usage",
|
||||
).should_be_called().will_return("representation")
|
||||
|
||||
# Styles are relevant for meshes with faces only
|
||||
geometry.does_object_have_mesh_with_faces("obj").should_be_called().will_return(False)
|
||||
# Styles are relevant for body representations only (as a simplification)
|
||||
geometry.is_body_representation("representation").should_be_called().will_return(False)
|
||||
|
||||
# Assign representation to product
|
||||
ifc.run("geometry.assign_representation", product="element", representation="representation").should_be_called()
|
||||
|
||||
Reference in New Issue
Block a user