Skip to content

Commit fadc35c

Browse files
committed
Fixed contour test
1 parent daa3d37 commit fadc35c

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

mpldxf/backend_dxf.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -167,32 +167,33 @@ def _draw_mpl_lwpoly(self, gc, path, transform, obj):
167167

168168
# clip the polygon if clip rectangle present
169169

170-
if isinstance(vertices[0][0], float or np.float64):
171-
vertices = self._clip_mpl(gc, vertices, obj=obj)
172-
173-
else:
174-
vertices = [self._clip_mpl(gc, points, obj=obj) for points in vertices]
170+
if len(vertices) > 0:
171+
if isinstance(vertices[0][0], float or np.float64):
172+
vertices = self._clip_mpl(gc, vertices, obj=obj)
175173

176-
# if vertices.
177-
if len(vertices) == 0:
178-
entity = None
174+
else:
175+
vertices = [self._clip_mpl(gc, points, obj=obj) for points in vertices]
179176

180-
else:
181-
if isinstance(vertices[0][0], float or np.float64):
182-
if vertices[0][0] != 0:
183-
entity = self.modelspace.add_lwpolyline(
184-
points=vertices, close=False, dxfattribs=dxfattribs
185-
) # set close to false because it broke some arrows
186-
else:
187-
entity = None
177+
# if vertices.
178+
if len(vertices) == 0:
179+
entity = None
188180

189181
else:
190-
entity = [
191-
self.modelspace.add_lwpolyline(
192-
points=points, close=False, dxfattribs=dxfattribs
193-
)
194-
for points in vertices
195-
] # set close to false because it broke some arrows
182+
if isinstance(vertices[0][0], float or np.float64):
183+
if vertices[0][0] != 0:
184+
entity = self.modelspace.add_lwpolyline(
185+
points=vertices, close=False, dxfattribs=dxfattribs
186+
) # set close to false because it broke some arrows
187+
else:
188+
entity = None
189+
190+
else:
191+
entity = [
192+
self.modelspace.add_lwpolyline(
193+
points=points, close=False, dxfattribs=dxfattribs
194+
)
195+
for points in vertices
196+
] # set close to false because it broke some arrows
196197
return entity
197198

198199
def _draw_mpl_line2d(self, gc, path, transform):

0 commit comments

Comments
 (0)