Vr Mapping

ON-LINE REFERENCE DOCUMENTATION

CARDINAL SYSTEMS, LLC

www.cardinalsystems.net

Graphics Class Reference (PyVrGr)

VrOne/Python Graphics class which manages VrOne window graphics operations More…

Members

Window management

GetWinCorner (Corner, WinNum)
GetWinSize ()
SetWinOrg (OrgX, OrgY, OrgZ)
GetWinOrg ()  
SetWinRot (RotX, RotY, RotZ)
GetWinRot ()            
SetWinScale (Scale)              
GetWinScale ()
SetActiveWin (Win)
GetActiveWin ()        

 

Drawing management

Replot ()                                
GetColor (PenNum, WinNum)                                  
PenNum (PenNum, WinNum)                        
SetDashed (LineLen, SpaceLen, UseInches, WinNum)
LineWidth (LineWidth, WinNum)
LineWidthD (LineWidth, WinNum)
DrawMode (DrawMode, WinNum)                                                                          
Plot (x, y, z, Pen, WinNum)
Plot1 (x, y, z, Pen, WinNum)                                      
Flush (WinNum)                                            
SetFlushMode (FlushMode, WinNum)
DrawMarker (x, y, z, Type, Radius, WinNum)
PlotMarker (x, y, z, Type, ScaleFac, WinNum)
EraseMarker ()
SetRband (x, y, z, Pen, WinNum)
SetRbandLast (WinNum)
HideRband (WinNum)
EraseRband (WinNum)
GetRbandState ()

 

Cursor management

GetCursor ()

 


Description

VrOne can open up to 8 graphics windows at one time. Each window can display vector graphics from the currently open workspaces at different locations, scales, and rotations. The Graphics class allows the user to draw graphics directly to any window or all windows at once. Several drawing modes, as well as calls for rubber-banding lines, are supported. This class also allows the window parameters such as Origin and Scale to be changed and queried, and the current cursor state to be queried.

 

NOTE: The windows numbers range from 0 to 7.

 

The following example centers the currently active window at coordinate 15.0, 15.0, 0.0, and then draws a large X at the center of the screen.

 

Gr = PyVrGr ()

 

Gr.SetWinOrg (15.0, 15.0, 0.0)

   

Gr.PenNum (1)

Gr.DrawMode (MODE_DRAW)

Gr.Plot (10.0, 10.0, 0.0, PEN_UP)

Gr.Plot (20.0, 20.0, 0.0, PEN_DOWN)

Gr.Plot (10.0, 20.0, 0.0, PEN_UP)

Gr.Plot (20.0, 10.0, 0.0, PEN_DOWN)

 


Member Function Documentation

Replot ()

Replots the graphics windows.

WinNum

Window number (-1=All,Default=-1)

GetWinCorner (Corner, Win)

Returns the origin of the active graphics window.

Corner

Corner to get (0=Lower Left, 1=Lower Right, 2=Upper Right, 3=Upper Left)

WinNum

Window number (0=First window)

Returns

CorX, CorY, CorZ = Corner of graphics window (ground)

GetWinSize ()

Returns the size of the active graphics window.

Returns

Width. Height = Width and height of active window (ground)

SetWinOrg (OrgX, OrgY, OrgZ)

Sets the origin of the active graphics window.

OrgX, OrgY, OrgZ

Origin of graphics window (ground)

Returns

void

 

Example

Gr.SetWinOrg (15.0, 15.0, 0.0)

GetWinOrg ()

Returns the origin of the active graphics window.

Returns

OrgX, OrgY, OrgZ = Origin of graphics window (ground).

 

Example

(OrgX, OrgY, OrgZ) = Gr.GetWinOrg ()

SetWinRot (RotX, RotY, RotZ)

Sets the rotation of the active graphics window.

RotX, RotY, RotZ

Rotation of graphics window (radians)

Returns

void

 

Example

Gr.SetWinRot (0.0, 0.0, PI/4.0) # Set z rotation to 45 degrees

GetWinRot ()

Returns the rotation of the active graphics window.

Returns

RotX, RotY, RotZ

 

RotX, RotY, RotZ

Return rotation of graphics window (radians).

 

Example

(RotX, RotY, RotZ) = Ws.GetWinRot ()

SetWinScale (Scale)

Sets the scale of the active graphics window.

Scale

Scale (1"=).

Returns

void

 

Example

Gr.SetWinScale (50.0)

GetWinScale ()

Returns the scale of the active graphics window.

Returns

Scale = Return window scale (1"=)

 

Example

(Scale) = Gr.GetWinScale ()

SetActiveWin (Win)

Sets the active window class to which to communicate parameters.

ActiveWin

Active window to set.

Returns

void

 

Example

Gr.SetActiveWin (0)

GetActiveWin ()

Returns the active window class to which parameters are communicated.

Returns

ActiveWin - Number of active window

 

Example

ActiveWin = Gr.GetActiveWin ()

GetColor (PenNum, WinNum)

Returns the RGB color values of the specified pen.

PenNum ->   WinNum   ->

PenNum

Pen Number.

WinNum

Window number.

Returns

Red, Green, Blue.

 

Red

Red color component (0-255).

 

Green

Green color component (0-255).

 

Blue

Blue color component (0-255).

 

Example

(red, green, blue) = Gr. GetColor (1, 0)

PenNum (PenNum, WinNum)

Sets the current pen number.

PenNum

Pen Number

WinNum

Window number (-1=All, Default=-1)

Returns

void

 

Example

Gr.PenNum (2)

SetDashed (LineLen, SpaceLen, UseInches, WinNum)

Makes current line font represent a dashed line.

NOTE: This only works with the Plot1 command.

LineLen          

Length of line (ground or inches).

SpaceLen

Length of space (ground or inches).

UseInches

1=Lengths are in inches.

0=Lengths are in ground units.

WinNum

Window number (-1=All)

Returns

void

 

Example

Gr.SetDashed (0.2, 0.1, 1)

LineWidth (LineWidth, WinNum)

Sets the current line if the hardware device is capable.

Width  

Line width in pixels (integer).

WinNum

Window number (-1=All, Default=-1).

Returns

void

 

Example

Gr.LineWidth (2)

LineWidthD (LineWidth, WinNum)

Sets the current line if the hardware device is capable.

Width  

Line width in ground units (floating point number).

WinNum

Window number (-1=All, Default=-1).

Returns

void

 

Example

Gr.LineWidth (2)

DrawMode (DrawMode, WinNum)

Sets the current draw mode.

DrawMode

1 = Draw     - MODE_DRAW

2 = Erase     - MODE_ERASE

3 = Exclusive - MODE_XOR

4 = Or           - MODE_OR

WinNum

Window number (-1=All, Default=-1).

Returns

void

 

Example

Gr.DrawMode (MODE_DRAW)

Plot (x, y, z, Pen, WinNum)

Plots a line.

x, y, z  

Coordinates.

Pen      

Pen command.

1=up PEN_UP

2=down PEN_DOWN

4=end PEN_END (optional)

(default=0)

WinNum

Window number (-1=All, Default=-1)

Returns

void

 

Example

# Draw a line segment

Gr.Plot (10.0, 25.54, 5.6, 1)  

Gr.Plot (60.76, 312.32, 7.8, 2)

Plot1 (x, y, z, Pen, WinNum)

Plots a line with fonting (works with SetDashed method).

x, y, z  

Coordinate to plot

Pen      

Pen command.

1=up PEN_UP

2=down PEN_DOWN

4=end PEN_END (optional)

(default=0)

WinNum

Window number (-1=All, Default=-1)

Returns

void

 

Example

# Draw a line segment

Gr.Plot (10.0, 25.54, 5.6, 1)  

Gr.Plot (60.76, 312.32, 7.8, 2)

Flush (WinNum)

Flushes graphics buffer.

WinNum

Window number (-1=All, Default=-1)

Returns

void

 

Example

Gr.Flush ()

SetFlushMode (FlushMode, WinNum)

Sets flush mode.

FlushMode

0 - Ignore all flushes until FlushMode is set to 1. This is normally used for a screen replot.

1 - Process all flushes.

WinNum

Window number (-1=All, Default=-1)

Returns

void

 

Example

Gr.SetFlushMode (1)

DrawMarker (x, y, z, Type, Radius, WinNum)

Draws a marker with the current draw mode and color.

x, y, z

Ground position coordinates to plot marker

Type  

Type of marker (MARK_CROSS|MARK_SQUARE | MARK_X | MARK_CIR|MARK_ TRI|MARK_CIRX||MARK_CIRCROSS (default=MARK_CROSS)

Radius

Radius in ground units (-1 =Plot scaled to view, default=-1)

WinNum

Window number (-1=All, Default=-1)

Returns

void

 

Example

Gr.DrawMarker (100.23, 106.34, MARK_X, 1.0)

PlotMarker (x, y, z, Type, ScaleFac, WinNum)

Plots tentative marker.

x, y, z

Ground position to plot marker

Type  

Type of marker (MARK_CROSS|MARK_SQUARE | MARK_X | MARK_CIR) (default=MARK_CROSS)

ScaleFac

Scale Factor 1.0 = 1/10 inch (default=1.0)

WinNum

Window number (-1=All, Default=-1)

Returns

void

 

Example

Gr.PlotMarker (100.23, 106.34, MARK_CROSS, 2.0)

EraseMarker ()

Erases tentative marker at its last location.

NOTE: PlotMarker MUST have been called first.

Returns

void

 

Example

Gr.EraseMarker ()

SetRband (x, y, z, Pen, WinNum)

Draws rubber-banded line segment.

x, y, z

Current point

Pen  

Pen command 1=Start point, 2=End point

WinNum

Window number (-1=All, Default=-1)

Returns

void

 

Example

Gr.SetRband (10.0, 10.0, 0.0, 1)

while (reading_input):

          # Insert code to read from input device into curx, cury, curz    

          Gr.SetRband (curx, cury, curz, 2)

SetRbandLast (WinNum)

Draws rubber-banded line segment at it's last position.

WinNum

Window number (-1=All, Default=-1)

Returns

void

 

Example

Gr.SetRbandLast ()

HideRband (WinNum)

Hides the current rubber-banded line segment if visible.

WinNum

Window number (-1=All, Default=-1)

Returns

void

 

Example

Gr.HideRband ()

EraseRband (WinNum)

Erases rubber-banded line segment at it's last position.

WinNum

Window number (-1=All, Default=-1)

Returns

void

 

Example

Gr.EraseRband ()

GetRbandState ()

Returns the rubber band state of the active window.

Returns

0=Rubber band is not visible

1=Rubber band is visible

 

Example

State = Gr.GetRbandState ()

GetCursor ()

Returns the current cursor state.

Returns

x, y, z, key

 

x, y, z

Current cursor position (ground)

 

key

Current key being pressed (-1 = None)

 

Example

(x, y, z, key) = Gr.GetCursor ()