mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
You can now specify a target view when creating a new drawing. See #1153.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import blenderbim.core.drawing as subject
|
||||
from test.core.bootstrap import ifc, drawing
|
||||
from test.core.bootstrap import ifc, drawing, collector
|
||||
|
||||
|
||||
class TestEnableEditingText:
|
||||
@@ -137,3 +137,23 @@ class TestDisableEditingDrawings:
|
||||
def test_run(self, drawing):
|
||||
drawing.disable_editing_drawings().should_be_called()
|
||||
subject.disable_editing_drawings(drawing)
|
||||
|
||||
|
||||
class TestAddDrawing:
|
||||
def test_run(self, ifc, collector, drawing):
|
||||
drawing.ensure_unique_drawing_name("UNTITLED").should_be_called().will_return("name")
|
||||
drawing.generate_drawing_matrix("target_view", "location_hint").should_be_called().will_return("matrix")
|
||||
drawing.create_camera("name", "matrix").should_be_called().will_return("obj")
|
||||
drawing.run_assign_class_operator(
|
||||
obj="obj", ifc_class="IfcAnnotation", predefined_type="DRAWING"
|
||||
).should_be_called().will_return("element")
|
||||
ifc.run("group.add_group").should_be_called().will_return("group")
|
||||
ifc.run("group.edit_group", group="group", attributes={"Name": "name"}).should_be_called()
|
||||
ifc.run("group.assign_group", group="group", product="element").should_be_called()
|
||||
collector.assign("obj").should_be_called()
|
||||
ifc.run("pset.add_pset", product="element", name="EPset_Drawing").should_be_called().will_return("pset")
|
||||
ifc.run(
|
||||
"pset.edit_pset", pset="pset", properties={"TargetView": "target_view", "Scale": "1/100"}
|
||||
).should_be_called()
|
||||
drawing.import_drawings().should_be_called()
|
||||
subject.add_drawing(ifc, collector, drawing, target_view="target_view", location_hint="location_hint")
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
import os
|
||||
import bpy
|
||||
import mathutils
|
||||
import ifcopenshell
|
||||
import blenderbim.core.tool
|
||||
import blenderbim.tool as tool
|
||||
@@ -30,6 +31,17 @@ class TestImplementsTool(NewFile):
|
||||
assert isinstance(subject(), blenderbim.core.tool.Drawing)
|
||||
|
||||
|
||||
class TestCreateCamera(NewFile):
|
||||
def test_run(self):
|
||||
obj = subject.create_camera("Name", mathutils.Matrix())
|
||||
assert obj.name == "Name"
|
||||
assert obj.matrix_world == mathutils.Matrix()
|
||||
assert obj.data.type == "ORTHO"
|
||||
assert obj.data.ortho_scale == 50
|
||||
assert obj.data.clip_end == 10
|
||||
assert obj.users_collection[0] == bpy.context.scene.collection
|
||||
|
||||
|
||||
class TestCreateSvgSheet(NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
@@ -149,6 +161,11 @@ class TestGetSheetFilename(NewFile):
|
||||
subject.get_sheet_filename(document) == "X - FOOBAR"
|
||||
|
||||
|
||||
class TestGenerateDrawingMatrix(NewFile):
|
||||
def test_returning_the_origin_as_a_fallback(self):
|
||||
assert subject.generate_drawing_matrix("PLAN_VIEW", None) == mathutils.Matrix()
|
||||
|
||||
|
||||
class TestGenerateSheetIdentification(NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
@@ -266,6 +283,11 @@ class TestOpenSvg(NewFile):
|
||||
pass
|
||||
|
||||
|
||||
class TestRunAssignClassOperator(NewFile):
|
||||
def test_nothing(self):
|
||||
pass
|
||||
|
||||
|
||||
class TestUpdateTextValue(NewFile):
|
||||
def test_updating_arbitrary_strings(self):
|
||||
TestGetTextLiteral().test_run()
|
||||
|
||||
Reference in New Issue
Block a user