Hiding Geometry in TEveBrowser

Hello!

I am making an application in TEveBrowser and I need to hide Geometry scene, so only Event scene is present.
There is a check box in TEveBrowser for this options shown on the picture below:

But I want to make a separate button for this, therefore I need this peace of code.
Can I somehow see the code for hiding geometry in TEveBrowser?
Or do You maybe know how can I hide the geometry without searching through code?

Thank you for your time and help!

Hi,

You can do something like this to remove the scene from a viewer:

root.exe tutorials/eve/pointset.C

root [1] v = (TEveViewer*) gEve->GetViewers()->FindChild("Viewer 1")
(class TEveViewer*)0x2c9f1d0
root [2] si = (TEveSceneInfo*) v->FindChild("SI - Geometry scene")
(class TEveSceneInfo*)0x388c4f0
root [3] v->RemoveElement(si)

or, you can disable drawing of the scene by calling:

si->SetRnrState(kFALSE) // si var from above
gEve->Redraw3D()

Cheers,
Matevz

Thank you for your answer!

I have tried to run the code, but either way I get this error:

I am using the following code to load the geometry:

[code]gGeoManager = gEve->GetGeometry(“geometry.root”);

tn = new TEveGeoTopNode(gGeoManager, gGeoManager->GetTopNode());

gEve->AddGlobalElement(tn,0); // 0 is default parent[/code]

And when the previous Check Button (SI - Geometry scene) is unchecked the geometry is not visible.
I have tried to use the following command to hide the geometry, but I get the segmentation error.

gEve->RemoveElement(tn,0);

Do you maybe have other suggestions?

Hmmh, the first code snippet should work in some way … what I sent you was cut’n’pasted from a ROOT session where it did work :slight_smile:

What root are you using? I used 5.34 patches branch. I wouldn’t dare using trunk …

How did you execute this code?

I have found mistake. I haven’t included this: TEveViewer.
Now, there is no syntax error and it compiles :smiley: . But when I click on the button, I get the segmentation error.

I execute the code using Visual Studio 2012 :mrgreen: and root v. 5.26.

Hmmh … how did you get stuck with ROOT 5.26? :slight_smile: Any chance for you to use 5.34?

What if you call the function directly, by hand? What’s the stack trace?

Hi,

[quote=“AryaStark”]I execute the code using Visual Studio 2012 and root v. 5.26.[/quote]You cannot use Visual Studio 2012. You must use the same version of Visual Studio than the one which has been used to build ROOT itself (and there is no version of ROOT compatible with Visual Studio 2012).

Cheers, Bertrand.

Hello!

You were right! [-o<
I have extracted my class from Visual Studio and I have compiled it using ROOT like one of the examples in tutorial.
Also I have added the previous code for hiding geometry as a method.
Now, everything works, and I don’t have any segmentation errors! :smiley: :smiley:

We can say that this thread is [color=#00BF00]solved [/color](and that the problem was in Visual Studio)
:slight_smile:

PS: At some point, I will still have to put the code in Visual Studio, and when the project is over make a binary exe file of it. Is there maybe some tutorial or forum thread where I can see how to do so, without having segmentation errors? :bulb: :question:
Thank you! [-o<

Hi,

[quote=“AryaStark”]PS: At some point, I will still have to put the code in Visual Studio, and when the project is over make a binary exe file of it. Is there maybe some tutorial or forum thread where I can see how to do so, without having segmentation errors?[/quote] If you just need to build a standalone application, you can take a look at the examples in the $ROOTSYS/test directory, using the Makefile.win32 nmake makefile. But you will still need the exact same version than the one used to build ROOT itself.

Cheers, Bertrand.