mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
@@ -160,7 +160,8 @@ class SheetBuilder:
|
||||
x = float(image.attrib["x"])
|
||||
y = float(image.attrib["y"])
|
||||
if image.attrib["data-type"] == "view-title":
|
||||
image.attrib["x"] = str(x - readjust.x)
|
||||
image.attrib["x"] = str(x + readjust.x)
|
||||
# negate y offset because view-title comes AFTER foreground
|
||||
image.attrib["y"] = str(y - readjust.y)
|
||||
else:
|
||||
image.attrib["x"] = str(x + readjust.x)
|
||||
|
||||
@@ -677,6 +677,13 @@ class TestDrawingMaintainingSheetPosition(NewFile):
|
||||
ifc = tool.Ifc.get()
|
||||
sheet_path = Path.cwd() / "layouts" / "A00 - UNTITLED.svg"
|
||||
|
||||
bpy.ops.mesh.primitive_cube_add(size=10, location=(0, 0, 4))
|
||||
obj = bpy.data.objects["Cube"]
|
||||
bpy.ops.bim.assign_class(ifc_class="IfcActuator", predefined_type="ELECTRICACTUATOR", userdefined_type="")
|
||||
|
||||
def update_depsgraph():
|
||||
obj.hide_render = obj.hide_render # hacky way to trigger depsgraph_update_pre
|
||||
|
||||
bpy.ops.bim.load_sheets()
|
||||
bpy.ops.bim.add_sheet()
|
||||
|
||||
@@ -694,12 +701,21 @@ class TestDrawingMaintainingSheetPosition(NewFile):
|
||||
bpy.ops.bim.add_drawing_to_sheet()
|
||||
bpy.ops.bim.open_sheet()
|
||||
|
||||
# uncomment if debugging
|
||||
# without `sleep` `bim.open_sheet` tend to open sheet in browser
|
||||
# with PLAN_VIEW.svg that will be created only later
|
||||
# from time import sleep
|
||||
# sleep(0.1)
|
||||
|
||||
# check drawing default position
|
||||
drawing_data = self.get_sheet_drawing_data(sheet_path)
|
||||
assert drawing_data["foreground"] == (30.0, 30.0, 500.0, 500.0)
|
||||
assert drawing_data["view-title"] == (30.0, 535.0, 50.22, 10.0)
|
||||
|
||||
bpy.context.scene.camera.data.BIMCameraProperties.raster_x = 1200
|
||||
bpy.context.scene.camera.data.BIMCameraProperties.width = 25
|
||||
bpy.context.scene.camera.data.BIMCameraProperties.height = 25
|
||||
update_depsgraph()
|
||||
|
||||
bpy.ops.bim.create_drawing()
|
||||
bpy.ops.bim.open_sheet()
|
||||
|
||||
@@ -707,8 +723,8 @@ class TestDrawingMaintainingSheetPosition(NewFile):
|
||||
|
||||
# check drawing position on the sheet
|
||||
drawing_data = self.get_sheet_drawing_data(sheet_path)
|
||||
assert drawing_data["foreground"] == (30.0, 71.67, 500.0, 416.67)
|
||||
assert drawing_data["view-title"] == (30.0, 493.33, 50.22, 10.0)
|
||||
assert drawing_data["foreground"] == (155.0, 155.0, 250.0, 250.0)
|
||||
assert drawing_data["view-title"] == (155.0, 410.0, 50.22, 10.0)
|
||||
|
||||
|
||||
class TestUpdateTextValue(NewFile):
|
||||
|
||||
Reference in New Issue
Block a user