/vis/viewer/

Operations on Geant4 viewers.

Sub-directories

/vis/viewer/default/Set default values for future viewers.
/vis/viewer/set/Set view parameters of current viewer.

Commands

addCutawayPlane
centreAndZoomInOn
centreOn
changeCutawayPlane
clear
clearCutawayPlanes
clearTransients
clearVisAttributesModifiers
clone
colourByDensity
copyViewFrom
create
dolly
dollyTo
flush
interpolate
list
pan
panTo
rebuild
refresh
reset
resetCameraParameters
save
scale
scaleTo
select
update
zoom
zoomTo

addCutawayPlane [x] [y] [z] [unit] [nx] [ny] [nz]

Add cutaway plane to current viewer.

Available at all Geant4 states.

Parameters
x type d Omittable : default value = 0
y type d Omittable : default value = 0
z type d Omittable : default value = 0
unit type s Omittable : default value = m
nx type d Omittable : default value = 1
ny type d Omittable : default value = 0
nz type d Omittable : default value = 0

centreAndZoomInOn [pv-name] [copy-no]

Centre and zoom in on the given physical volume.
The names of all volumes in all worlds are matched against pv-name. If copy-no is supplied, it matches the copy number too. If pv-name is of the form "/regexp/", where regexp is a regular expression (see C++ regex), the match uses the usual rules of regular expression matching. Otherwise an exact match is required. For example, "/Shap/" matches "Shape1" and "Shape2".
It may help to see a textual representation of the geometry hierarchy of the worlds. Try "/vis/drawTree [worlds]" or one of the driver/browser combinations that have the required functionality, e.g., HepRepFile.
If there are more than one matching physical volumes they will all be included. If this is not what you want, and what you want is to centre on a particular touchable, then select the touchable ("/vis/set/touchable") and use "/vis/touchable/centreOn". (You may need "/vis/touchable/findPath".)

Available at all Geant4 states.

Parameters
pv-name type s
copy-no type i Omittable : default value = -1

centreOn [pv-name] [copy-no]

Centre the view on the given physical volume.
The names of all volumes in all worlds are matched against pv-name. If copy-no is supplied, it matches the copy number too. If pv-name is of the form "/regexp/", where regexp is a regular expression (see C++ regex), the match uses the usual rules of regular expression matching. Otherwise an exact match is required. For example, "/Shap/" matches "Shape1" and "Shape2".
It may help to see a textual representation of the geometry hierarchy of the worlds. Try "/vis/drawTree [worlds]" or one of the driver/browser combinations that have the required functionality, e.g., HepRepFile.
If there are more than one matching physical volumes they will all be included. If this is not what you want, and what you want is to centre on a particular touchable, then select the touchable ("/vis/set/touchable") and use "/vis/touchable/centreOn". (You may need "/vis/touchable/findPath".)

Available at all Geant4 states.

Parameters
pv-name type s
copy-no type i Omittable : default value = -1

changeCutawayPlane [index] [x] [y] [z] [unit] [nx] [ny] [nz]

Change cutaway plane.

Available at all Geant4 states.

Parameters
index type i
x type d Omittable : default value = 0
y type d Omittable : default value = 0
z type d Omittable : default value = 0
unit type s Omittable : default value = m
nx type d Omittable : default value = 1
ny type d Omittable : default value = 0
nz type d Omittable : default value = 0

clear [viewer-name]

Clears viewer.
By default, clears current viewer. Specified viewer becomes current. "/vis/viewer/list" to see possible viewer names.

Available at all Geant4 states.

Parameters
viewer-name type s Omittable : current value is used as the default value.

clearCutawayPlanes

Clear cutaway planes of current viewer.

Available at all Geant4 states.

clearTransients [viewer-name]

Clears transients from viewer.
By default, operates on current viewer. Specified viewer becomes current. "/vis/viewer/list" to see possible viewer names.

Available at all Geant4 states.

Parameters
viewer-name type s Omittable : current value is used as the default value.

clearVisAttributesModifiers

Clear vis attribute modifiers of current viewer.
(These are used for touchables, etc.)

Available at all Geant4 states.

clone [original-viewer-name] [clone-name]

Clones viewer.
By default, clones current viewer. Clone becomes current. Clone name, if not provided, is derived from the original name. "/vis/viewer/list" to see possible viewer names.

Available at all Geant4 states.

Parameters
original-viewer-name type s Omittable : current value is used as the default value.
clone-name type s Omittable : default value = none

colourByDensity [n] [unit] [d0] [d1] [d2]

If a volume has no vis attributes, colour it by density.
Provide algorithm number, e.g., "1" (or "0" to switch off). Then a unit of density, e.g., "g/cm3". Then parameters for the algorithm assumed to be densities in that unit.
Algorithm 1: Simple algorithm takes 3 parameters: d0, d1 and d2. Volumes with density < d0 are invisible. Volumes with d0 <= density < d1 have colour on range red->green. Volumes with d1 <= density < d2 have colour on range green->blue. Volumes with density > d2 are blue.

Available at all Geant4 states.

Parameters
n type i Omittable : default value = 1
unit type s Omittable : default value = g/cm3
d0 type d Omittable : default value = 0.5
d1 type d Omittable : default value = 3
d2 type d Omittable : default value = 10

copyViewFrom [from-viewer-name]

Copy the camera-specific parameters from the specified viewer.
Note: To copy ALL view parameters, including scene modifications, use "/vis/viewer/set/all"

Available at all Geant4 states.

Parameters
from-viewer-name type s

create [scene-handler] [viewer-name] [window-size-hint]

Creates a viewer. If the scene handler name is specified, then a viewer of that scene handler is created. Otherwise, a viewer of the current scene handler is created.
If the viewer name is not specified a name is generated from the name of the scene handler and a serial number.
The scene handler and viewer become current.
(Note: the system adds the graphics system name to the viewer name for identification, but for selecting, copying, etc., only characters up to the first blank are used. For example, if the viewer name is "viewer-0 (G4OpenGLStoredQt)", it may be referenced by "viewer-0", for example in "/vis/viewer/select viewer-0".)
Window size and placement hints, e.g. 600x600-100+100 (in pixels):
- single number, e.g., "600": square window;
- two numbers, e.g., "800x600": rectangluar window;
- two numbers plus placement hint, e.g., "600x600-100+100" places window of size 600x600 100 pixels left and 100 pixels down from top right corner.
- If not specified, the default is "600", i.e., 600 pixels square, placed at the window manager's discretion...or picked up from the previous viewer.
- This is an X-Windows-type geometry string, see: https://en.wikibooks.org/wiki/Guide_to_X11/Starting_Programs, "Specifying window geometry".

Available at all Geant4 states.

Parameters
scene-handler type s Omittable : current value is used as the default value.
viewer-name type s Omittable : current value is used as the default value.
window-size-hint type s Omittable : current value is used as the default value.

dolly [increment] [Unit]

Incremental dolly.
Moves the camera incrementally towards target point.

Available at all Geant4 states.

Parameters
increment type d Omittable : current value is used as the default value.
Unit type s Omittable : default value = m Parameter candidates : pc km m cm mm um nm Ang fm parsec kilometer meter centimeter millimeter micrometer nanometer angstrom fermi

dollyTo [distance] [Unit]

Dolly to specific coordinate.
Places the camera towards target point relative to standard camera point.

Available at all Geant4 states.

Parameters
distance type d Omittable : current value is used as the default value.
Unit type s Omittable : default value = m Parameter candidates : pc km m cm mm um nm Ang fm parsec kilometer meter centimeter millimeter micrometer nanometer angstrom fermi

flush [viewer-name]

Compound command: "/vis/viewer/refresh" + "/vis/viewer/update".
Useful for refreshing and initiating post-processing for graphics systems which need post-processing. By default, acts on current viewer. "/vis/viewer/list" to see possible viewers. Viewer becomes current.

Available at all Geant4 states.

Parameters
viewer-name type s Omittable : current value is used as the default value.

interpolate [pattern] [no-of-points] [wait-time] [time-unit] [export]

Interpolate views defined by the first argument, which can contain Unix-shell-style pattern matching characters such as '*', '?' and '[' - see "man sh" and look for "Pattern Matching". The contents of each file are assumed to be "/vis/viewer" commands that specify a particular view. The files are processed in alphanumeric order of filename. The files may be written by hand or produced by the "/vis/viewer/save" command.
The default is to search the working directory for files with a .g4view extension. Another procedure is to assemble view files in a subdirectory, e.g., "myviews"; then they can be interpolated with "/vis/viewer/interpolate myviews".
To export interpolated views to file for a future possible movie, write "export" as 5th parameter (OpenGL only).

Available at all Geant4 states.

Parameters
pattern type s Omittable : default value = *.g4view
no-of-points type i Omittable : default value = 50
wait-time type s Omittable : default value = 20.
time-unit type s Omittable : default value = millisecond
export type s Omittable : default value = no

list [viewer-name] [verbosity]

Lists viewers(s).
See "/vis/verbose" for definition of verbosity.

Available at all Geant4 states.

Parameters
viewer-name type s Omittable : default value = all
verbosity type s Omittable : default value = warnings

pan [right-increment] [up-increment] [unit]

Incremental pan.
Moves the camera incrementally right and up by these amounts (as seen from viewpoint direction).

Available at all Geant4 states.

Parameters
right-increment type d Omittable : current value is used as the default value.
up-increment type d Omittable : current value is used as the default value.
unit type s Omittable : default value = m

panTo [right] [up] [unit]

Pan to specific coordinate.
Places the camera in this position right and up relative to standard target point (as seen from viewpoint direction).

Available at all Geant4 states.

Parameters
right type d Omittable : current value is used as the default value.
up type d Omittable : current value is used as the default value.
unit type s Omittable : default value = m

rebuild [viewer-name]

Forces rebuild of graphical database.
By default, acts on current viewer. "/vis/viewer/list" to see possible viewers. Viewer becomes current.

Available at all Geant4 states.

Parameters
viewer-name type s Omittable : current value is used as the default value.

refresh [viewer-name]

Refreshes viewer.
By default, acts on current viewer. "/vis/viewer/list" to see possible viewers. Viewer becomes current.

Available at all Geant4 states.

Parameters
viewer-name type s Omittable : current value is used as the default value.

reset [viewer-name]

Resets viewer.
By default, acts on current viewer. "/vis/viewer/list" to see possible viewers. Viewer becomes current.

Available at all Geant4 states.

Parameters
viewer-name type s Omittable : current value is used as the default value.

resetCameraParameters [viewer-name]

Resets only the camera parameters.
By default, acts on current viewer. "/vis/viewer/list" to see possible viewers. Viewer becomes current.

Available at all Geant4 states.

Parameters
viewer-name type s Omittable : current value is used as the default value.

save [filename]

Write commands that define the current view to file.
Read them back into the same or any viewer with "/control/execute".
If the filename is omitted the view is saved to a file "g4_nn.g4view", where nn is a sequential two-digit number.
If the filename is "-", the data are written to G4cout.
If you are wanting to save views for future interpolation a recommended procedure is: save views to "g4_nn.g4view", as above, then move the files into a sub-directory, say, "views", then interpolate with"/vis/viewer/interpolate views"

Available at all Geant4 states.

Parameters
filename type s Omittable : default value =

scale [x-scale-multiplier] [y-scale-multiplier] [z-scale-multiplier]

Incremental (non-uniform) scaling.
Multiplies components of current scaling by components of this factor. Scales (x,y,z) by corresponding components of the resulting factor.

Available at all Geant4 states.

Parameters
x-scale-multiplier type d Omittable : current value is used as the default value.
y-scale-multiplier type d Omittable : current value is used as the default value.
z-scale-multiplier type d Omittable : current value is used as the default value.

scaleTo [x-scale-factor] [y-scale-factor] [z-scale-factor]

Absolute (non-uniform) scaling.
Scales (x,y,z) by corresponding components of this factor.

Available at all Geant4 states.

Parameters
x-scale-factor type d Omittable : current value is used as the default value.
y-scale-factor type d Omittable : current value is used as the default value.
z-scale-factor type d Omittable : current value is used as the default value.

select [viewer-name]

Selects viewer.
Specify viewer by name. "/vis/viewer/list" to see possible viewers.

Available at all Geant4 states.

Parameters
viewer-name type s

update [viewer-name]

Triggers graphical database post-processing for viewers using that technique.
For such viewers the view only becomes visible with this command. By default, acts on current viewer. "/vis/viewer/list" to see possible viewers. Viewer becomes current.

Available at all Geant4 states.

Parameters
viewer-name type s Omittable : current value is used as the default value.

zoom [multiplier]

Incremental zoom.
Multiplies current magnification by this factor.

Available at all Geant4 states.

Parameters
multiplier type d Omittable : current value is used as the default value.

zoomTo [factor]

Absolute zoom.
Magnifies standard magnification by this factor.

Available at all Geant4 states.

Parameters
factor type d Omittable : current value is used as the default value.