Introducing Jupyter-CadQuery: Visualize and Manipulate CAD Models in JupyterLab
Are you a software engineer or solution architect looking for a tool to visualize and manipulate CAD models in JupyterLab? Look no further! Jupyter-CadQuery is here to help. In this article, we will explore the features of Jupyter-CadQuery and learn how to get started with it.
Jupyter-CadQuery is a powerful tool that allows you to view CadQuery objects directly in JupyterLab or in a standalone viewer for any IDE. It provides support for various CAD features, including CadQuery Assemblies and CadQuery Sketches. With Jupyter-CadQuery, you can easily display, animate, and debug your CAD models, making it an essential tool for any CAD workflow.
Key Features
Jupyter-CadQuery offers a range of key features that make it a valuable tool for CAD visualization and manipulation. Some of these features include:
-
CadQuery support: Jupyter-CadQuery is compatible with CadQuery 2.1 and above, including the latest master version. It allows you to display and manipulate CadQuery objects, including Assemblies and Sketches.
-
STEP files support: Jupyter-CadQuery includes a STEP file reader that can load STEP files into CadQuery Assemblies while preserving hierarchy, names, and colors.
-
Various viewing options: Jupyter-CadQuery provides multiple ways to view your CAD models. You can view them directly in the JupyterLab output cell, in a central JupyterLab sidecar for any JupyterLab cell, or as a standalone viewer for use from any IDE.
-
Animation support: Jupyter-CadQuery supports animations, allowing you to create and display animated CAD models. You can animate Manual Assemblies and create explode object animations for CadQuery Assemblies.
-
Debugging capabilities: Jupyter-CadQuery offers various debugging features. You can debug your CAD models step-by-step in an IDE using the standalone viewer. You can also visually debug your models by displaying selected CadQuery faces and edges or by replaying steps of the rendered object in the Notebook.
-
Viewer features: Jupyter-CadQuery provides a range of viewer features, including the ability to toggle visibility of shapes and edges, switch between orthographic and perspective views, apply clipping with up to three clipping planes, enable transparency mode, and more.
Installation
To get started with Jupyter-CadQuery, you can use either conda or a docker image. If you choose to use conda, follow these steps:
-
Create a new conda environment with the latest CadQuery:
# conda create -n jcq3 -c conda-forge -c cadquery python=3.10 cadquery=master vtk=9.2.2 conda activate jcq3
-
Install Jupyter-CadQuery and its dependencies:
# pip install jupyter-cadquery==3.5.2 cadquery-massembly==1.0.0 matplotlib
Windows users should also install
pywin32
with conda:# conda install pywin32
-
Start Jupyter-CadQuery:
# conda activate jcq3 jupyter lab
For detailed installation instructions using docker, refer to the official Jupyter-CadQuery documentation.
Usage
Jupyter-CadQuery provides various functions and classes to help you work with CAD models. Some of the key ones include:
-
show
: Use this function to display CAD objects in JupyterLab. You can customize the display options, such as viewer theme, width, height, and more. -
replay
: This function allows you to replay the steps of a CAD model in the notebook. It is useful for debugging and visualizing the construction process. -
export_png
: Use this function to export the displayed CAD object as a PNG image file. -
export_html
: This function exports the displayed CAD object as an HTML file. -
exportSTL
: Jupyter-CadQuery provides an export function specifically for STL files. You can use it to export both CadQuery objects and PartGroups.
For detailed usage instructions and examples, refer to the official Jupyter-CadQuery documentation.
Conclusion
Jupyter-CadQuery is a valuable tool for any software engineer or solution architect working with CAD models. With its support for CadQuery objects, STEP files, animations, and debugging capabilities, Jupyter-CadQuery makes it easy to visualize and manipulate your CAD models in JupyterLab. Whether you are designing complex assemblies or creating intricate sketches, Jupyter-CadQuery provides the features and flexibility you need.
If you have any questions or need assistance with Jupyter-CadQuery, please don’t hesitate to reach out. Happy CAD modeling!
References
- Jupyter-CadQuery repository: https://github.com/bernhard-42/jupyter-cadquery
- CadQuery repository: https://github.com/cadquery/cadquery
Leave a Reply