Skip to content

Commit fe0a449

Browse files
Handle periodic splines properly
1 parent 6a94606 commit fe0a449

File tree

1 file changed

+5
-5
lines changed
  • cadquery/occ_impl/exporters

1 file changed

+5
-5
lines changed

cadquery/occ_impl/exporters/dxf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ def _dxf_spline(e: Edge, msp: ezdxf.layouts.Modelspace, plane: Plane):
7979
order = spline.Degree() + 1
8080
knots = list(spline.KnotSequence())
8181
poles = [(p.X(), p.Y(), p.Z()) for p in spline.Poles()]
82-
8382
weights = list(spline.Weights()) if spline.IsRational() else None
8483

85-
if spline.IsClosed():
86-
dxf_spline = ezdxf.math.BSplineClosed(poles, order, knots, weights)
87-
else:
88-
dxf_spline = ezdxf.math.BSpline(poles, order, knots, weights)
84+
if spline.IsPeriodic():
85+
pad = spline.NbKnots() - spline.LastUKnotIndex()
86+
poles += poles[:pad]
87+
88+
dxf_spline = ezdxf.math.BSpline(poles, order, knots, weights)
8989

9090
msp.add_spline().apply_construction_tool(dxf_spline)
9191

0 commit comments

Comments
 (0)