Package cad_viewer_widget

Sub-modules

cad_viewer_widget.sidecar
cad_viewer_widget.utils

Utility functions

cad_viewer_widget.widget

This module is the Python part of the CAD Viewer widget

Functions

def open_viewer(title=None, anchor='right', cad_width=800, tree_width=250, height=600, theme='browser', glass=False, tools=True, pinning=True)
def set_default_sidecar(title, anchor='right')
def show(shapes, states, tracks=None, title=None, anchor=None, cad_width=None, tree_width=None, height=None, theme=None, glass=None, tools=None, pinning=None, normal_len=None, default_edgecolor=None, default_opacity=None, ambient_intensity=None, direct_intensity=None, metalness=None, roughness=None, control=None, up=None, ortho=None, axes=None, axes0=None, grid=None, explode=None, ticks=None, transparent=None, black_edges=None, collapse=None, reset_camera=None, position=None, quaternion=None, target=None, zoom=None, zoom_speed=None, pan_speed=None, rotate_speed=None, timeit=None, debug=None)

Show CAD objects in JupyterLab

  • shapes: Serialized nested tessellated shapes
  • states: State of the nested cad objects, key = object path, value = 2-dim tuple of 0/1 (hidden/visible) for object and edges

Valid keywords:

DISPLAY OPTIONS - title: Name of the sidecar viewer (default=None) - anchor: How to open sidecar: "right", "split-right", "split-bottom", … (default="right") - cad_width: Width of CAD view part of the view (default=800) - tree_width: Width of navigation tree part of the view (default=250) - height: Height of the CAD view (default=600) - theme: Theme "light" or "dark" (default="light") - tools: Show the viewer tools like the object tree (default=True) - glass: Use the glass mode, i.e. CAD navigation as transparent overlay (default=False) - pinning: Allow replacing the CAD View by a canvas screenshot (default=True in cells, else False)

TESSELLATION OPTIONS - default_edgecolor: Default edge color (default="#707070") - default_opacity: Default opacity (default=0.5) - ambient_intensity Default ambient (default=1.0) - direct_intensity: Default direct (default=1.1) - metalness : float: The degree of material metalness (default 0.3) - roughness : float: The degree of material roughness (default 0.65) - normal_len: Render vertex normals if > 0 (default=0) - render_edges: Render edges (default=True) - render_mates: Render mates (for MAssemblies, default=False) - mate_scale: Scale of rendered mates (for MAssemblies, default=1)

VIEWER OPTIONS - control: Use trackball controls ('trackball') or orbit controls ('orbit') (default='trackball') - up: Camera up direction is Z or Y (default='Z') - ortho: Use orthographic projections (default=True) - axes: Show axes (default=False) - axes0: Show axes at (0,0,0) (default=False) - grid: Show grid (default=[False, False, False]) - ticks: Hint for the number of ticks in both directions (default=10) - explode: Whether explode widget is visibe or not (default=False) - transparent: Show objects transparent (default=False) - black_edges: Show edges in black (default=False) - collapse: Collapse CAD tree (1: collapse nodes with single leaf, 2: collapse all nodes, default=0) - reset_camera: Whether to reset camera (True) or not (False) (default=True) - position: Absolute camera position that will be scaled (default=None) - quaternion: Camera rotation as quaternion (x, y, z, w) (default=None) - target: Camera target to look at (default=None) - zoom: Zoom factor of view (default=2.5) - reset_camera: Reset camera position, rotation and zoom to default (default=True) - zoom_speed: Mouse zoom speed (default=1.0) - pan_speed: Mouse pan speed (default=1.0) - rotate_speed: Mouse rotate speed (default=1.0) - timeit: Show rendering times, levels = False, 0,1,2,3,4,5 (default=False) - debug: Enable debug output in browser console (default=False)