CadQuery / cq-cli

Command Line Interface for executing CadQuery scripts and converting their output to another format.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

top-level tuple variable causes "Unable to handle assignment for node..."

justbuchanan opened this issue · comments

cq-cli version: latest from main (649587e)
cadquery version: latest from conda (mamba install -c conda-forge cadquery)

cq-cli command: cq-cli --codec stl --infile model.py --outfile model.stl

# model.py

import cadquery as CQ
size = (3, 4)
obj = cq.Workplane("XY").rect(*size).extrude(10)
show_object(obj)

Error message:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/site-packages/cadquery/cqgi.py", line 564, in visit_Assign
    for n, v in zip(left_side.elts, node.value.elts):
AttributeError: 'Name' object has no attribute 'elts'
Unable to handle assignment for node 'Name(id='size', ctx=Store())'

Changing size in the model from a tuple to a list fixes things:

# model.py

import cadquery as CQ
size = [3, 4]
obj = cq.Workplane("XY").rect(*size).extrude(10)
show_object(obj)

Good chance this bug is related to this CadQuery PR.

Thanks for the pointer, that does look like my exact issue. I'll follow along that thread for updates. In the meantime, I'll just use a list instead of a tuple.

@justbuchanan I tested your code above with the changes in the CQGI tuple PR and it worked fine. The code coverage and tests are green on that PR now, and after the GLTF/STL binary PR is merged I'll start moving it forward again. I'll have to figure out how to specify a git install in pyproject.toml because we'll need the bleeding edge CadQuery until its next release in January.

@justbuchanan The CQGI tuple PR has been merged into CQ. Could you verify that fixes this issue for you?

Works great, thank you!