Wed, 10/17/2007 - 16:49
Forums:
Dear all,
I would like to evaluate some points on a TopoDS_Face which I retrieve with a TopoExplorer from a Step-File.
Therefore I use an BRepAdaptor_Surface class to access the face and to give me the U,V bounds of the surface.
Now I divide the U,V, distance by a factor and try to evaluate a point on the surface for every U,V, value I just generated. Everything works just fine and I also get the points.
Unfortunately, the surface is a trimmed surface and so I also get points in the trimmed area where no point should be evaluated.
How can I overcome this problem? Do you have any suggestions for me?
With best regards,
Joachim
Thu, 10/18/2007 - 12:29
Dear all,
is there really nobody who ever worked with trimmed surfaces?? I thought that this is a standard problem in CAD-development and that there should be quite a lot of solutions already....which I unfortunately am not able to find :)
So I am looking forward to get information from the members.
With best regards,
Joachim
Thu, 10/18/2007 - 14:37
TopoDS_Face represents a trimmed surface in OCC. You can use face classifier (BRepClass_FaceClassifier) to determine if a point (U,V) is IN or OUT of boundaries.
Thu, 10/18/2007 - 14:38
Hi Joachim,
I had a similar problem with curves. In this snippet:
double firstPar, lastPar;
double tolerance3D = tolerance;
double toleranceU = 0;
Handle (Geom_Curve) nurbsHandle = BRep_Tool::Curve(edge, firstPar, lastPar);
if(nurbsHandle.IsNull() == Standard_True)
{
TraceError("shellDocBase Error. GetPointsFromEdge - nurbs handle Null.");
return;
}
Handle(Geom_BSplineCurve) NURBS = Handle(Geom_BSplineCurve)::DownCast(nurbsHandle);
if(NURBS.IsNull() == Standard_True)
{
TraceError("shellDocBase Error. GetPointsFromEdge - NURBS handle Null.");
return;
}
NURBS->Resolution(tolerance3D, toleranceU);
//double prevParameter = NURBS->FirstParameter();
double prevParameter = firstPar;
double actParameter = prevParameter + toleranceU;
//double lastParameter = NURBS->LastParameter();
double lastParameter = lastPar;
...
if I use NURBS->FirstParameter and NURBS->LastParameter I face the same problem as you do. But if the values 'firstPar' and 'lastPar' are used during the iteration I get the parameters after trimming.
Maybe you could try a similar approach for your surfaces (you would probably have to convert your shapes into NURBS).
Another possibility is to use the BRepClass3d_SolidClassifier class to judge if a point belongs (TopAbs_ON) to a shape/face etc. This method however - depending on the shape complexity - could be time consuming.
Cheers
Pawel
Thu, 10/18/2007 - 15:08
Dear Pawel and Bearloga,
thank you very much for your help.
I wanted to have it quick and so just used the BRepClass3d_SolidClassifier class and the function isonaface() to check wether the point is on or not.
Unfortunately the BRepClass_FaceClassifier class offers not such a function. Or did I just make a mistake Bearloga??
Once again thank you.
Joachim
Thu, 10/18/2007 - 15:48
Solid classifier is used mainly to determine if a 3D point is situated inside or outside of a volume, or on its shell.
If you work in 2d space of a face you should use face classifier. It returns IN, OUT or ON state (situation of a 2D point relatively the contour of the face).
Thu, 10/18/2007 - 17:34
Hi Bearloga,
now its clear. Thank you for your detailed help. I didnt know that TopAbs_State is the enum I need :)
With best regards,
Joachim