be more consistent about when copies are made

This commit is contained in:
Jan Petykiewicz 2024-07-29 03:13:23 -07:00
commit ef6c5df386
14 changed files with 28 additions and 34 deletions

View file

@ -212,9 +212,9 @@ def _read_block(block: ezdxf.layouts.BlockLayout | ezdxf.layouts.Modelspace) ->
for element in block:
if isinstance(element, LWPolyline | Polyline):
if isinstance(element, LWPolyline):
points = numpy.array(element.get_points())
points = numpy.asarray(element.get_points())
elif isinstance(element, Polyline):
points = numpy.array(element.points())[:, :2]
points = numpy.asarray(element.points())[:, :2]
attr = element.dxfattribs()
layer = attr.get('layer', DEFAULT_LAYER)
@ -241,7 +241,7 @@ def _read_block(block: ezdxf.layouts.BlockLayout | ezdxf.layouts.Modelspace) ->
elif isinstance(element, Text):
args = dict(
offset=numpy.array(element.get_placement()[1])[:2],
offset=numpy.asarray(element.get_placement()[1])[:2],
layer=element.dxfattribs().get('layer', DEFAULT_LAYER),
)
string = element.dxfattribs().get('text', '')
@ -262,7 +262,7 @@ def _read_block(block: ezdxf.layouts.BlockLayout | ezdxf.layouts.Modelspace) ->
mirrored, extra_angle = normalize_mirror((yscale < 0, xscale < 0))
rotation = numpy.deg2rad(attr.get('rotation', 0)) + extra_angle
offset = numpy.array(attr.get('insert', (0, 0, 0)))[:2]
offset = numpy.asarray(attr.get('insert', (0, 0, 0)))[:2]
args = dict(
target=attr.get('name', None),

View file

@ -357,7 +357,7 @@ def _mrefs_to_grefs(refs: dict[str | None, list[Ref]]) -> list[klamath.library.R
if isinstance(rep, Grid):
b_vector = rep.b_vector if rep.b_vector is not None else numpy.zeros(2)
b_count = rep.b_count if rep.b_count is not None else 1
xy = numpy.array(ref.offset) + numpy.array([
xy = numpy.asarray(ref.offset) + numpy.array([
[0.0, 0.0],
rep.a_vector * rep.a_count,
b_vector * b_count,