tpaviot / pythonocc-core

Python package for 3D geometry CAD/BIM/CAM
GNU Lesser General Public License v3.0
1.33k stars 374 forks source link

Arcs/Circles are segmented when converting to BSplineCurve #1208

Open tsvilans opened 1 year ago

tsvilans commented 1 year ago

Hi,

I have been trying to construct some Breps in OCC using PythonOCC. I have managed to successfully create Breps composed of BSplineSurfaces and most types of edges/curves (lines, BSplineCurves, polylines, etc.). I use the 2d curves in parameter space and the relevant surface to construct edges (i.e. BRepBuilderAPI_MakeEdge::BRepBuilderAPI_MakeEdge (Geom2d_Curve, Geom_Surface)). For 2d BSplineCurves and lines, this seems to work fine.

The problem is that, when converting Arcs (using GCE2d_MakeArcOfCircle()), it seems to segment the arcs into BSplineCurves with degree 1 (see attached screenshot).

Any idea why it is doing this? According to the OCC docs, it should create a BSplineCurve of degree 2 that is the same shape as the arc. Is this a bug? Or am I approaching this the wrong way?

image This is the resultant Brep (single rectangle face with filleted corners to simplify the case) where you can see the individual vertices that approximate the arc, and that the curve is degree 1.

Any tips or help very much appreciated :)

tsvilans commented 1 year ago

Another test with a simple circle. Right side is how the Brep should come out, left side is how it comes out: the circle segmentation can be clearly seen...

image