FAQ: default view agles

How to change default view angles in the following macro?
I would like to, by defauklt, to view it from a side.

{
gSystem->Load(“libGeom”);
TGeoManager *gm = new TGeoManager(“sample”, “sample display”);
TGeoVolume *top = gm->MakeBox (“TOP”, NULL, 270., 270., 120.);
TGeoVolume *tubs = gm->MakeTubs(“TUB”, NULL, 5., 15., 5., 90., 270.);

top->AddNode(tubs,1);
gm->SetTopVolume(top);
gm->CloseGeometry();
top->Draw();
}

set the viewing angles in the pad, eg:

{
gSystem->Load(“libGeom”);
TGeoManager *gm = new TGeoManager(“sample”, “sample display”);
TGeoVolume *top = gm->MakeBox (“TOP”, NULL, 270., 270., 120.);
TGeoVolume *tubs = gm->MakeTubs(“TUB”, NULL, 5., 15., 5., 90., 270.);

top->AddNode(tubs,1);
gm->SetTopVolume(top);
gm->CloseGeometry();
TCanvas c1;
c1.SetTheta(45);
c1.SetPhi(12);
top->Draw();
}

When you have a question of this type, generate the code by
selecting the option “Save as Canvas.C” from the canvas “file” menu

Rene

I do not want to create another one topic, but I want to add some nodes interactively. The problem is that user can rotate objects while I add nodes the view became default. How to get the current angels which are changed by user or anyhow else.
I tried to: TView *view = gPad->GetView(); if (!view) return; if (!gGeoManager) return; TVirtualGeoPainter *painter = gGeoManager->GetGeomPainter(); if (!painter) return; Double_t longit = view->GetLongitude(); Double_t lat = view->GetLatitude(); Double_t psi = view->GetPsi(); Double_t dphi = 1.; //do smth.... view->SetView(.....); gPad->Modified(); gPad->Update();
but it doesn’t work.