def show(*cad_objs, render_mates=None, mate_scale=None, **kwargs): """Show CAD objects in Jupyter Valid keywords: - height: Height of the CAD view (default=600) - tree_width: Width of navigation tree part of the view (default=250) - cad_width: Width of CAD view part of the view (default=800) - bb_factor: Scale bounding box to ensure compete rendering (default=1.5) - default_color: Default mesh color (default=(232, 176, 36)) - default_edgecolor: Default mesh color (default=(128, 128, 128)) - render_edges: Render edges (default=True) - render_normals: Render normals (default=False) - render_mates: Render mates (for MAssemblies) - mate_scale: Scale of rendered mates (for MAssemblies) - quality: Linear deflection for tessellation (default=None) If None, uses bounding box as in (xlen + ylen + zlen) / 300 * deviation) - deviation: Deviation from default for linear deflection value ((default=0.1) - angular_tolerance: Angular deflection in radians for tessellation (default=0.2) - edge_accuracy: Presicion of edge discretizaion (default=None) If None, uses: quality / 100 - optimal_bb: Use optimal bounding box (default=False) - axes: Show axes (default=False) - axes0: Show axes at (0,0,0) (default=False) - grid: Show grid (default=False) - ticks: Hint for the number of ticks in both directions (default=10) - ortho: Use orthographic projections (default=True) - transparent: Show objects transparent (default=False) - ambient_intensity Intensity of ambient ligth (default=1.0) - direct_intensity Intensity of direct lights (default=0.12) - position: Relative camera position that will be scaled (default=(1, 1, 1)) - rotation: z, y and y rotation angles to apply to position vector (default=(0, 0, 0)) - zoom: Zoom factor of view (default=2.5) - reset_camera: Reset camera position, rotation and zoom to default (default=True) - mac_scrollbar: Prettify scrollbars (default=True) - display: Select display: "sidecar", "cell", "html" - tools: Show the viewer tools like the object tree - timeit: Show rendering times, levels = False, 0,1,2,3,4,5 (default=False) For example isometric projection can be achieved in two ways: - position = (1, 1, 1) - position = (0, 0, 1) and rotation = (45, 35.264389682, 0) """ render_mates = render_mates or get_default("render_mates") mate_scale = mate_scale or get_default("mate_scale") default_color = kwargs.get("default_color") or get_default("default_color") assembly = to_assembly(*cad_objs, render_mates=render_mates, mate_scale=mate_scale, default_color=default_color) if assembly is None: raise ValueError("%s cannot be viewed" % cad_objs) if len(assembly.objects) == 1 and isinstance(assembly.objects[0], PartGroup): # omit leading "PartGroup" group return _show(assembly.objects[0], **kwargs) else: return _show(assembly, **kwargs)
def show(*cad_objs, render_mates=None, mate_scale=None, **kwargs): """Show CAD objects in Jupyter Valid keywords: - height: Height of the CAD view (default=600) - tree_width: Width of navigation tree part of the view (default=250) - cad_width: Width of CAD view part of the view (default=800) - bb_factor: Scale bounding box to ensure compete rendering (default=1.0) - render_shapes: Render shapes (default=True) - render_edges: Render edges (default=True) - render_mates: For MAssemblies, whether to rander the mates (default=True) - mate_scale: For MAssemblies, scale of rendered mates (default=1) - quality: Tolerance for tessellation (default=0.1) - angular_tolerance: Angular tolerance for building the mesh for tessellation (default=0.1) - edge_accuracy: Presicion of edge discretizaion (default=0.01) - optimal_bb: Use optimal bounding box (default=True) - axes: Show axes (default=False) - axes0: Show axes at (0,0,0) (default=False) - grid: Show grid (default=False) - ortho: Use orthographic projections (default=True) - transparent: Show objects transparent (default=False) - position: Relative camera position that will be scaled (default=(1, 1, 1)) - rotation: z, y and y rotation angles to apply to position vector (default=(0, 0, 0)) - zoom: Zoom factor of view (default=2.5) - mac_scrollbar: Prettify scrollbasrs on Macs (default=True) - display: Select display: "sidecar", "cell", "html" - tools: Show the viewer tools like the object tree - timeit: Show rendering times (default=False) For example isometric projection can be achieved in two ways: - position = (1, 1, 1) - position = (0, 0, 1) and rotation = (45, 35.264389682, 0) """ render_mates = render_mates or get_default("render_mates") mate_scale = mate_scale or get_default("mate_scale") assembly = to_assembly(*cad_objs, render_mates=render_mates, mate_scale=mate_scale) if assembly is None: raise ValueError("%s cannot be viewed" % cad_objs) if len(assembly.objects) == 1 and isinstance(assembly.objects[0], PartGroup): # omit leading "PartGroup" group return _show(assembly.objects[0], **kwargs) else: return _show(assembly, **kwargs)
def show(cad_obj, **kwargs): """Show CAD objects in Jupyter Valid keywords: - height: Height of the CAD view (default=600) - tree_width: Width of navigation tree part of the view (default=250) - cad_width: Width of CAD view part of the view (default=800) - quality: Tolerance for tessellation (default=0.1) - angular_tolerance: Angular tolerance for building the mesh for tessellation (default=0.1) - edge_accuracy: Presicion of edge discretizaion (default=0.01) - axes: Show axes (default=False) - axes0: Show axes at (0,0,0) (default=False) - grid: Show grid (default=False) - ortho: Use orthographic projections (default=True) - transparent: Show objects transparent (default=False) - position: Relative camera position that will be scaled (default=(1, 1, 1)) - rotation: z, y and y rotation angles of position (default=(0, 0, 0)) - zoom: Zoom factor of view (default=2.5) - mac_scrollbar: Prettify scrollbasrs on Macs (default=True) - sidecar: Use provided sidecar (default=None) - timeit: Show rendering times (default=False) """ assembly = None if isinstance(cad_obj, (Assembly, Part)): assembly = cad_obj.to_assembly() if assembly is None: raise ValueError("%s cannot be viewed" % type(cad_obj)) return _show(assembly, **kwargs)
def show(cad_obj, height=600, tree_width=250, cad_width=600, quality=0.5, axes=False, axes0=True, grid=False, ortho=True, transparent=False, mac_scrollbar=True, sidecar=None, show_parents=True, position=None, rotation=None, zoom=None): assembly = None if isinstance(cad_obj, (Assembly, Part)): assembly = cad_obj.to_assembly() if assembly is None: raise ValueError("%s cannot be viewed" % type(cad_obj)) return _show(assembly, height, tree_width, cad_width, quality, axes, axes0, grid, ortho, transparent, position, rotation, zoom, mac_scrollbar, sidecar)
def show(*cad_objs, **kwargs): """Show CAD objects in Jupyter Valid keywords: - height: Height of the CAD view (default=600) - tree_width: Width of navigation tree part of the view (default=250) - cad_width: Width of CAD view part of the view (default=800) - quality: Tolerance for tessellation (default=0.1) - angular_tolerance: Angular tolerance for building the mesh for tessellation (default=0.1) - edge_accuracy: Presicion of edge discretizaion (default=0.01) - axes: Show axes (default=False) - axes0: Show axes at (0,0,0) (default=False) - grid: Show grid (default=False) - ortho: Use orthographic projections (default=True) - transparent: Show objects transparent (default=False) - position: Relative camera position that will be scaled (default=(1, 1, 1)) - rotation: z, y and y rotation angles to apply to position vector (default=(0, 0, 0)) - zoom: Zoom factor of view (default=2.5) - mac_scrollbar: Prettify scrollbasrs on Macs (default=True) - sidecar: Use provided sidecar (default=None) - timeit: Show rendering times (default=False) """ assembly = Assembly([], "Assembly") obj_id = 0 for cad_obj in cad_objs: if isinstance(cad_obj, (Assembly, Part, Faces, Edges, Vertices)): assembly.add(cad_obj) elif is_cqparts(cad_obj): assembly = convert_cqparts(cad_obj) elif _is_facelist(cad_obj): assembly.add_list(_from_facelist(cad_obj, obj_id)) elif _is_edgelist(cad_obj): assembly.add_list(_from_edgelist(cad_obj, obj_id)) elif _is_wirelist(cad_obj): assembly.add(_from_wirelist(cad_obj, obj_id)) elif _is_vertexlist(cad_obj): assembly.add_list(_from_vertexlist(cad_obj, obj_id)) elif isinstance(cad_obj.val(), Vector): assembly.add_list(_from_vectorlist(cad_obj, obj_id)) elif isinstance(cad_obj, Workplane): assembly.add(_from_workplane(cad_obj, obj_id)) else: raise NotImplementedError("Type:", cad_obj) obj_id += 1 if assembly is None: raise ValueError("%s cannot be viewed" % type(cad_obj)) return _show(assembly, **kwargs)
def show(*cad_objs, height=600, tree_width=250, cad_width=600, quality=0.5, axes=False, axes0=True, grid=False, ortho=True, transparent=False, mac_scrollbar=True, sidecar=None, show_parents=True, position=None, rotation=None, zoom=None): assembly = Assembly([], "Replay") obj_id = 0 for cad_obj in cad_objs: if isinstance(cad_obj, (Assembly, Part, Faces, Edges, Vertices)): assembly.add(cad_obj) elif is_cqparts(cad_obj): assembly = convert_cqparts(cad_obj) elif _is_facelist(cad_obj): assembly.add_list( _from_facelist(cad_obj, obj_id, show_parents=show_parents)) elif _is_edgelist(cad_obj): assembly.add_list( _from_edgelist(cad_obj, obj_id, show_parents=show_parents)) elif _is_wirelist(cad_obj): assembly.add(_from_wirelist(cad_obj, obj_id)) elif _is_vertexlist(cad_obj): assembly.add_list(_from_vertexlist(cad_obj, obj_id)) elif isinstance(cad_obj.val(), Vector): assembly.add_list(_from_vectorlist(cad_obj, obj_id)) elif isinstance(cad_obj, Workplane): assembly.add(_from_workplane(cad_obj, obj_id)) else: raise NotImplementedError("Type:", cad_obj) obj_id += 1 if assembly is None: raise ValueError("%s cannot be viewed" % type(cad_obj)) return _show(assembly, height, tree_width, cad_width, quality, axes, axes0, grid, ortho, transparent, position, rotation, zoom, mac_scrollbar, sidecar)
def show(cad_obj, **kwargs): """Show CAD objects in Jupyter Valid keywords: - height: Height of the CAD view (default=600) - tree_width: Width of navigation tree part of the view (default=250) - cad_width: Width of CAD view part of the view (default=800) - render_shapes: Render shapes (default=True) - render_edges: Render edges (default=True) - quality: Tolerance for tessellation (default=0.1) - angular_tolerance: Angular tolerance for building the mesh for tessellation (default=0.1) - edge_accuracy: Presicion of edge discretizaion (default=0.01) - optimal_bb: Use optimal bounding box (default=True) - axes: Show axes (default=False) - axes0: Show axes at (0,0,0) (default=False) - grid: Show grid (default=False) - ortho: Use orthographic projections (default=True) - transparent: Show objects transparent (default=False) - position: Relative camera position that will be scaled (default=(1, 1, 1)) - rotation: z, y and y rotation angles to apply to position vector (default=(0, 0, 0)) - zoom: Zoom factor of view (default=2.5) - mac_scrollbar: Prettify scrollbasrs on Macs (default=True) - display: Select display: "sidecar", "cell", "html" - tools: Show the viewer tools like the object tree - timeit: Show rendering times (default=False) For example isometric projection can be achieved in two ways: - position = (1, 1, 1) - position = (0, 0, 1) and rotation = (45, 35.264389682, 0) """ assembly = None if isinstance(cad_obj, (PartGroup, Part)): assembly = cad_obj.to_assembly() if assembly is None: raise ValueError("%s cannot be viewed" % type(cad_obj)) return _show(assembly, **kwargs)