Mon, 12/12/2016 - 22:58
Forums:
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.
Tue, 12/13/2016 - 11:07
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);
Tue, 12/13/2016 - 12:04
Hi.
Thanks for your reply.
I'm new in opencascade. How to convert Geom_Curve to GeomPlate_CurveConstraint?
Tue, 12/13/2016 - 12:17
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.
Tue, 12/13/2016 - 13:15
OpenCascade documentation is very hard to understanding.
I can't find right code to create GeomPlate_CurveConstraint object.
Tue, 12/13/2016 - 16:17
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.
Tue, 12/13/2016 - 17:19
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?
Tue, 12/13/2016 - 17:48
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.
Tue, 12/13/2016 - 17:47
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);