[dxf] fix reading Polyline
This commit is contained in:
parent
add82e955d
commit
9ede16df5d
2 changed files with 22 additions and 3 deletions
|
|
@ -212,8 +212,10 @@ def _read_block(block: ezdxf.layouts.BlockLayout | ezdxf.layouts.Modelspace) ->
|
|||
if isinstance(element, LWPolyline | Polyline):
|
||||
if isinstance(element, LWPolyline):
|
||||
points = numpy.asarray(element.get_points())
|
||||
elif isinstance(element, Polyline):
|
||||
is_closed = element.closed
|
||||
else:
|
||||
points = numpy.asarray([pp.xyz for pp in element.points()])
|
||||
is_closed = element.is_closed
|
||||
attr = element.dxfattribs()
|
||||
layer = attr.get('layer', DEFAULT_LAYER)
|
||||
|
||||
|
|
@ -233,7 +235,6 @@ def _read_block(block: ezdxf.layouts.BlockLayout | ezdxf.layouts.Modelspace) ->
|
|||
if width == 0:
|
||||
width = attr.get('const_width', 0)
|
||||
|
||||
is_closed = element.closed
|
||||
verts = points[:, :2]
|
||||
if is_closed and (len(verts) < 2 or not numpy.allclose(verts[0], verts[-1])):
|
||||
verts = numpy.vstack((verts, verts[0]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue