Module cad_viewer_widget.widget
This module is the Python part of the CAD Viewer widget
Functions
def get_viewer_by_id(id_)def get_viewers_by_id()
Classes
class AnimationTrack (path, action, times, values)-
Defining a three.js animation track.
Parameters
path:string- The path (or id) of the cad object for which this track is meant.
Usually of the form
/top-level/level2/... action:{"t", "tx", "ty", "tz", "q", "rx", "ry", "rz"}-
The action type:
- "tx", "ty", "tz" for translations along the x, y or z-axis
- "t" to add a position vector (3-dim array) to the current position of the CAD object
- "rx", "ry", "rz" for rotations around x, y or z-axis
- "q" to apply a quaternion to the location of the CAD object
times:listoffloatorint- An array of floats describing the points in time where CAD object (with id
path) should be at the location defined byactionandvalues values:listoffloatorint-
An array of same length as
timesdefining the locations where the CAD objects should be according to theactionprovided. Formats:- "tx", "ty", "tz": float distance to move
- "t": 3-dim tuples or lists defining the positions to move to
- "rx", "ry", "rz": float angle in degrees
- "q" quaternions of the form (x,y,z,w) the represent the rotation to be applied
Examples
AnimationTrack( '/bottom/left_middle/lower', # path 'rz', # action [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0], # times (seconds) [-15.0, -15.0, -15.0, 9.7, 20.0, 9.7, -15.0, -15.0, -15.0] # angles ) AnimationTrack( 'base/link_4_6', # path 't', # action [0.0, 1.0, 2.0, 3.0, 4.0], # times (seconds) [[0.0, 0.0, 0.0], [0.0, 1.9509, 3.9049], [0.0 , -3.2974, -16.7545], [0.0 , 0.05894 , -32.0217], [0.0 , -3.2212, -13.3424]] # 3-dim positions )See Also
Methods
def to_array(self)-
Create an array representation of the animation track
Returns
array-like- The 4 dim array comprising of the instance variables
path,action,timesandvalues
class CadViewer (cad_width=800,
height=600,
tree_width=240,
aspect_ratio=0.75,
theme='browser',
glass=False,
tools=True,
pinning=False,
title=None,
anchor=None,
new_tree_behavior=True,
id_=None)-
The main class for the CAD Viewer encapsulating the three-cad-viewer Javascript module
Parameters
cad_width:int, default: 800- Width of the canvas element
height:int, default: 600- Height of the canvas element
tree_width:int, default: 240- Width of the navigation tree element
theme:string, default: 'light'- UI theme, can be 'dark' or 'light' (default)
tools:bool, default: True- Whether to show CAD tools (True) or not (False)
glass:bool, default: False- Whether to use glass mode (True) or not (False)
pinning:bool, default: False- Whether to allow replacing the CAD View by a canvas screenshot
See Also
Instance variables
prop ambient_intensity-
Get or set the CadViewerWidget traitlet
ambient_intensity. see CadViewerWidget.ambient_intensity prop axes-
Get or set the CadViewerWidget traitlet
axessee CadViewerWidget.axes prop axes0-
Get or set the CadViewerWidget traitlet
axes0see CadViewerWidget.axes0 prop black_edges-
Get or set the CadViewerWidget traitlet
black_edgessee CadViewerWidget.black_edges prop cad_width-
Get or set the CadViewerWidget traitlet
cad_widthsee CadViewerWidget.tools prop center_grid-
Get or set the CadViewerWidget traitlet
center_gridsee CadViewerWidget.grid prop clip_intersection-
Get or set the CadViewerWidget traitlet
clip_intersectionsee CadViewerWidget.clip_intersection prop clip_normal_0-
Get or set the CadViewerWidget traitlet
clip_normal_0see CadViewerWidget.clip_normal_0 prop clip_normal_1-
Get or set the CadViewerWidget traitlet
clip_normal_1see CadViewerWidget.clip_normal_1 prop clip_normal_2-
Get or set the CadViewerWidget traitlet
clip_normal_2see CadViewerWidget.clip_normal_2 prop clip_object_colors-
Get or set the CadViewerWidget traitlet
clip_object_colorssee CadViewerWidget.clip_planes prop clip_planes-
Get or set the CadViewerWidget traitlet
clip_planessee CadViewerWidget.clip_planes prop clip_slider_0-
Get or set the CadViewerWidget traitlet
clip_slider_0see CadViewerWidget.clip_slider_0 prop clip_slider_1-
Get or set the CadViewerWidget traitlet
clip_slider_1see CadViewerWidget.clip_slider_1 prop clip_slider_2-
Get or set the CadViewerWidget traitlet
clip_slider_2see CadViewerWidget.clip_slider_2 prop collapse-
Get or set the CadViewerWidget traitlet
collapsesee CadViewerWidget.collapse prop control-
Get or set the CadViewerWidget traitlet
controlsee CadViewerWidget.control prop debug-
Get or set the CadViewerWidget traitlet
debugsee CadViewerWidget.debug prop default_edgecolor-
Get or set the CadViewerWidget traitlet
default_edgecolorsee CadViewerWidget.default_edgecolor prop default_opacity-
Get or set the CadViewerWidget traitlet
default_opacitysee CadViewerWidget.default_opacity prop direct_intensity-
Get or set the CadViewerWidget traitlet
direct_intensitysee CadViewerWidget.direct_intensity prop disposed-
Whether the Javascript viewer is disposed
prop explode-
Get or set the CadViewerWidget traitlet
explodesee CadViewerWidget.explode prop glass-
Get or set the CadViewerWidget traitlet
glasssee CadViewerWidget.tools prop grid-
Get or set the CadViewerWidget traitlet
gridsee CadViewerWidget.grid prop height-
Get or set the CadViewerWidget traitlet
heightsee CadViewerWidget.tools prop keymap-
Get or set the CadViewerWidget traitlet
keymapsee CadViewerWidget.keymap prop last_pick-
Get or set the CadViewerWidget traitlet
lastPicksee CadViewerWidget.lastPick prop metalness-
Get or set the CadViewerWidget traitlet
metalnesssee CadViewerWidget.direct_intensity prop new_tree_behavior-
Get or set the CadViewerWidget traitlet
new_tree_behaviorsee CadViewerWidget.new_tree_behavior prop normal_len-
Get or set the CadViewerWidget traitlet
normal_len prop ortho-
Get or set the CadViewerWidget traitlet
orthosee CadViewerWidget.ortho prop pan_speed-
Get or set the CadViewerWidget traitlet
pan_speedsee CadViewerWidget.pan_speed prop pinning-
Get or set the CadViewerWidget traitlet
pinningsee CadViewerWidget.pinning prop position-
Get or set the CadViewerWidget traitlet
positionsee CadViewerWidget.position prop quaternion-
Get or set the CadViewerWidget traitlet
quaternionsee CadViewerWidget.quaternion prop rotate_speed-
Get or set the CadViewerWidget traitlet
rotate_speedsee CadViewerWidget.rotate_speed prop roughness-
Get or set the CadViewerWidget traitlet
roughnesssee CadViewerWidget.direct_intensity prop states-
Get the states of the objects in the navigation tree
prop tab-
Get or set the CadViewerWidget traitlet
keymapsee CadViewerWidget.keymap prop target-
Get or set the CadViewerWidget traitlet
targetsee CadViewerWidget.position prop tools-
Get or set the CadViewerWidget traitlet
toolssee CadViewerWidget.tools prop transparent-
Get or set the CadViewerWidget traitlet
transparentsee CadViewerWidget.transparent prop tree_width-
Get or set the CadViewerWidget traitlet
tree_widthsee CadViewerWidget.tools prop up-
Get or set the CadViewerWidget traitlet
upsee CadViewerWidget.up prop zoom-
Get or set the CadViewerWidget traitlet
zoomsee CadViewerWidget.zoom prop zoom_speed-
Get or set the CadViewerWidget traitlet
zoom_speedsee CadViewerWidget.zoom_speed
Methods
def add_shapes(self,
shapes,
tracks=None,
normal_len=0,
default_edgecolor='#707070',
default_opacity=0.5,
ambient_intensity=1.0,
direct_intensity=1.1,
metalness=0.3,
roughness=0.65,
tools=None,
glass=None,
new_tree_behavior=None,
control=None,
up=None,
ortho=True,
axes=None,
axes0=None,
grid=None,
center_grid=None,
explode=None,
ticks=10,
transparent=None,
black_edges=None,
collapse=None,
position=None,
quaternion=None,
target=None,
zoom=None,
reset_camera=None,
clip_slider_0=None,
clip_slider_1=None,
clip_slider_2=None,
clip_normal_0=None,
clip_normal_1=None,
clip_normal_2=None,
clip_intersection=None,
clip_planes=None,
clip_object_colors=None,
zoom_speed=None,
pan_speed=None,
rotate_speed=None,
timeit=False,
debug=False)-
Adding shapes to the CAD view
Parameters
shapes:dict- Nested tessellated shapes
tracks:listortuple, defaultNone- List of animation track arrays, see AnimationTrack.to_array
title:str, default: None- Name of the title view to display the shapes.
ortho:bool, defaultTrue- Whether to use orthographic view (True) or perspective view (False)
cad_width:int, default: None- Width of the canvas element
height:int, default: None- Height of the canvas element
tree_width:int, default: None- Width of the navigation tree element
tools:bool, default: None- Whether to show CAD tools (True) or not (False)
glass:bool, default: None- Whether to use glass mode (True) or not (False)
control:string, default'trackball'- Whether to use trackball controls ('trackball') or orbit controls ('orbit')
up:string, default'Z'- Whether camera up direction is Z ('Z') or Y ('Y') or the lagacy Z orientation ('L')
axes:bool, defaultFalse- Whether to show coordinate axes (True) or not (False)
axes0:bool, defaultFalse- Whether to center coordinate axes at the origin [0,0,0] (True) or at the CAD object center (False)
grid:3-dim listofbool, defaultNone- Whether to show the grids for
xy,xz,yz(Nonemeans(False, False, False)) explode:bool, default: None- Whether to show the explode widget (True) or not (False)
ticks:int, default10- Hint for the number of ticks for the grids (will be adjusted for nice intervals)
transparent:bool, defaultFalse- Whether to show the CAD objects transparently (True) or not (False)
black_edges:bool, defaultFalse- Whether to shows the edges in black (True) or not(False)
collapse:int, default0- Collapse CAD tree (1: collapse nodes with single leaf, 2: collapse all nodes)
normal_Len:int, default0- If > 0, the vertex normals will be rendered with the length given be this parameter
default_edgecolor:string, default"#707070"- The default edge color in web format, e.g. '#707070'
default_opacity:float, default0.5- The default opacity level for transparency between 0.0 an 1.0
ambient_intensity:float, default1.0- The intensity of the ambient light
direct_intensity:float, default1.1- The intensity of the direct light
metalness:float, default0.3- The degree of material metalness
roughness:float, default0.65- The degree of material roughness
position:3-dim listoffloat, defaultNone- Position of the camera as a 3-dim tuple of float (x,y,z)
quaternion:4-dim listoffloat, defaultNone- Rotation of the camera as 4-dim quaternion (x,y,z,w)
target:3-dim listoffloat, defaultNone- Camera target to look at, default is the center of the object's bounding box
zoom:float, defaultNone- Zoom value of the camera
reset_camera:bool, defaultTrue- Keep the camera position and rotation when showing new shapes (True) or not (False)
zoom_speed:float, default1.0- Speed of zooming with the mouse
pan_speed:float, default1.0- Speed of panning with the mouse
rotate_speed:float, default1.0- Speed of rotation with the mouse
timeit:bool, defaultFalse- Whether to output timing info to the browser console (True) or not (False)
Examples
A simple cube with edge len of 1 is tessellated like the
shapeelement of the first (and only) element of thepartslist:shapes = { "name": "Group", "id": "/Group", "loc": None, # would be (<position>, <quaternion>), e.g. ([0,0,0), (0,0,0,1)]), "bb": { "xmin": -0.5, "xmax": 0.5, "ymin": -0.5, "ymax": 0.5, "zmin": -0.5, "zmax": 0.5 } "parts": [{ "name": "Part_0", "id": "/Group/Part_0", "type": "shapes", "shape": {"vertices": [ [-0.5, -0.5, -0.5], [-0.5, -0.5, 0.5], [-0.5, 0.5, -0.5], [-0.5, 0.5, 0.5], [0.5, -0.5, -0.5], [0.5, -0.5, 0.5], [0.5, 0.5, -0.5], [0.5, 0.5, 0.5], [-0.5, -0.5, -0.5], [0.5, -0.5, -0.5], [-0.5, -0.5, 0.5], [0.5, -0.5, 0.5], [-0.5, 0.5, -0.5], [0.5, 0.5, -0.5], [-0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [-0.5, -0.5, -0.5], [-0.5, 0.5, -0.5], [0.5, -0.5, -0.5], [0.5, 0.5, -0.5], [-0.5, -0.5, 0.5], [-0.5, 0.5, 0.5], [0.5, -0.5, 0.5], [0.5, 0.5, 0.5]], "triangles": [ 1, 2, 0, 1, 3, 2, 5, 4, 6, 5, 6, 7, 11, 8, 9, 11, 10, 8, 15, 13, 12, 15, 12, 14, 19, 16, 17, 19, 18, 16, 23, 21, 20, 23, 20, 22 ], "normals": [ [-1, 0, 0], [-1, 0, 0], [-1, 0, 0], [-1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0], [0, -1, 0], [0, -1, 0], [0, -1, 0], [0, -1, 0], [0, 1, 0], [0, 1, 0], [0, 1, 0], [0, 1, 0], [0, 0, -1], [0, 0, -1], [0, 0, -1], [0, 0, -1], [0, 0, 1], [0, 0, 1], [0, 0, 1], [0, 0, 1] ], "edges": [ [[-0.5, -0.5, -0.5], [-0.5, -0.5, 0.5]], [[-0.5, -0.5, 0.5], [-0.5, 0.5, 0.5]], [[-0.5, 0.5, -0.5], [-0.5, 0.5, 0.5]], [[-0.5, -0.5, -0.5], [-0.5, 0.5, -0.5]], [[0.5, -0.5, -0.5], [0.5, -0.5, 0.5]], [[0.5, -0.5, 0.5], [0.5, 0.5, 0.5]], [[0.5, 0.5, -0.5], [0.5, 0.5, 0.5]], [[0.5, -0.5, -0.5], [0.5, 0.5, -0.5]], [[-0.5, -0.5, -0.5], [0.5, -0.5, -0.5]], [[-0.5, -0.5, 0.5], [0.5, -0.5, 0.5]], [[-0.5, 0.5, -0.5], [0.5, 0.5, -0.5]], [[-0.5, 0.5, 0.5], [0.5, 0.5, 0.5]] ]}, "color": "#e8b024", "renderback": false }] } states = {'/Group/Part_0': [1, 1]}A nested object (with shapes shortened) looks like:
{ 'id': '/bottom', 'name': 'bottom', 'loc': ['<position>', '<quaternion>'], 'parts': [{ 'id': '/bottom/bottom_0', 'name': 'bottom_0', 'type': 'shapes', 'color': '#bfbfbf', 'shape': {'vertices': [...], 'triangles': [...], 'normals': [...], 'edges': [...]}, }, { 'id': '/bottom/top', 'name': 'top', 'loc': ['<position>', '<quaternion>'], 'parts': [{ 'id': '/bottom/top/top_0', 'name': 'top_0', 'type': 'shapes', 'color': '#bfbfbf', 'shape': {'vertices': [...], 'triangles': [...], 'normals': [...], 'edges': [...]}, }] }, { 'id': '/bottom/front_stand', 'name': 'front_stand', 'loc': ['<position>', '<quaternion>'], 'parts': [{ 'id': '/bottom/front_stand/front_stand_0', 'name': 'front_stand_0', 'type': 'shapes', 'color': '#7fcce5', 'shape': {'vertices': [...], 'triangles': [...], 'normals': [...], 'edges': [...]}, }] }, { 'id': '/bottom/back_stand', 'name': 'back_stand', 'loc': ['<position>', '<quaternion>'], 'parts': [{ 'id': '/bottom/back_stand/back_stand_0', 'name': 'back_stand_0', 'type': 'shapes', 'color': '#7fcce5', 'shape': {'vertices': [...], 'triangles': [...], 'normals': [...], 'edges': [...]}, }] }, { 'id': '/bottom/right_back', 'name': 'right_back', 'loc': ['<position>', '<quaternion>'], 'parts': [{ 'id': '/bottom/right_back/right_back_0', 'name': 'right_back_0', 'type': 'shapes', 'color': '#ffa500', 'shape': {'vertices': [...], 'triangles': [...], 'normals': [...], 'edges': [...]}, }, { 'id': '/bottom/right_back/lower', 'name': 'lower', 'loc': ['<position>', '<quaternion>'], 'parts': [{ 'id': '/bottom/right_back/lower/lower_0', 'name': 'lower_0', 'type': 'shapes', 'color': '#ffa500', 'shape': {'vertices': [...], 'triangles': [...], 'normals': [...], 'edges': [...]}, }] }] }, ... ] } states = { '/bottom/bottom_0': [1, 1], '/bottom/top/top_0': [1, 1], '/bottom/front_stand/front_stand_0': [1, 1], '/bottom/back_stand/back_stand_0': [1, 1], '/bottom/right_back/right_back_0': [1, 1], '/bottom/right_back/lower/lower_0': [1, 1], ... }Notes
Vector : float[3] := [x, y, z] VectorList : Vector[n] := [ [x0, y0, z0], [x1, xy1, z1], … ] Index : int[m] := [ i0, i1, i2, … ] Edge : Vector[2] := [ [x0, y0, z0], [x1, xy1, z1]] EdgeList : Edge[k] := [ [[x0, y0, z0], [x1, xy1, z1]], [[x2, y2, z2], [x3, xy3, z3]], … ]
Shape, Faces := { "id": "
", "name": " ", "type": "shapes", "color": "#ffffff", "renderback": false "shape": { "vertices": , "triangles": , "normals": , "edges": } } Edges := { "id": ">", "name": "
", "type": "edges", "color": "#ffffff", "width": 3, "renderback": false "shape": } Vertices := { "id": ">", "name": "
", "type": "vertices", "color": "#ffffff", "size": 6 "shape": } def add_track(self, track)-
Add an animation track to CAD view
Parameters
track:AnimationTrack- Animation track, see AnimationTrack
def add_tracks(self, tracks)-
Add a list of animation tracks to CAD view
Parameters
tracks:listofAnimationTrack- List of Animation tracks, see AnimationTrack
def animate(self, speed=1)-
Send animation tracks to CAD view
Parameters
speed:float, default: 1- Animation speed, will be forwarded via
animation_speedtraitlet
def clear_tracks(self)-
Remove animation tracks from CAD view
def close(self)-
Close the underlying Javascript viewer
def dispose(self)-
Dispose the CAD Viewer
def dump_model(self, shapes=False)-
Dumps the status of the widget with various properties.
Args
shapes:bool- If True, includes the shapes in the status. Defaults to False.
def execute(self, method, args=None)-
Execute a method of a Javascript object
Parameters
method:string- A 'CadViewer' object based Javascrip object path, e.g.
abc.def[3].method(args)whereabc.def[3]is the object notation relative to the 'CadViewer' object andmethodis the method to call args:listofany- The arguments passed to
abc.def[3].method(args)
def export_html(self, filename='cadquery.html', title='CadQuery')-
Exports the current widget view to an HTML file.
Parameters: filename (str): The name of the HTML file to export. Default is "cadquery.html". title (str): The title of the HTML document. Default is "CadQuery".
Raises: RuntimeError: If the widget is displayed in a sidecar.
Notes: - This method temporarily disables pinning while exporting the HTML. - The state of the widget is captured and embedded in the HTML file.
def export_png(self, filename)-
Save CAD View as PNG
def pause(self)-
Pause or unpause animation
def pin_as_png(self)-
Pin CAD View as PNG
def play(self)-
Start or unpause animation
def register_viewer(self)def rotate_left(self, angle)-
Rotate CAD obj to the left (positive angle) and right (negative angle) - orbit controls only
Parameters
angle:float- The rotation angle in degrees
def rotate_up(self, angle)-
Rotate CAD obj up (positive angle) and down (negative angle) - orbit controls only
Parameters
angle:float- The rotation angle in degrees
def rotate_x(self, angle)-
Rotate CAD obj around x-axis - trackball controls only
Parameters
angle:float- The rotation angle in degrees
def rotate_y(self, angle)-
Rotate CAD obj around y-axis - trackball controls only
Parameters
angle:float- The rotation angle in degrees
def rotate_z(self, angle)-
Rotate CAD obj around z-axis - trackball controls only
Parameters
angle:float- The rotation angle in degrees
def set_camera(self, direction)-
Set camera to one of the predefined locations
Parameters
direction:string- one of ["iso", "top", "bottom", "left", "right", "front", "rear"]
def status(self, all=False)-
Returns the status of the widget with various properties.
Args
shapes:bool- If True, includes the shapes in the status. Defaults to False.
Returns
dict- A dictionary containing the status of the widget
def stop(self)-
Stop animation
def update_camera_location(self)-
Sync position, quaternion and zoom of camera to Python
def update_states(self, states)
class CadViewerWidget (**kwargs)-
The CAD Viewer widget.
Public constructor
Ancestors
- ipywidgets.widgets.widget_output.Output
- ipywidgets.widgets.domwidget.DOMWidget
- ipywidgets.widgets.widget.Widget
- ipywidgets.widgets.widget.LoggingHasTraits
- traitlets.traitlets.HasTraits
- traitlets.traitlets.HasDescriptors
Instance variables
var activeTool : Self | G-
unicode: Active measurement tool
var ambient_intensity : Self | G-
float: The intensity of the ambient light
var anchor : Self | G-
unicode string whether to add a view to the right sidebar ('right') or as a tab to the main window ('tab')
var animation_speed : Self | G-
float: Animation speed
var aspect_ratio : Self | G-
float: aspect ratio for sidecar
var axes : Self | G-
bool: Whether to show coordinate axes (True) or not (False)
var axes0 : Self | G-
bool: Whether to center coordinate axes at the origin [0,0,0] (True) or at the CAD object center (False)
var black_edges : Self | G-
bool: Whether to shows the edges in black (True) or not(False)
var cad_width : Self | G-
unicode string: Width of the canvas element for cell viewer and right sidecar
var center_grid : Self | G-
bool: Whether to center the grid at (0, 0, 0) not (False)
var clip_intersection : Self | G-
bool: Whether to use intersection clipping (True) or not (False)
var clip_normal_0 : Self | G-
tuple: Normal of clipping plane 1 as a 3-dim tuple of float (x,y,z)
var clip_normal_1 : Self | G-
tuple: Normal of clipping plane 2 as a 3-dim tuple of float (x,y,z)
var clip_normal_2 : Self | G-
tuple: Normal of clipping plane 3 as a 3-dim tuple of float (x,y,z)
var clip_object_colors : Self | G-
bool: Whether to show colored clipping caps in object color (True) or not (False)
var clip_planes : Self | G-
bool: Whether to show colored clipping planes (True) or not (False)
var clip_slider_0 : Self | G-
float: Slider value of clipping plane 1
var clip_slider_1 : Self | G-
float: Slider value of clipping plane 2
var clip_slider_2 : Self | G-
float: Slider value of clipping plane 3
var collapse : Self | G-
Enum Collapse: Collapse CAD tree ('1': collapse all leaf nodes, 'R': expand root level only, 'C': collapse all nodes, 'E': expand all nodes)
var control : Self | G-
unicode: Whether to use trackball controls ('trackball') or orbit controls ('orbit')
var debug : Self | G-
bool: Whether to show infos in the browser console (True) or not (False)
var default_edgecolor : Self | G-
unicode: The default edge color in web format, e.g. '#ffaa88'
var default_opacity : Self | G-
unicode: The default opacity for transparent objects
var direct_intensity : Self | G-
float: The intensity of the direct light
var disposed : Self | G-
unicode string: Whether the Javascript viewer is disposed
var explode : Self | G-
bool: Whether to show the explode menu or not (False)
var glass : Self | G-
bool: Whether to use the glass mode (CAD navigation as transparent overlay) or not
var grid : Self | G-
tuple: Whether to show the grids for
xy,xz,yz. var height : Self | G-
int: Height of the canvas element for cell viewer
var id : Self | G-
unicode uuid4 string serving as internal id of the widget
var image_id : Self | G-
unicode string: the id of the image tag to use for pin as png
var initialize : Self | G-
bool: internally used to control initialization of view. Do not use!
var keymap : Self | G-
dict: Mapping of the modifier keys, defaults to {'shift': 'shiftKey', 'ctrl': 'ctrlKey', 'meta': 'metaKey'}
var lastPick : Self | G-
dict: Describes the last picked element of the CAD view
var measure : Self | G-
list: JSON of calculated measures
var measure_callback : Self | G-
A trait which is callable.
Notes
Classes are callable, as are instances with a call() method.
var metalness : Self | G-
float: The degree of metalness
var new_tree_behavior : Self | G-
bool: Whether to hide the complete shape when clicking on the eye (True) or only the faces (False)
var normal_len : Self | G-
float: If > 0, the vertex normals will be rendered with the length given be this parameter
var ortho : Self | G-
bool: Whether to use orthographic view (True) or perspective view (False)
var pan_speed : Self | G-
float: Speed of panning with the mouse
var pinning : Self | G-
bool: Whether to show the pin a png button or not
var position : Self | G-
tuple: Position of the camera as a 3-dim tuple of float (x,y,z)
var quaternion : Self | G-
tuple: Rotation of the camera as 4-dim quaternion (x,y,z,w)
var reset_camera : Self | G-
Enum Camera: Whether to reset camera (reset) or not (keep or center keep orientation but center the camera)
var result : Self | G-
unicode string: JSON serialized result from Javascript
var rotate_speed : Self | G-
float: Speed of rotation with the mouse
var roughness : Self | G-
float: The degree of roughness
var selectedShapeIDs : Self | G-
list: List of selected object paths
var shapes : Self | G-
unicode: Serialized nested tessellated shapes
var state_updates : Self | G-
dict: Updates to the state of the nested cad objects, key = object path, value = 2-dim tuple of 0/1 (hidden/visible) for object and edges
var states : Self | G-
dict: State of the nested cad objects, key = object path, value = 2-dim tuple of 0/1 (hidden/visible) for object and edges
var tab : Self | G-
unicode: Whether to show the navigation tree ('tree'), clipping UI ('clip') or material UI ('material')
var target : Self | G-
tuple: Camera target to look at as 3-dim tuple (x,y,z)
var theme : Self | G-
unicode string: UI theme, can be 'dark' or 'light' (default)
var ticks : Self | G-
integer: Hint for the number of ticks for the grids (will be adjusted for nice intervals)
var timeit : Self | G-
bool: Whether to output timing info to the browser console (True) or not (False)
var title : Self | G-
unicode string of the title of the sidecar to be used. None means CAD view will be opened in cell
var tools : Self | G-
bool: Whether to show CAD tools (True) or not (False)
var tracks : Self | G-
unicode: Serialized list of animation track arrays, see AnimationTrack.to_array
var transparent : Self | G-
bool: Whether to show the CAD objects transparently (True) or not (False)
var tree_width : Self | G-
int: Width of the navigation tree element
var up : Self | G-
unicode: Whether camera up direction is Z ('Z') or Y ('Y') or the legacy Z orientation ('L')
var zoom : Self | G-
float: Zoom value of the camera
var zoom_speed : Self | G-
float: Speed of zooming with the mouse
Methods
def active_tool(...) ‑> types.MethodType | EventHandlerdef func(...) ‑> types.MethodType | EventHandlerdef selected_shape_ids(...) ‑> types.MethodType | EventHandler