Get Adaptor3d_HCurveOnSurface from edge or (Geom_Curve)

galaxyblazer's picture

I want to create Plate surface from the edges. And I found GeomPlate_BuildPlateSurface class where I need array of Adaptor3d_HCurveOnSurface curves. But I can't find any good sample how simply convert Geom_Curve to the Adaptor3d_HCurveOnSurface.
I just can get Geom_Curve :
Standard_Real f, l;
Handle(Geom_Curve) curve = BRep_Tool::Curve(edge,f,l);
I know about some adapter, but I can't find how to resolve my issue in documentation.

msv's picture

Answer and solution

There is no way to create curve on surface if you just have a curve without a surface.

It is a mistake in OCCT that build plate surface takes curves on surface. Instead it should accept just curves. Thank you for this report. I have created a new bug 28214 to correct this issue.

Actually you may do the job without that constructor. Instead, initialize the class using another constructor, and then add curves by the method
void Add (const Handle(GeomPlate_CurveConstraint)& Cont);

galaxyblazer's picture

Hi. Thanks for your

Hi.
Thanks for your reply.
I'm new in opencascade. How to convert Geom_Curve to GeomPlate_CurveConstraint?

msv's picture

How to convert Geom_Curve to GeomPlate_CurveConstraint

I saw that you have an edge. In this case it is better to use BRepAdaptor_Curve/BRepAdaptor_HCurve to create a descendant of Adaptor3d_HCurve. Then you create GeomPlate_CurveConstraint.

galaxyblazer's picture

OpenCascade documentation is

OpenCascade documentation is very hard to understanding.
I can't find right code to create GeomPlate_CurveConstraint object.

msv's picture

Sometimes it is very useful

Sometimes it is very useful to look inside hxx files for documentation of classes. To see an example of code, look inside GeomPlate_BuildAveragePlane.cxx, and you will see how curve constraint is created.

galaxyblazer's picture

There are no any mention of

There are no any mention of GeomPlate_CurveConstraint in there.
Actually I tried this way:
Handle(GeomPlate_CurveConstraint) convertCurve (Handle(Geom_Curve) curve)
{
Standard_Integer n_points = 30;
Standard_Real tol_3d = 1e-4;

GeomAdaptor_HCurve hcurveadapt (curve);
const Handle(GeomAdaptor_HCurve)& aHC = new GeomAdaptor_HCurve(hcurveadapt);
Handle (GeomPlate_CurveConstraint) aConst = new GeomPlate_CurveConstraint (aHC, 0, n_points, tol_3d);

return aConst;
}

But I don't now is n_points value is correct.
And also I'm interesting is it enough two GeomPlate_CurveConstraint to create Plate surface?

msv's picture

Now discussion goes off topic

Now discussion goes off topic of this forum. This is a forum for discussion of topics concerning development of OCCT. Please ask your questions concerning usage of OCCT in the forums of opencascade.com site.

galaxyblazer's picture

And I want ask you did I

And I want ask you did I create surface in right way.

so at first a create GeomPlate_BuildPlateSurface object:
const Standard_Integer Degree = 3;
const Standard_Integer NbPtsOnCur = 10;
const Standard_Integer NbIter = 3;
const Standard_Real Confusion = 1.e-7;

GeomPlate_BuildPlateSurface plateSurf (Degree,NbPtsOnCur,NbIter);

then I add to the builder created constraint curves: plateSurf.Add(convertCurve(curve));
(convertCurve method from my previous comment)

and then I try get Geom_Surface from the builder:
Handle(Geom_Surface) surf = plateSurf.SurfInit();

And I have an error when I try get face from that surface:
TopoDS_Face face = BRepBuilderAPI_MakeFace(surf,Confusion);

www.opencascade.com

Copyright 2011-2017
OPEN CASCADE SAS
Contact us