Dear Geant4 users and experts,
I create a collimator with hexagonal holes as follows:
1- I used the G4ExtrudedSolid to construct a hexagon, the code I get from this post Need advice how to create Hexagonal prism;
2- than I creat of disc of hexagons with spacing between them by using G4MultiUnion
3- Finaly I use G4SubtractionSolid to get my final collimator geometry.
When I try to make the spacing between the hexagons very thin I got this error :
=================================================
ERROR: G4VSceneHandler::RequestPrimitives
Polyhedron not available for Collimator
Touchable path: World 0 Collimator 0
This means it cannot be visualized in the usual way on most systems.
The solid may not have implemented the CreatePolyhedron method.
For Boolean solids, the BooleanProcessor, which attempts to create
the resultant polyhedron, may have failed.
Try RayTracer. It uses Geant4âs tracking algorithms instead.
Drawing solid with cloud of points.
=================================================
But for a spacing equal or more than 0.0005mm the visualization works fine!
The error message explains the problem: the BooleanProcessor, which converts volumes to mesh objects, has failed. To overcome the issue you can:
use built-in RayTracer;
or to draw the collimator as a cloud of points: /vis/viewer/set/style cloud
In reality, neither G4MultiUnion nor G4SubtractionSolid are not needed to create a geometry like yours. Hexagonal holes can be defined as child volumes of the disk. A detailed explanation of how to do this is available in the thread you mentioned: Need advice how to create Hexagonal prism
Thank you for your replay!
I use /vis/viewer/set/style cloud, but the problem still exist, for RayTracer I dont know how can I use it? BUT it appears with others graphic systems:
You have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile) RayTracer (RayTracer)
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLImmediateQt (OGLIQt, OGLI)
OpenGLStoredQt (OGLSQt, OGL, OGLS)
OpenGLImmediateWin32 (OGLIWin32, OGLIQt_FALLBACK)
OpenGLStoredWin32 (OGLSWin32, OGLSQt_FALLBACK)
Qt3D (Qt3D)
Could you show me how i can use RayTracer?
Regards
Hello Evgueni Tcherniaev,
when I use these lines in the file vis.mac I got some errors and warnings with no visualization, the error said that I dont have RayTracerX, although the RayTracer figured in the liste above, the errors are attached bellow:
parameter value (RayTracerX) is not listed in the candidate List.
Candidates are: ATree DAWNFILE HepRepFile HepRepXML OGL OGLI OGLIQt OGLIWin32 OGLS OGLSQt OGLSWin32 Qt3D RayTracer VRML1FILE VRML2FILE gMocrenFile
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
Command aborted (1)
Error code : 1
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
***** Illegal parameter (1) *****
***** Batch is interrupted!! *****
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
Command aborted (1)
Error code : 1
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
I tryed to install RayTraycerX but the right command I dont find, existe some commands but just for Linux not for Windows10!
Could you suggest some actions?
I used the same option but i got a lot of error!
cmake -DCMAKE_INSTALL_PREFIX=âD:/Geant4/geant4_10_7_installâ -DGEANT4_USE_RAYTRACER_X11=ON âD:/Geant4/geant4_10_7â
I think I will reinstall Geant4 again by including this option!
It seems that you are using a Windows machine.
X11 is a different âWindowingâ system, created primarily for Unix Machines.
I am not aware of a RayTracer for Windows system - our colleagues who develop Visualisation or others who use it in more depth may help.
An alternative would be to get an X11 implementation for Windows, but this exists only as part of Cygwin, a Unix environment. I am not aware whether anyone has compiled recent versions of Geant4 with Cygwin (and in particular the visualisation).
Using Cygwin offers advantages, if it can work, but it would mean developing in a very different (Unix-like) environment.
@Zazo : Evgueniâs suggestion would remove the need to use RayTracerX â you could just place the âexclusionâ volumes in their mother. You would just need to add a material to these daughter hexagon volumes, as they will appear in your volume hierarchy.
This solution is much more robust vis-a-vis visualisation, and the Geant4 Navigator also handles it very well, resulting in fast computation of intersections. Instead of using G4MultiUnion, you would just place each hexagon inside the collimator volume.
Maybe you would need to tweek the visualisation settings to make these holes transparent ⌠?
Thank you for the explanation,
Perhapse I must use the Linux envirnement!
Exist an other way more easy beside Cygwin to use Linux on windows10 machine by installing the future WSL ( Windows Subsystem for Linux)!
Yes, this one also is a good alternative solution I hope, but what do you mean by âtweekâ (Iâm not good in English ), because I check this way for a simple geometry but the hexagon volume doesnât appear transparent!
In your geometry construction code, you can attach visualization attributes to your logical volume, using LV->SetVisAttributes(). Create a G4VisAttributes object in your code, configure it with color, drawing style, and other features, and pass it to that function.
The simplest way to âhideâ a volume like this is to make it invisible, with a pre-defined attribute: LV->SetVisAttributes(G4VisAttributes::GetInvisible()).
I used the pre-defined attribute LV->SetVisAttributes(G4VisAttributes::GetInvisible()), but the hexagonals are disapeared, I got just the mother disc, I need something else to add in DetectorConstruction.cc or vis.mac?
Thatâs odd. So itâs showing a solid disk, without the hexagons appearing as holes? Maybe Invisible wonât do for daughters what I thought it would do.
the alternative is to set the color transparency, using G4VisAttributes::SetColour(redfrac, greenfrac, bluefrac, 0.). The fourth argument is opacity (alpha), 1 for solid, 0 for fully transparent.
By using:
G4VisAttributes* att_1 = new G4VisAttributes();
att_1->SetColour(0, 0, 0, 1);
LVElemHex->SetVisAttributes(att_1);
I got this not very clear geometry:
When I used this att_1->SetColour(1, 1, 1, 0); the halls arenât transparent.
I need to get a geometry like the one constructed by using the G4MultiUnion (see the image in the begining of this thread)