|
9 | 9 |
|
10 | 10 | import pytest
|
11 | 11 | import svgelements
|
| 12 | +from OCP.BRepBuilderAPI import BRepBuilderAPI_Transform |
12 | 13 | from OCP.GC import GC_MakeArcOfCircle
|
13 | 14 | from OCP.Geom import Geom_Circle, Geom_Curve, Geom_Ellipse, Geom_TrimmedCurve
|
14 | 15 | from OCP.GeomAbs import GeomAbs_CurveType
|
15 |
| -from OCP.gp import gp_Ax2, gp_Circ, gp_Pnt, gp_Vec |
| 16 | +from OCP.gp import gp_Ax2, gp_Circ, gp_Pnt, gp_Trsf, gp_Vec |
16 | 17 | from OCP.TopoDS import TopoDS, TopoDS_Edge, TopoDS_Face, TopoDS_Shape, TopoDS_Wire
|
17 | 18 | from pytest import approx, raises
|
18 | 19 |
|
@@ -199,6 +200,22 @@ def test_trimmed_arc_to_cubics_reversed():
|
199 | 200 | assert svg_with_arcs[-1][-2:] == approx(svg_with_cubics_only[-1][-2:])
|
200 | 201 |
|
201 | 202 |
|
| 203 | +def test_arc_to_cubic_transformed(): |
| 204 | + edge = edge_from_curve(circle_curve(2)) |
| 205 | + |
| 206 | + t = gp_Trsf() |
| 207 | + t.SetTranslationPart(gp_Vec(8, 4, 0)) |
| 208 | + transformed_edge = TopoDS.Edge_s( |
| 209 | + BRepBuilderAPI_Transform(edge, t, False, False).Shape() |
| 210 | + ) |
| 211 | + |
| 212 | + cmd1 = next(edge_to_svg_path(edge, tolerance=0.1, use_arcs=False)) |
| 213 | + cmd2 = next(edge_to_svg_path(transformed_edge, tolerance=0.1, use_arcs=False)) |
| 214 | + assert cmd1[0] == "M" and cmd2[0] == "M" |
| 215 | + assert cmd2[1] == approx(cmd1[1] + 8) |
| 216 | + assert cmd2[2] == approx(cmd1[2] + 4) |
| 217 | + |
| 218 | + |
202 | 219 | @pytest.mark.parametrize(
|
203 | 220 | "wire, svg_d, opts",
|
204 | 221 | [
|
|
0 commit comments