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

cylindrical_gear.py ValueError: Cannot build face(s): outer wire is not closed #21

Open
Zdong104 opened this issue Oct 18, 2024 · 1 comment

Comments

@Zdong104
Copy link

I am trying to run the example code from the cylindrical_gear.py but get the error as below, if there is any solution I can solve this and make it start running?:

Using port 3939 taken from config file
Jupyter console not installed
Traceback (most recent call last):
File "/Users/zihan/Desktop/LLM4CAD/Dataset/IncorrectExamples/cylindrical_gear.py", line 135, in
gear2 = cylindrical_gear(m,z2,alpha,b).val().move(cq.Location(cq.Vector(mz1/2+mz2/2,0,0)))
File "/Users/zihan/Desktop/LLM4CAD/Dataset/IncorrectExamples/cylindrical_gear.py", line 103, in cylindrical_gear
teeths = teeths.extrude(b)
File "/Users/zihan/miniconda3/envs/ml4t/lib/python3.10/site-packages/cadquery/cq.py", line 3149, in extrude
r = self._extrude(until, both=both, taper=taper, upToFace=None)
File "/Users/zihan/miniconda3/envs/ml4t/lib/python3.10/site-packages/cadquery/cq.py", line 3782, in _extrude
faces = self._getFaces()
File "/Users/zihan/miniconda3/envs/ml4t/lib/python3.10/site-packages/cadquery/cq.py", line 3730, in _getFaces
rv.extend(wiresToFaces(self.ctx.popPendingWires()))
File "/Users/zihan/miniconda3/envs/ml4t/lib/python3.10/site-packages/cadquery/occ_impl/shapes.py", line 4167, in wiresToFaces
return Face.makeFromWires(wireList[0], wireList[1:]).Faces()
File "/Users/zihan/miniconda3/envs/ml4t/lib/python3.10/site-packages/cadquery/occ_impl/shapes.py", line 2856, in makeFromWires
raise ValueError("Cannot build face(s): outer wire is not closed")
ValueError: Cannot build face(s): outer wire is not closed

@jmwright
Copy link
Member

Gears have traditionally been hard to do correctly (issue for context on CadQuery and gears). I did not contribute the gear plugin, so I'm not familiar with it. You could try calling close() on teeths on line 95 before trying to extrude. If there is just one last missing segment to close , that will usually fix it. However, if each of the 2D tooth profiles has gaps between them, calling close() will not fix those.

Potentially related CadQuery PR.

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