A drawing is the container for a geometric object. The Drawing object stores the vertex data and various settings that determine how the drawing will be displayed.
session.drawings[name]
This method creates an empty Drawing object.
session.Drawing
Required argument
A String specifying the repository key.
Optional arguments
Return value
A Drawing object.
Exceptions
ValueError.
If the user attempts to create a new drawing with the name of an existing drawing:
This method accepts the vertex data that defines the Drawing object. It defines in an array of vertices with a length equal to the length of the vertexData sequence divided by vertexDimension.
Required arguments
An Integer in the range of 2 to 4 specifying how many Float values are needed to compose a single vertex.
A sequence of Float values that will be used to compose the vertices. There must be vertexDimension values in the sequence for each vertex.
Optional arguments
Return value
The number of vertices described.
Exceptions
RangeError.
ValueError.
If an invalid vertexDimension is specified:
If vertexData is an empty sequence:
If setVertices has already been called and this call is sending fewer vertices:
This method accepts the normal data for each vertex. It defines in an array of normal vectors with a length equal to the length of the normalData sequence divided by 3.
Required argument
A sequence of Float values that will be used to compose the normals. There must be 3 values in the sequence for each normal.
If only one normal is specified, all vertices will use the normal value.
Optional arguments
Return value
The number of normals described.
Exceptions
RangeError.
ValueError.
If normalData is sequence with less than 3 values:
If setNormals has already been called and this call is sending fewer values:
This method accepts the color data for each vertex. It defines in an array of colors with a length equal to the length of the colorData sequence divided by colorDimension.
Required arguments
An Integer in the range of 3 to 4 specifying how many Float values are needed to compose a single color.
A sequence of Float values in the range of 0.0 to 1.0 that will be used to compose the colors. There must be colorDimension values in the sequence for each color. The first color will be associated with the fist vertex and so on.
The first Float will be the red value for the first color. The second Float will be the green value and the third will be the blue value. When colorDimension is 4 the 4th Float will be the alpha value for the first color but is ignored.
If only one color is specified, all vertices will use the color value.
Optional arguments
Return value
The number of colors described.
Exceptions
RangeError.
ValueError.
If an invalid colorDimension is specified:
If colorData is an empty sequence:
If setColors has already been called and this call is sending fewer colors:
This method allows a separate, single color to be used when rendering the edges of the drawing. Once called, edges will be rendered using the specified color but facets will continue to use the colors specified in the setColors method. An empty sequence can be specified to resume using the colors arrays for edges.
Required argument
A sequence of 0 or 3 Float values in the range of 0.0 to 1.0 that will be used to compose the edge color.
If the initial Float value is -1, the viewport background color will be used for the edge color.
Optional arguments
Return value
Exceptions
ValueError.
If edgeColor is not a sequence of 0 or 3 Floats:
This method allows a separate, single color to be used when rendering the points of the drawing. Once called, points will be rendered using the specified color but facets will continue to use the colors specified in the setColors method. An empty sequence can be specified to resume using the colors arrays for points.
Required argument
A sequence of 0 or 3 Float values in the range of 0.0 to 1.0 that will be used to compose the point color.
If the initial Float value is -1, the viewport background color will be used for the edge color.
Optional arguments
Return value
Exceptions
ValueError.
If pointColor is a not sequence of 0 or 3 Floats:
This method adds a rendering command to the drawing and can be called multiple times to add additional rendering commands. When the drawing is referenced by a Viewport, the drawing commands are used the render the Drawing.
The rendering command constructs the specified type of geometric primitive using numVertices array elements starting at element index startIndex.
Required arguments
A SymbolicConstant specifying the type of graphics primitive rendered by this command. Possible values are POINTS, LINES, LINE_LOOP, LINE_STRIP, TRIANGLES, TRIANGLE_STRIP, TRIANGLE_FAN, QUADS, and QUAD_STRIP.
An Integer specifying the index of the first vertex to render.
An Integer specifying the total number of vertices to render.
Optional argument
A SymbolicConstant specifying how polygonal graphics primitives will be rendered by this command. Possible values are FILL, EDGES, and POINTS. The default value is FILL.
Return value
The total number of rendering commands that have been specified.
Exceptions
ValueError.
If (startIndex + numVertices - 1) is larger than the length of the vertex array:
If (startIndex + numVertices - 1) is larger than the length of the normal array and normals are required for the graphics primitive:
If (startIndex + numVertices - 1) is larger than the length of the color array and vertex colors are required for the graphics primitive:
This method adds a rendering command to the drawing and can be called multiple times to add additional rendering commands. When the drawing is referenced by a Viewport, the drawing commands are used the render the Drawing.
The rendering command constructs the specified type of geometric primitive using numVertices array elements starting at element index startIndex.
Required arguments
A SymbolicConstant specifying the type of graphics primitive rendered by this command. Possible values are POINTS, LINES, LINE_LOOP, LINE_STRIP, TRIANGLES, TRIANGLE_STRIP, TRIANGLE_FAN, QUADS, and QUAD_STRIP.
A sequence of Integer values specifying index of each vertex to render.
Optional argument
A SymbolicConstant specifying how polygonal graphics primitives will be rendered by this command. Possible values are FILL, EDGES, and POINTS. The default value is FILL.
Return value
The total number of rendering commands that have been specified.
Exceptions
ValueError.
If any value in the indices sequence negative:
If any value in the indices sequence is larger than the length of the vertex array:
If any value in the indices sequence is larger than the length of the normal array and normals are required for the graphics primitive:
If any value in the indices sequence is larger than the length of the color array and vertex colors are required for the graphics primitive:
This method modifies the rendering of the Drawing object.
Required arguments
Optional arguments
A Boolean specifying whether the drawing object will be rendered when referenced. The default value is OFF.
A Boolean specifying whether polygonal graphics primitives facing away from the viewer should be culled (not rendered). The default value is OFF.
The winding order, and not the normal, of the graphics primitive is used to determine its facing.
A SymbolicConstant specifying the winding order for polygonal graphics primitives that face the viewer. Possible values are:
The default value is CCW.
CCW, specifying front face winding order is counter-clockwise.
CW, specifying front face winding order is clockwise.
A Boolean specifying whether the lighting of polygonal graphics primitives is consistent for each facet or calculated for each displayed pixel. The default value is ON.
When False, only the last normal for each facet will be used in the lighting calculation.
A Boolean specifying whether edge and point drawing commands will be issued in a FILLED or SHADED display. The default value is ON.
If no edge or point drawing commands have been defined, the polygonal drawing commands will be issued in WIREFRAME and HIDDEN_LINE displays with the polygonMode set to EDGES. If only edge and point drawing commands have been defined, the Drawing will not be rendered in FILLED or SHADED displays.
A Float specifying the opacity for polygonal graphics primitives. Possible values are 0.0 translucency 1.0 with 0.0 being completely transparent (invisible) and 1.0 being opaque. The default value is 1.0.
A value greater than 0.3 will cause the translucent facets to be sorted by depth before being rendered and has the side effect of disabling two-sided lighting for those facets.
A Float specifying the width of the line, in millimeters, used to render edges. Possible values are 0.0 lineSize 5.0 with 0.0 being interpreted as the thinnest possible line. The default value is 0.0.
A value of 0.0 will be one pixel on the output device. One pixel on the screen is generally visible but one pixel on a 1200 DPI printer may not be clear.
A Float specifying the width of points, in millimeters, used to render points. Possible values are 0.0 lineSize 5.0 with 0.0 being interpreted as the smallest possible point. The default value is 0.0.
A value of 0.0 will be one pixel on the output device. One pixel on the screen is generally visible but one pixel on a 1200 DPI printer may not be clear.
Return value
Exceptions
RangeError.
If an invalid translucency value is specified:
If an invalid lineSize value is specified:
If an invalid pointSize value is specified:
The Drawing object has members with the same names and descriptions as the arguments to the Drawing method.
In addition, the Drawing object has the following members:
An Int specifying the number of vertices in the vertex array after a call to the setVertices method. The default value is 0.
An Int specifying the number of normal vectors in the normal array after a call to the setNormals method. The default value is 0.
An Int specifying the number of colors in the color array after a call to the setColors method. The default value is 0.
A Boolean specifying whether the drawing object will be rendered when referenced. The default value is OFF.
A Boolean specifying whether polygonal graphics primitives facing away from the viewer should be culled (not rendered). The default value is OFF.
The winding order, and not the normal, of the graphics primitive is used to determine its facing.
A SymbolicConstant specifying the winding order for polygonal graphics primitives that face the viewer. Possible values are:
The default value is CCW.
CCW, specifying front face winding order is counter-clockwise.
CW, specifying front face winding order is clockwise.
A Float specifying the opacity for polygonal graphics primitives. Possible values are 0.0 translucency 1.0 with 0.0 being completely transparent (invisible) and 1.0 being opaque. The default value is 1.0.
A value greater than 0.3 will cause the translucent facets to be sorted by depth before being rendered and has the side effect of disabling two-sided lighting for those facets.
A Float specifying the width of the line, in millimeters, used to render edges. Possible values are 0.0 lineSize 5.0 with 0.0 being interpreted as the thinnest possible line. The default value is 0.0.
A value of 0.0 will be one pixel on the output device. One pixel on the screen is generally visible but one pixel on a 1200 DPI printer may not be clear.
A Float specifying the width of points, in millimeters, used to render points. Possible values are 0.0 lineSize 5.0 with 0.0 being interpreted as the smallest possible point. The default value is 0.0.
A value of 0.0 will be one pixel on the output device. One pixel on the screen is generally visible but one pixel on a 1200 DPI printer may not be clear.
A Boolean specifying whether the lighting of polygonal graphics primitives is consistent for each facet or calculated for each displayed pixel. The default value is ON.
When False, only the last normal for each facet will be used in the lighting calculation.
A Boolean specifying whether edge and point drawing commands will be issued in a FILLED or SHADED display. The default value is ON.
If no edge or point drawing commands have been defined, the polygonal drawing commands will be issued in WIREFRAME and HIDDEN_LINE displays with the polygonMode set to EDGES. If only edge and point drawing commands have been defined, the Drawing will not be rendered in FILLED or SHADED displays.
A tuple of three Floats specifying the Red, Green, and Blue component values for the edge color. Possible values for each component are between 0.0 and 1.0.
A tuple of three Floats specifying the Red, Green, and Blue component values for the point color. Possible values for each component are between 0.0 and 1.0.