
Thu, 05/18/2023 - 19:31
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 1 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.
Image 2 is a 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...
Any tips or help very much appreciated :)
Fri, 05/19/2023 - 00:54
It is unclear how you created such shapes. Please provide a piece of code, and attach a brep file saved with the method BRepTools::Write().
Definitely it must not be so if you use OCCT correctly.
And please tell why in the screenshot we can see the words "Plug-in: Rhino". What is the relation between Rhinoceros kernel and your sample?
Sun, 05/21/2023 - 17:21
Hi Mikhail,
Thank you for your response!
Here is a minimum working example for this case as well as the output in
.brep
and.stp
format. In the screenshot, I am using Rhino to look at the resultant STEP file that comes from OCC - so it is just to view the results.The problem seems to be either in converting the 2d circle into a
Geom2d_TrimmedCurve
or in usingBRepBuilderAPI_MakeEdge
with the surface... Any help is much appreciated :) Maybe it is very simple and obvious where I am doing something wrong!Sun, 05/21/2023 - 17:24
Some added context... here is the code I am using to write the STEP file:
Sun, 05/21/2023 - 23:14
I am sorry, but I cannot understand your query. It is contradictual and there is no connection between initial post and the provided sample.
Mon, 05/22/2023 - 12:28
Hi Mikhail,
Thanks again for looking into this. What is contradictory? Maybe I didn't explain it well enough :)
When I use 2d circles or arcs to construct edges for wires, the result is a face boundary with degree 1 (polygonized) when exported as STEP, not degree 2 as expected.
When I load the
.brep
file in Gmsh to look at it, it also appears polygonized (degree 1) so I don't think it is a problem with the STEP output.Did you notice anything odd about the
.brep
file I provided? Does the code above look like the correct way to create Breps using 2d parameter space curves?Mon, 05/22/2023 - 22:55
I looked at your brep file and found out that it is invalid. The algorithm BRepCheck_Analyzer reports errors on it. The cause of error is the absence of 3D curve. The shape healing helps in this case. The algorithm ShapeFix_Shape repairs the shape and reconstructs the 3D curve (bspline of 11th degree). The curve is constructed using approximator, and it does not limit the degree of the result curve, therefore we obtain the curve not of the 2nd degree.