Problems with BRepBuilderAPI_MakeFace and wire with Bezier curve

kellerg's picture

Hello,
I tried to use a wire containing some edges with Bezier curves to make a face with BRepBuilderAPI_MakeFace (in version 7.3.0). Unfortunately, the resulting face does not have the smooth Bezier edges, but jagged edges consisting of straight sections.
But the wire itself has the smooth Bezier edges. The wire itself is planar and also the resulting face.

Am I doing something wrong? Or is it not possible to get a smooth face from a bezier wire?

I create the wire and the face like this:

TColgp_Array1OfPnt arrP(1, endPnt - startPnt);
//fill the arrP with data
BRepBuilderAPI_MakeWire mkWire = BRepBuilderAPI_MakeWire();
TColgp_Array1OfPnt arrPB(1, 4);
Geom_BezierCurve *aCurve;
for (Standard_Integer i = arrP.Lower(); i < arrP.Upper() - 2; i += 3)
{
for (Standard_Integer j = arrPB.Lower(); j <= arrPB.Upper(); j++)
arrPB(j) = arrP(i + j - 1);
if (IsStraight(arrPB))
{
Handle(Geom_TrimmedCurve) aSegment = GC_MakeSegment(arrPB(1), arrPB(4))
TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(aSegment);
mkWire.Add(anEdge);
}
else
{
aCurve = new Geom_BezierCurve(arrPB);
TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(aCurve);
mkWire.Add(anEdge);
}
}

mkWire.Build();
TopoDS_Wire aWire = mkWire.Wire();
TopoDS_Face aFace = BRepBuilderAPI_MakeFace(aWire);

The wire and the face are available as brep file on my dropbox:
https://www.dropbox.com/s/j250v1yed6ukm48/Wire.brep?dl=0
https://www.dropbox.com/s/ddvlp8mx00ym03b/Face.brep?dl=0
I used the CAD assistand version 1.3 to check the geometries.

Thanks in advance,
Georg

abv's picture

Use meters as system units

Hello,

The face is OK, these are artifacts of rough meshing.

Apparently you have system units set to millimeters in CAD Assistant. Change them to meters (in Options, third tab "Import/Export options", parameter "System units", select "M") and you will see your shape smooth.

The reason is that your shape is rather small (~0.06) and when interpreted in millimeters (note that BREP format does not specify units), default meshing settings in CAD Assistant are too rough for it.

Andrey

kellerg's picture

Units in OpenCascade

Hello Andrey,

thanks for your help, that solved the problem in the CAD Assistant. I now have some followup questions:

1. What units should the input data be in for Opencascade? Or does that not matter for the modelling? At the moment, I use meters, which is why the shapes are rather small.

2. I want to use the face of my first post with two spines (open wires) to make a solid. But when I try to use the face I created as a profile in BRepOffsetAPI_MakePipeShell, I get an exception, but not when I use the wire. Can faces not be used as a profile in BRepOffsetAPI_MakePipeShell?

3. What is the best way to get a geometry like in https://www.dropbox.com/s/23dqqvzsq67k3p5/treppe.brep?dl=0 from two spines and a profile (wire or face)?

Georg

kgv's picture

> 1. What units should the

> 1. What units should the input data be in for Opencascade?
> Or does that not matter for the modelling?
> At the moment, I use meters, which is why the shapes are rather small.
OCCT itself is not strictly bound to specific length unit - e.g. application decides in which units to work and should care about setting them to Data Exchange interface (e.g. to import/export STEP/IGES files properly - the units conversion will be done by data conversion tools).

However, while considering in which units application works (e.g. in which units create/modify geometry using OCCT algorithms), one should note that apart from tolerance values explicitly given to OCCT algorithm, OCCT defines also implicit tolerances usually restricting the lower boundary.

In particular, this is Precision::Confusion() constant defined as "1.e-7": https://dev.opencascade.org/doc/refman/html/class_precision.html
As you may find out, this value meets well modeling of geometry defined in millimeters, which is what are "implicit" OCCT units.

This doesn't mean that you cannot use meters with OCCT algorithms - the answer is actually depends on your modeling requirements (minimal and maximal distances to care about). For instance, if you work with really small details - you may consider using nano-meters or micrometers as system units to avoid precision issues, while working on models of hundred meters and kilometers in size - the meters would match better as systems units, as using excessive precision in algorithms is also not good.

www.opencascade.com

Copyright 2011-2019
OPEN CASCADE SAS
Contact us