@@ -171,24 +171,41 @@ def testDXF(self):
171
171
self .assertAlmostEqual (s4 .edges ().size (), s4_i .edges ().size ())
172
172
173
173
# test periodic spline
174
- w = cq . Workplane ().spline ([(1 , 1 ), (2 , 2 ), (3 , 2 ), (4 , 1 )], periodic = True )
175
- exporters .dxf .exportDXF (w , "res4 .dxf" )
174
+ w = Workplane ().spline ([(1 , 1 ), (2 , 2 ), (3 , 2 ), (3 , 1 )], periodic = True )
175
+ exporters .dxf .exportDXF (w , "res5 .dxf" )
176
176
177
- w_i = importers .importDXF ("res4 .dxf" )
177
+ w_i = importers .importDXF ("res5 .dxf" )
178
178
179
- self .assertAlmostEqual (w .val ().Length (), w_i .val ().Length (), 6 )
179
+ self .assertAlmostEqual (w .val ().Length (), w_i .wires (). val ().Length (), 6 )
180
180
181
181
# test rational spline
182
182
c = Edge .makeCircle (1 )
183
183
adaptor = c ._geomAdaptor ()
184
184
curve = GeomConvert .CurveToBSplineCurve_s (adaptor .Curve ().Curve ())
185
185
186
186
e = Workplane ().add (Edge (BRepBuilderAPI_MakeEdge (curve ).Shape ()))
187
- exporters .dxf .exportDXF (w , "res5.dxf" )
187
+ exporters .dxf .exportDXF (e , "res6.dxf" )
188
+
189
+ e_i = importers .importDXF ("res6.dxf" )
190
+
191
+ self .assertAlmostEqual (e .val ().Length (), e_i .wires ().val ().Length (), 6 )
192
+
193
+ # test non-planar section
194
+ s5 = (
195
+ Workplane ()
196
+ .spline ([(0 , 0 ), (1 , 0 ), (1 , 1 ), (0 , 1 )])
197
+ .close ()
198
+ .extrude (1 , both = True )
199
+ .translate ((- 3 , - 4 , 0 ))
200
+ )
201
+
202
+ s5 .plane = Plane (origin = (0 , 0.1 , 0.5 ), normal = (0.05 , 0.05 , 1 ))
203
+ s5 = s5 .section ()
204
+ exporters .dxf .exportDXF (s5 , "res7.dxf" )
188
205
189
- e_i = importers .importDXF ("res5 .dxf" )
206
+ s5_i = importers .importDXF ("res7 .dxf" )
190
207
191
- self .assertAlmostEqual (e .val ().Length (), e_i .val ().Length (), 6 )
208
+ self .assertAlmostEqual (s5 .val ().Area (), s5_i .val ().Area (), 4 )
192
209
193
210
def testTypeHandling (self ):
194
211
0 commit comments