Skip to content

Commit 1fcd5e2

Browse files
committed
Tidy
1 parent f973c50 commit 1fcd5e2

File tree

1 file changed

+17
-33
lines changed

1 file changed

+17
-33
lines changed

mpldxf/backend_dxf.py

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,25 @@
3535
"""
3636

3737
from __future__ import absolute_import, division, print_function, unicode_literals
38-
from io import BytesIO, StringIO
39-
import os
40-
import sys
38+
4139
import math
40+
import os
4241
import re
42+
import sys
43+
from io import StringIO
4344

44-
import matplotlib
45+
import ezdxf
46+
import numpy as np
47+
from ezdxf.enums import TextEntityAlignment
48+
from ezdxf.math.clipping import ClippingRect2d
4549
from matplotlib.backend_bases import (
46-
RendererBase,
4750
FigureCanvasBase,
48-
GraphicsContextBase,
4951
FigureManagerBase,
52+
GraphicsContextBase,
53+
RendererBase,
5054
)
5155
from matplotlib.transforms import Affine2D
52-
import matplotlib.transforms as transforms
53-
import matplotlib.collections as mplc
54-
import numpy as np
5556
from shapely.geometry import LineString, Polygon
56-
import ezdxf
57-
from ezdxf.enums import TextEntityAlignment
58-
from ezdxf.math.clipping import Clipping, ClippingRect2d, ConvexClippingPolygon2d
5957

6058
from . import dxf_colors
6159

@@ -192,11 +190,7 @@ def _clip_and_add_mpl_lwpoly(self, gc, dxfattribs, vertices, obj):
192190
else:
193191
vertices = [self._clip_mpl(gc, points, obj=obj) for points in vertices]
194192

195-
# if vertices.
196-
if len(vertices) == 0:
197-
entity = None
198-
199-
else:
193+
if len(vertices) > 0:
200194
if isinstance(vertices[0][0], float or np.float64):
201195
if vertices[0][0] != 0:
202196
entity = self.modelspace.add_lwpolyline(
@@ -212,7 +206,12 @@ def _clip_and_add_mpl_lwpoly(self, gc, dxfattribs, vertices, obj):
212206
)
213207
for points in vertices
214208
] # set close to false because it broke some arrows
215-
return entity
209+
else:
210+
entity = None
211+
else:
212+
entity = None
213+
214+
return entity
216215

217216
def _draw_mpl_line2d(self, gc, path, transform):
218217
line = self._draw_mpl_lwpoly(gc, path, transform, obj="line2d")
@@ -492,21 +491,6 @@ def new_gc(self):
492491
def points_to_pixels(self, points):
493492
return points / 72.0 * self.dpi
494493

495-
def draw_quad_mesh(
496-
self,
497-
gc,
498-
master_transform,
499-
meshWidth,
500-
meshHeight,
501-
coordinates,
502-
offsets,
503-
offsetTrans,
504-
facecolors,
505-
antialiased,
506-
edgecolors,
507-
):
508-
pass
509-
510494

511495
class FigureCanvasDxf(FigureCanvasBase):
512496
"""

0 commit comments

Comments
 (0)