I want to see my canvas in X3D after execution of my program. I could do this by hand: View->View With->X3D.
But how to do this from program by code?
I read a docs (not very deep) and I saw that gPad->x3d() deprecated so I used
{
c1 = new TCanvas("c1","Geometry Shapes",200,10,700,500);
//delete previous geometry objects in case this script is reexecuted
if (gGeometry) {
gGeometry->GetListOfNodes()->Delete();
gGeometry->GetListOfShapes()->Delete();
}
// Define some volumes
brik = new TBRIK("BRIK","BRIK","void",200,150,150);
sphe1 = new TSPHE("SPHE1","SPHE1","void",0,140, 0,180, 0,360);
sphe2 = new TSPHE("SPHE2","SPHE2","void",0,140, 0,180, 0,360);
// Set shapes attributes
brik->SetLineColor(kBlue);
sphe1->SetLineColor(kRed);
sphe2->SetLineColor(kYellow);
// Build the geometry hierarchy
node1 = new TNode("NODE1","NODE1","BRIK");
node1->cd();
node2 = new TNode("NODE2","NODE2","SPHE1",-200,-150,-140);
node3 = new TNode("NODE3","NODE3","SPHE2",-400,-400,-400);
// Draw this geometry in the current canvas
node1->cd();
node1->Draw();
c1->Update();
c1->GetViewer3D("x3d");
}