How display Geom2D_BSplineCurve...

Hi,
I created object of "Geom2D_BSplineCurve" and now I can not find functions where I can use my object as a parameter. So, is there possibility to display my object?
Thank for attention...

Marco Matt's picture

Take a look at Visualization User's Guide (visu.pdf) in your occ directory. Dont know how good the 2d visualisation is described but the explanation of the 3d visualisation is adequate.
You can convert your 2d curve into 3d curve if you need to use the 3d visualisation.

Bharat Subedi's picture

I haven't tried 2d visualization but I was able to display BSplineCurve with 3d visualization.
Here it is.

void CmySecondCadeDoc::OnDrawBsplinecurve()
{
// TODO: ‚±‚±‚ɃRƒ}ƒ“ƒh ƒnƒ“ƒhƒ‰ ƒR[ƒh‚ð’ljÁ‚µ‚Ü‚·B

myAISContext->EraseAll();
gp_Pnt P1(0,0,10);
gp_Pnt P2(100,200,200);
gp_Pnt P3(200,300,300);
gp_Pnt P4(400,300,400);
gp_Pnt P5(500,500,500);
TColgp_Array1OfPnt array (1,5); // sizing array
array.SetValue(1,P1);
array.SetValue(2,P2);
array.SetValue(3,P3);
array.SetValue(4,P4);
array.SetValue(5,P5);
Handle(TColgp_HArray1OfPnt) harray =
new TColgp_HArray1OfPnt (1,5); // sizing harray
harray->SetValue(1,P1.Translated(gp_Vec(4,0,0)));
harray->SetValue(2,P2.Translated(gp_Vec(4,0,0)));
harray->SetValue(3,P3.Translated(gp_Vec(4,0,0)));
harray->SetValue(4,P4.Translated(gp_Vec(4,0,0)));
harray->SetValue(5,P5.Translated(gp_Vec(4,0,0)));
Handle(Geom_BSplineCurve) SPL1 = GeomAPI_PointsToBSpline(array).Curve();

GeomAPI_Interpolate anInterpolation(harray,Standard_False,Precision::Approximation());
anInterpolation.Perform();

Handle(Geom_BSplineCurve) SPL2;
if (anInterpolation.IsDone())
SPL2 = anInterpolation.Curve();
else
MessageBox(0,"The Interpolation is Not done","CasCade Warning",MB_ICONWARNING);

TopoDS_Edge Edge1;
Edge1 = BRepBuilderAPI_MakeEdge(SPL2);
TopoDS_Wire RedWire;
RedWire = BRepBuilderAPI_MakeWire(Edge1);
Handle(AIS_Shape) anAISShape = new AIS_Shape(RedWire);
myAISContext->SetColor(anAISShape,Quantity_NOC_AZURE);
myAISContext->SetMaterial(anAISShape,Graphic3d_NOM_PLASTIC);
myAISContext->SetDisplayMode(anAISShape,1);
myAISContext->Display(anAISShape);
}
//myAISContext here should be initialized before
//Simply we can see mfcSamples project files.