Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!
Geant4 Version: 11.4.2
Operating System: Ubuntu 24.04
Compiler/Version: gcc 13.3.0
CMake Version: 3.28.3
The text colour is always cyan. How can I change it to black? The same also for /vis/scene/add/eventID
Johan
There are many vis commands. Use help or ls or, if you’re using Qt, the help window.
example/basic/B1/vis.mac gives some examples:
/vis/set/textColour green
/vis/set/textLayout right
/vis/scene/add/text2D 0.9 -.9 24 ! ! exampleB1
/vis/set/textLayout # Revert to normal (left adjusted) layout
/vis/set/textColour # Revert to default text colour (blue)
Ah! It doesn’t seem to work for eventID. As you say, always cyan. Thanks for spotting this. I’ll look into it.
John
Hi
This one line change will make the eventID code use the current text colour.
--- a/source/visualization/management/src/G4VisCommandsSceneAdd.cc
+++ b/source/visualization/management/src/G4VisCommandsSceneAdd.cc
@@ -865 +865 @@ void G4VisCommandSceneAddEventID::EventID::operator()(G4VGraphicsScene& sceneHan
- G4VisAttributes textAtts(G4Colour(0., 1., 1));
+ G4VisAttributes textAtts(fCurrentTextColour);
Then just /vis/set/textColour black.
Will this be enough to do what you want?
The problem is, the eventID now comes out blue by default. The final fix will have to be a little more sophisticated, and I need to think about it. But I hope the above will solve your immediate need. Let us know if it does…or if you have any more thoughts.
John
Drar John,
Thanks for the fast reply and your advices. I will try them asap.
Johan