Skip to content

Instantly share code, notes, and snippets.

@ghedin
Last active Jul 24, 2017
Embed
What would you like to do?
OCCT - Approximate Surface
// plate builder
GeomPlate_BuildPlateSurface aPlateBuilder(Degree, NbPtsOnCur, NbIter, Tol2d, Tol3d, TolAng, TolCurv);
Standard_Real dmax = 1.1 * aPlateBuilder.G0Error();
TColgp_SequenceOfXY S2d;
TColgp_SequenceOfXYZ S3d;
aPlateBuilder.Disc2dContour(4, S2d);
aPlateBuilder.Disc3dContour(4, 0, S3d);
GeomPlate_PlateG0Criterion Criterion(S2d, S3d, dmax);
const Handle(GeomPlate_Surface)& GPlate = plateBuilder.Surface();
// approximate bspline surface
GeomPlate_MakeApprox Approx(GPlate, Criterion, Tol3d, MaxSegments, MaxDeg);
Handle(Geom_BSplineSurface) Surface = Approx.Surface();
// create a TopoDS_Face with the BSpline Surface
BRepBuilderAPI_MakeFace BB(Surface, Precision::Approximation()); // this won't compile.
// VISUAL STUDIO 2013 COMPILER OUTPUT:
// opencascade_7_1_0\inc\Standard_Handle.hxx(122): error C2440: 'static_cast' : cannot convert from 'Standard_Transient *const ' to 'Geom_BSplineSurface *'
// Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
// opencascade_7_1_0\inc\Standard_Handle.hxx(122) : while compiling class template member function 'Geom_BSplineSurface *opencascade::handle<Geom_BSplineSurface>::get(void) const'
// make_face.cpp(16) : see reference to function template instantiation 'Geom_BSplineSurface *opencascade::handle<Geom_BSplineSurface>::get(void) const' being compiled
// opencascade_7_1_0\inc\GeomAdaptor_Surface.hxx(274) : see reference to class template instantiation 'opencascade::handle<Geom_BSplineSurface>' being compiled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment