Message: Re: using G4SubtractionSolid correctly for complex geometry Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: using G4SubtractionSolid correctly for complex geometry 

Forum: Geometry
Re: None using G4SubtractionSolid correctly for complex geometry (Anthony Villano)
Date: 15 Jan, 2016
From: Michael H. Kelsey <Michael H. Kelsey>

On Fri, 15 Jan 2016 19:44:29 GMT, Anthony Villano wrote:
> I'm using Geant4.9.5.p01 to compile some geometry. I am upgrading to a
> more recent version of Geant4 currently, so that's the reason for using
> this older version for some geometrical constructions being done in
> parallel.
> 
> I am having trouble with G4SubtractionSolid, and I have to confess that
> I have never been able to get complex geometry with this tool as it
> seems that I should be able to.
[...]
>       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2016/01/15/11.35-50773-g4codesnip.txt
> 
> When I use the code above I can get the following geometry, where I made
> the ridges go all the way through:
> 
>       http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2016/01/15/11.35-24414-plate.png
> 
> However when I try to make it true to the mechanical drawing, i.e. the
> ridges NOT going all the way through, I get the following error during
> rendering of the geometry:
> 
>  Macro srcCloseup.mac is being run 
> libGL error: No matching fbConfigs or visuals found
> libGL error: failed to load driver: swrast
> G4Scene::AddWorldIfEmpty: The scene was empty of run-duration models.
>   "world" has been added.

This doesn't look like a problem with the booleans. With booleans, you get the world etc. created, but you'll get a complaint about "polyhedron not available" because the complex boolean couldn't be turned into tesselations. The above makes it look like your shell environment or installation is wrong.

> And the geometry does not render. Why does this occur? I am
> daisy-chaining the creation of the G4SubtractionSolids in a way to make
> the code more compact, is this reasonabe?

It's okay, but not necessary compact. Don't worry about memory leaks from the chained solids: they all go into the G4SolidStore and get deleted when you clear the geometry. However, you could create the underlying solids (the two parts for the countersink, and a single ridge) outside the loops, and then just keep re-subtracting them from the net piece.

Unfortunately, visualization has serious problems with complex booleans. That's been true for a long time, and continues to be true. Even something seemingly as simple as a cylindrical tube with a plate booleaned onto the end can fail to draw correctly :-(

If you are not concerned about optical physics with your object, there is another way. Make the simple rectangular plate (G4Box) as a "mother volume", and then do placements of the countersink holes and ridges as daughter volumes made of vacuum or air (or whatever the surrounding stuff is). Unless you have a situation where you want to place other stuff _into_ the ridges or countersinks, this method is more likely to render properly.

  -- Mike Kelsey

 Add Message Add Message
to: "Re: using G4SubtractionSolid correctly for complex geometry"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]