| |
- GenIV
-
- GenXCore
- X11rgb
class GenIV |
|
Class that handles generating OpenInventor 2.1/Coin ASCII geometry
files. The class tracks indenation for you and provides helpers
for both low level and high level constructs.
Most methods for this class emit IV geometry into the open file
handle. |
|
Methods defined here:
- __init__(self, filename='tmp.iv')
- Open a file handle for ASCII output to go into and write an IV header
Initialize the indent level and indent string
Arguments
filename -- file open for writing
- baseColor(self, color)
- Write a basecolor node
Arguments
color - [r,g,b] list or tuple - red, green, blue must be in the range of [0..1]
- beginSeparator(self, comment=None)
- Begin a separator block and increase indentation
Arguments:
comment - string to indentify a separator block
FIX: add the ability to name an object
- comment(self, string='#')
- Add a comment string to file
- coordinate3(self, points)
- Write an SoCoordinate3 node given a list of xyz's
- endSeparator(self, comment=None)
- End the last separator and unindent
FIX: use the name from the separator... maybe use a stack of names?
- header(self)
- Write an OpenInventor 2.1 ASCII header
- includeFile(self, filename)
- Have the current OpenInventor file include another file full of geometry
Arguments
out - open file handle to write to
filename - string containing the file to be included by reference
Wraps a separator for safety.
- indent(self, numlevels=1)
- Increase the indenting level. Starts at zero.
- indexedFaceSet(self, indices)
- SoIndexedLineSet
FIX: give example!
- indexedLineSet(self, indices)
- SoIndexedLineSet
FIX: give example!
- lineSet(self, numVerticeList=None)
- Handle the LineSet node
vertices = [ 3, 4, 2 ]
- pointSet(self, points, size=3, colors=None)
- Create a pointset
- rotationXYZ(self, axis='X', radians=None, degrees=None)
- Rotate about X,Y, or Z
- scale(self, x, y, z)
- Insert a scale node
- simpleLine(self, points)
- Create a single line connecting the points
- text3(self, string)
- Write out a 3D text item
- translation(self, x, y, z)
- Insert a translation node
- unindent(self, numlevels=1)
- Decrease the indenting level. Will not go below 0.
- write(self, string='\n', newline=True)
- Write a string to the open IV file. Appends a newline unless
you tell it not to do that.
Arguments:
string - A string to put in the IV file
newline - Set to false to prevent emitting an newline
|
class GenXCore(GenIV) |
|
Create XCore Open Inventor ascii geometry files |
|
Methods defined here:
- __init__(self, filename='tmp.iv')
- Open a file handle for ASCII output to go into and write an IV header
- annotations(self, textlist, scaleText=0.10000000000000001)
- Write out a line of text at a specified depth
out - open file handle to write to
textlist - list of tuples [(001,'junk'),(092,'toy car')]
>>> [(1,'junk'),(92,'toy car')]
- corePhoto(self, imageFileName, widthInCM, heightInCM)
- Writes out a separator block to wrap an image. Takes an inventor
file header in front just in case you want only this in the file.
Arguments:
outFile - open file handle to write header to
imageFileName - valid image to load in open inventor.
SGI Inventor can not handle a very wide range
widthInCM - assumes that one unit is one cm
heightInCM - assumes that one unit is one cm
- depthTextMarkers(self, maxDepth=200, step=10, emphasize=50)
- Create an IV file with text showing the depth down core.
out - open file handle for writing the iv file
maxDepth - how far to do down
step - distance between markings
emphasize - distance to show in a different color
- depthTick(self, maxDepth=200, step=1, width=1)
- Simpler tick maker
- depthTicks(self, maxDepth=200, step=10, width=10)
- Make ticks down core
- graph(self, data, width=30, title=None)
- Autoscale graph to width
Arguments:
out - open file handle for writing
data - list of depth value tuples like [(1, 0.87), (5,-.512), (10, 41.2), (15,-2.3)
title - String to put at the top
- graph3(self, data, width=30, xRange=None, title=None)
- Plot 3 values down core...
FIX: Just look at the tuple size to see how many things to plot
Arguments:
self - open file handle for writing
data - list of depth value tuples like [(1, 0.87), (5,-.512), (10, 41.2), (15,-2.3)
- graphList(self, dataLists, colorList, width=30, xRange=None, title=None)
- Plot n data streams together
Arguments:
dataLists -- n lists of x,y pairs
colorList -- n lists of colors for how to color the datalists
e.g.
from xcore import * # Get the colors
dataLists = [ [], [], [] ]
colorList = [ red, green, blue ]
- makeKey(self, colorStrList)
- Take color,name tuples and make an iv file key
colorStrList -- List of (color,string) tuples
e.g. [('red','this is red'),('blue','this is blue')
- markClassifications(self, layerClassificationList, typeLUT, width=10)
- layerlist - list of range tuples to be marked
e.g. [(74,76,l'),(82,84,'vl'),(104,105,'b'), (120,120.5,'l') ]
width - width of the marks in IV space
- markRegions(self, layerList, width=10, color=[1, 0, 0])
- layerlist - list of range tuples to be marked
e.g. [(74,76),(82,84),(104,105), (120,120.5) ]
width - width of the marks in IV space
color - [1,1,1] list of rgb going from 0..1 for each
- sampleLocations(self, depths, minExtent=0.0, maxExtent=1.0, width=5)
- Make a graph showing the coverage of samples
- scatterPlot(self, data, width=50, height=50, border=True, title='Scatter Plot', minX=None, maxX=None, minY=None, maxY=None, colors=None, pointSize=3, xlabel=None, ylabel=None)
- Make a scatter plot
FIX: want a totally separate graphing class!
FIX: deal with symbols
data is [(x1,y1),(x2,y2),....]
Methods inherited from GenIV:
- baseColor(self, color)
- Write a basecolor node
Arguments
color - [r,g,b] list or tuple - red, green, blue must be in the range of [0..1]
- beginSeparator(self, comment=None)
- Begin a separator block and increase indentation
Arguments:
comment - string to indentify a separator block
FIX: add the ability to name an object
- comment(self, string='#')
- Add a comment string to file
- coordinate3(self, points)
- Write an SoCoordinate3 node given a list of xyz's
- endSeparator(self, comment=None)
- End the last separator and unindent
FIX: use the name from the separator... maybe use a stack of names?
- header(self)
- Write an OpenInventor 2.1 ASCII header
- includeFile(self, filename)
- Have the current OpenInventor file include another file full of geometry
Arguments
out - open file handle to write to
filename - string containing the file to be included by reference
Wraps a separator for safety.
- indent(self, numlevels=1)
- Increase the indenting level. Starts at zero.
- indexedFaceSet(self, indices)
- SoIndexedLineSet
FIX: give example!
- indexedLineSet(self, indices)
- SoIndexedLineSet
FIX: give example!
- lineSet(self, numVerticeList=None)
- Handle the LineSet node
vertices = [ 3, 4, 2 ]
- pointSet(self, points, size=3, colors=None)
- Create a pointset
- rotationXYZ(self, axis='X', radians=None, degrees=None)
- Rotate about X,Y, or Z
- scale(self, x, y, z)
- Insert a scale node
- simpleLine(self, points)
- Create a single line connecting the points
- text3(self, string)
- Write out a 3D text item
- translation(self, x, y, z)
- Insert a translation node
- unindent(self, numlevels=1)
- Decrease the indenting level. Will not go below 0.
- write(self, string='\n', newline=True)
- Write a string to the open IV file. Appends a newline unless
you tell it not to do that.
Arguments:
string - A string to put in the IV file
newline - Set to false to prevent emitting an newline
|
class X11rgb |
|
###################################################################### |
|
Methods defined here:
- __init__(self, rgbfile='/usr/X11R6/lib/X11/rgb.txt', maxvalue=255)
- Load in the rgb.txt file from X11. Assumes X11 is available
maxvalue -- what do you want the range to be. Defaults to [0..255]
OpenInventor and others want [0..1] (maxvalue=1)
FIX: if the table is not available, give them at least 8 colors or something
| |