cadquery icon indicating copy to clipboard operation
cadquery copied to clipboard

The model exported ( as .STEP file ) has some broken surface

Open shishunyoung opened this issue 2 years ago • 1 comments

My code use a complex surface to cut&split a box

step-1: use param_surface() to define a complex&irregular surface

param_surface = cq.Workplane().parametricSurface(Bsurface, N=400, start=-0.1, stop=100+0.1, tol=1e-4,\
                                                minDeg=1, maxDeg=1, smoothing=None)

step-2:use this surface to cut&split a simple box

shape = cq.Workplane().center(50, 50).box(100,100,30).split(param_surface).solids('>Z')

step-3:export shape as a .step file & a .stl file

shape.val().exportStep(step_name_xxx, write_pcurves=False, precision_mode=0)
cq.exporters.export(shape, stl_name_xxx, tolerance=1e-3, angularTolerance=1e-2)

The problem is because param_surface is very complex,my .step file is very large ( ~12MB ). It's so so so slow when i want to open it as solid with SolidWorks 2022. And SolidWorks diagnosis show my model have some broken surface (and report surface error), but .stl file seems OK.

I dont understand why these broken surface exist ? Does cadquery have API to check&fix such broken surface?

shishunyoung avatar Oct 09 '23 15:10 shishunyoung

You could try cq.Shape.isValid and cq.Shape.fix. What is exactly the error that is reported ?

adam-urbanczyk avatar Oct 13 '23 06:10 adam-urbanczyk