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

Error running brad_tee_and_heatset_nuts.py: AttributeError: 'Assembly' object has no attribute 'metadata' #29

Closed
SeanDS opened this issue Mar 13, 2022 · 10 comments
Assignees

Comments

@SeanDS
Copy link

SeanDS commented Mar 13, 2022

I'm using the current cq_warehouse repository HEAD (cc694aa), and the latest published cadquery (2.1) and cq-editor (0.3.0dev) packages from conda, and running the brad_tee_and_heatset_nuts.py example I'm getting the following error:

Traceback (most recent call last):
  File "/home/sean/Workspace/Repositories/cq_warehouse/examples/brad_tee_and_heatset_nuts.py", line 54, in <module>
    cq.Workplane("XY")
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/extensions.py", line 944, in _clearanceHole
    return self.fastenerHole(
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/extensions.py", line 876, in _fastenerHole
    baseAssembly.metadata[baseAssembly.children[-1].name] = fastener
AttributeError: 'Assembly' object has no attribute 'metadata'

This happens on some of the others as well.

@gumyr
Copy link
Owner

gumyr commented Mar 13, 2022 via email

@SeanDS
Copy link
Author

SeanDS commented Mar 14, 2022

Thanks, that worked. I thought I had made sure I had the latest versions of all of the packages but it seems I didn't get conda to update correctly. Reinstalling worked.

There are still a bunch of errors running some of the examples - but not from lack of metadata - are these already known or should I submit new reports for these?

@gumyr
Copy link
Owner

gumyr commented Mar 14, 2022 via email

@SeanDS
Copy link
Author

SeanDS commented Mar 14, 2022

getting these errors running the cq_warehouse examples?

Yes. Using cadquery master (via conda) and cq-warehouse master (via git clone), both installed in a clean environment today, with Python 3.10. I ran pip install -e . on a local clone of cq-warehouse to get the latest.

The following three examples fail. The rest are fine.

(cadquery)  $ python brad_tee_and_heatset_nuts.py 
Traceback (most recent call last):
  File "/home/sean/Workspace/Repositories/cq_warehouse/examples/brad_tee_and_heatset_nuts.py", line 43, in <module>
    heatset = HeatSetNut(
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/fastener.py", line 559, in __init__
    self._cq_object = self.make_nut().val()
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/fastener.py", line 983, in make_nut
    lower_knurl_faces = HeatSetNut.knurled_cylinder_faces(
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/fastener.py", line 907, in knurled_cylinder_faces
    bottom_face = cq.Face.makeFromWires(
  File "/home/sean/Workspace/env/conda/envs/cadquery/lib/python3.10/site-packages/cadquery/occ_impl/shapes.py", line 2268, in makeFromWires
    raise ValueError("Cannot build face(s): outer wire is not closed")
ValueError: Cannot build face(s): outer wire is not closed
(cadquery)  $ python drafting_examples.py 
/home/sean/Workspace/env/conda/envs/cadquery/lib/python3.10/site-packages/cadquery/utils.py:65: FutureWarning: Kwarg <cut> will be removed. Plase use <combine='cut'>
  warn(
Traceback (most recent call last):
  File "/home/sean/Workspace/Repositories/cq_warehouse/examples/drafting_examples.py", line 82, in <module>
    length_dimension_line = metric_drawing.extension_line(
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/drafting.py", line 597, in extension_line
    d_line = self.dimension_line(
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/drafting.py", line 460, in dimension_line
    line_wire = Draft._path_to_wire(path)
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/drafting.py", line 262, in _path_to_wire
    path_as_wire = Wire.assembleEdges([path])
  File "/home/sean/Workspace/env/conda/envs/cadquery/lib/python3.10/site-packages/cadquery/occ_impl/shapes.py", line 1905, in assembleEdges
    wire_builder.Add(occ_edges_list)
OCP.Standard.Standard_TypeMismatch: TopoDS::Edge
(cadquery)  $ python flag_of_Ukraine.py 
Traceback (most recent call last):
  File "/home/sean/Workspace/Repositories/cq_warehouse/examples/flag_of_Ukraine.py", line 43, in <module>
    projected_top_face = top_face.projectToShape(the_wind, direction=cq.Vector(0, 0, -1))[0]
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/extensions.py", line 1348, in _face_projectToShape
    projected_faces = [
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/extensions.py", line 1349, in <listcomp>
    ow.makeNonPlanarFace(
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/extensions.py", line 1623, in _wire_makeNonPlanarFace
    return makeNonPlanarFace(self, surfacePoints, interiorWires)
  File "/home/sean/Workspace/Repositories/cq_warehouse/src/cq_warehouse/extensions.py", line 1593, in makeNonPlanarFace
    raise RuntimeError("non planar face is invalid")
RuntimeError: non planar face is invalid

@gumyr
Copy link
Owner

gumyr commented Mar 15, 2022

Thanks Sean. I'll try to recreate the problems you're seeing. I didn't know cadquery supported Python 3.10 yet so there are definitively some things to look into.

@gumyr
Copy link
Owner

gumyr commented Mar 15, 2022

It looks like at least some of the issues are related to makeNSidedSurface. I raised an issue here: CadQuery/cadquery#1030 I did my development with a version of cadquery from around the beginning of the year but I don't know if that's helpful as there hasn't been a release in a year.

@gumyr
Copy link
Owner

gumyr commented Mar 15, 2022

Looks like the version of OCP changed on Jan 13 (7.5.2 -> 7.5.3): CadQuery/cadquery#956 ... could be a nasty one.

@gumyr gumyr self-assigned this Mar 15, 2022
@gumyr
Copy link
Owner

gumyr commented Mar 16, 2022

Fixed drafting with 4c81538 A non backwards compatible change was made to assembleEdges which required a minor fix.

@gumyr
Copy link
Owner

gumyr commented Mar 17, 2022

Should all work now after #30 Thanks for raising the issue.

@gumyr gumyr closed this as completed Mar 17, 2022
@SeanDS
Copy link
Author

SeanDS commented Mar 17, 2022

Works, thanks!

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