8000 Simplification fails in my installation (vpype read -s <svg_file>) · Issue #729 · abey79/vpype · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Simplification fails in my installation (vpype read -s <svg_file>) #729
Open
@nataquinones

Description

@nataquinones

Problem:
The following command fails in my installation:
vpype read -s scale_test.svg

I get the following error:

Traceback (most recent call last):
       
570F
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nquinones/miniforge3/envs/vsketch/lib/python3.12/site-packages/vpype/io.py", line 343, in _process_path
    line = line.view(dtype=complex).reshape(len(line))
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nquinones/miniforge3/envs/vsketch/lib/python3.12/site-packages/numpy/core/_internal.py", line 551, in _view_is_safe
    raise TypeError("Cannot change data-type for object array.")
TypeError: Cannot change data-type for object array.

Solution:
I tried to fix it by modifying the following line:

line = np.array(LineString(line).simplify(tolerance=quantization))

to:

line = LineString(line).simplify(tolerance=quantization)
line = np.array(line.coords, dtype=float)

and that seems to work.

Additional info:
I'm using the following versions on a MacOS Ventura 13.6

numpy=1.26.4
vpype==1.14.0
shapely==2.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0