Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
justbuchanan opened this issue Oct 19, 2023 · 5 comments

Comments

@justbuchanan
Copy link
Member

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)
@jmwright
Copy link
Member

Good chance this bug is related to this CadQuery PR.

@justbuchanan
Copy link
Member Author

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.

@jmwright
Copy link
Member

@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.

@jmwright jmwright reopened this Oct 22, 2023
@jmwright
Copy link
Member

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

@justbuchanan
Copy link
Member Author

Works great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants