gtrace.draw package¶
Submodules¶
gtrace.draw.draw module¶
Drawing classes for gtrace
-
class
gtrace.draw.draw.
Arc
(center, radius, startangle, stopangle, thickness=0, angle_in_rad=True)¶ Bases:
gtrace.draw.draw.Shape
An arc
Note that angles are stored in rad.
-
class
gtrace.draw.draw.
Canvas
(unit='m')¶ Bases:
object
Canvas class
-
add_layer
(name, color=(0, 0, 0))¶
-
add_shape
(shape, layername)¶
-
-
class
gtrace.draw.draw.
Circle
(center, radius, thickness=0)¶ Bases:
gtrace.draw.draw.Shape
A circle
-
class
gtrace.draw.draw.
Line
(start, stop, thickness=0)¶ Bases:
gtrace.draw.draw.Shape
Line class
-
exception
gtrace.draw.draw.
NumberOfElementError
¶ Bases:
BaseException
-
class
gtrace.draw.draw.
PolyLine
(x, y, thickness=0)¶ Bases:
gtrace.draw.draw.Shape
A light weight poly-line
-
class
gtrace.draw.draw.
Rectangle
(point, width, height, thickness=0)¶ Bases:
gtrace.draw.draw.Shape
A rectangle
-
class
gtrace.draw.draw.
Shape
¶ Bases:
object
Shape class
-
class
gtrace.draw.draw.
Text
(text, point, height=1.0, rotation=0.0, angle_in_rad=True)¶ Bases:
gtrace.draw.draw.Shape
Note that angles are stored in rad.
gtrace.draw.dxf module¶
dxf.py - a DXF export library for python
Sample code:
import dxf d = dxf.DXF(‘test.dxf’) d.add_layer(‘ABC’, color=5) d.add_entity(dxf.Line((1.5,5), (56,-89)), ‘ABC’) d.save_to_file()
-
class
gtrace.draw.dxf.
Arc
(center, radius, startangle, stopangle, thickness=0)¶ Bases:
gtrace.draw.dxf.Entity
An arc entity
-
draw
(layername)¶
-
report_min_max
()¶ Return the coordinates of the lower left and the upper right corners of the drawing. Return value: ((xmin, ymin), (xmax, ymax))
-
-
class
gtrace.draw.dxf.
Circle
(center, radius, thickness=0)¶ Bases:
gtrace.draw.dxf.Entity
A circle entity
-
draw
(layername)¶
-
report_min_max
()¶ Return the coordinates of the lower left and the upper right corners of the drawing. Return value: ((xmin, ymin), (xmax, ymax))
-
-
class
gtrace.draw.dxf.
DXF
(filename='drawing.dxf')¶ Bases:
object
A DXF file class.
-
add_entity
(entity, layername)¶
-
add_layer
(name, color=1, ltype='Continuous')¶
-
save_to_file
()¶ Save the DXF file
-
-
class
gtrace.draw.dxf.
Entity
¶ Bases:
object
A graphic entity
-
draw
()¶
-
report_min_max
()¶ Return the coordinates of the lower left and the upper right corners of the drawing. Return value: ((xmin, ymin), (xmax, ymax))
-
set_handle
(handle)¶
-
-
class
gtrace.draw.dxf.
Layer
(name, handle, color=1, ltype='Continuous')¶ Bases:
object
Layer class
-
add_entity
(entity)¶
-
-
class
gtrace.draw.dxf.
Line
(start, stop, thickness=0)¶ Bases:
gtrace.draw.dxf.Entity
A line entity
-
draw
(layername)¶
-
report_min_max
()¶ Return the coordinates of the lower left and the upper right corners of the drawing. Return value: ((xmin, ymin), (xmax, ymax))
-
-
class
gtrace.draw.dxf.
LwPolyLine
(x, y, thickness=0)¶ Bases:
gtrace.draw.dxf.Entity
A light weight poly-line
-
draw
(layername)¶
-
report_min_max
()¶ Return the coordinates of the lower left and the upper right corners of the drawing. Return value: ((xmin, ymin), (xmax, ymax))
-
-
exception
gtrace.draw.dxf.
NumberOfElementError
¶ Bases:
BaseException
-
class
gtrace.draw.dxf.
Rectangle
(point, width, height, thickness=0)¶ Bases:
gtrace.draw.dxf.Entity
A rectangle
-
draw
(layername)¶
-
report_min_max
()¶ Return the coordinates of the lower left and the upper right corners of the drawing. Return value: ((xmin, ymin), (xmax, ymax))
-
-
class
gtrace.draw.dxf.
Text
(text, point, height=1.0, rotation=0.0)¶ Bases:
gtrace.draw.dxf.Entity
-
draw
(layername)¶
-
report_min_max
()¶ Return the coordinates of the lower left and the upper right corners of the drawing. Return value: ((xmin, ymin), (xmax, ymax))
-
-
gtrace.draw.dxf.
color_encode
(color)¶ Given a set of RGB values for a color, find the closest matching one from the pre-defined colors in the DXF specification. Then return its color code (an integer in 1 to 255).
= Input = color: A tuple of three numbers in the range of 0-255, i.e. (R,G,B)
= Return = best_color_num: integer
-
gtrace.draw.dxf.
test_func
()¶
gtrace.draw.renderer module¶
Renderer module for gtrace.draw
-
exception
gtrace.draw.renderer.
UnknownShapeError
¶ Bases:
BaseException
-
gtrace.draw.renderer.
renderDXF
(canvas, filename)¶ Render a canvas into a DXF file
gtrace.draw.tools module¶
-
gtrace.draw.tools.
drawAllBeams
(d, beamList, sigma=3.0, drawWidth=True, drawPower=False, drawROC=False, drawGouy=False, drawOptDist=False, layer=None, mode='x', fontSize=0.01)¶
-
gtrace.draw.tools.
drawAllOptics
(d, opticsList, drawName=True, layer=None)¶
-
gtrace.draw.tools.
drawOptSys
(optList, beamList, filename, fontSize=False)¶
-
gtrace.draw.tools.
rotateAll
(objList, angle, center)¶
-
gtrace.draw.tools.
transAll
(objList, transVect)¶