CadQuery / cadquery

A python parametric CAD scripting framework based on OCCT
https://cadquery.readthedocs.io
Other
2.93k stars 276 forks source link

Error when creating very thin shells #1515

Closed GaN-T closed 4 months ago

GaN-T commented 5 months ago

I am trying to make a positive shell on an object (outward growth). The shell command works for what I am trying to do in principle, but not at the dimensions I want - I need a very thin layer wrapped around my object, much thinner than the original dimensions, but this doesn't work and I get an error (StdFail_NotDone: BRep_API: command not done). I don't get an error when the shell thickness is 1e-3, but it fails when i try to make the shell thickness smaller. How does one make really thin shells?

See example below to produce the error:

b =  cq.Workplane("front").box(5,5,2.5e-3)
b.faces("+Z").shell(1e-4, kind = "intersection" )

How can i specify the tolerance to be higher for this operation?

adam-urbanczyk commented 4 months ago

There is a tol parameter in the Shape API. Can you try if changing it solves the issue?

GaN-T commented 4 months ago

Yes this solves the problem, but I had to go into the source file of the Shape API and manually change it. It was not possible to pass it as an argument in the normal call to shell() as a workplane method, which raises a type error. Could this be included too in the future release or is there a particular reason why it is hard coded to 0.0001

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[6], line 2
      1 b =  cq.Workplane("front").box(5,5,2.5e-3)
----> 2 b.faces("+Z").shell(1e-4, kind = "intersection", tol = 1e-6 )

TypeError: Workplane.shell() got an unexpected keyword argument 'tol'
adam-urbanczyk commented 4 months ago

That's a reasonable request. In the meantime you can modify default arguments at runtime (see methodname.__defaults__).