Collaborative CAD in JupyterLab

· Jupyter Blog ·

3 min read Original article ↗

One extension, three interfaces

Built using the latest JupyterLab 4 release, JupyterCAD combines CAD functionalities with the enhanced performance and accessibility improvements introduced in JupyterLab 4. The flexibility of JupyterLab allows us to create the extension once but deploy it in multiple ways to target three groups of audiences: users who prefer working in the JupyterLab environment, users who favor dedicated applications, and those advanced users who do everything programmatically.

JupyterLab Extension

Experience CAD features directly within JupyterLab with the JupyterCAD extension. Open and edit FreeCAD files, perform CAD operations, including creating 3D primitives, applying boolean operators, and exploding the view. JupyterCAD’s extension integrates seamlessly into JupyterLab, providing an intuitive environment for CAD enthusiasts and data scientists alike.

Press enter or click to view image in full size

JupyterCAD extension inside JupyterLab

JupyterCAD Application

For a streamlined CAD experience, JupyterCAD offers a dedicated application that eliminates distractions and emphasizes CAD features.

Press enter or click to view image in full size

The standalone JupyterCAD Application.

Starting the dedicated JupyterCAD application is as simple as starting JupyterLab or Jupyter Notebook:

jupyter cad

This dedicated application has been built in a similar way to the coming Jupyter Notebook 7. It’s a JupyterLab “remix” built from the ground up using JupyterLab core components and custom extensions. Much like JupyterLab, it offers theming and localization support, and more planned features on the horizon.

Python API for CAD Operations

Advanced users can unlock the full potential of CAD operations with JupyterCAD’s Python API. JupyterCAD allows users to programmatically visualize, create, and manipulate the shapes from a Jupyter Notebook. For example, one can open a FreeCAD file and start modifying it from the notebook with:

from jupytercad import CadDocument
doc = CadDocument('example.FCStd')
# Create a cone, a sphere then cut the cone with the sphere.
doc.add_cone().add_sphere(radius=0.8).cut()
display(doc)

Press enter or click to view image in full size

Adding object to FreeCAD file from Jupyter Notebook.

JupyterCAD API also integrates nicely with the OpenCascade Python API, providing expanded capabilities for working with shapes.

from jupytercad import CadDocument
...
# Create a prism shape with OpenCascade
prism = BRepPrimAPI_MakePrism(profile, vec).Shape()
doc = CadDocument()
doc.add_occ_shape(prism)
display(doc)

Press enter or click to view image in full size

Visualize OpenCascade shape object with JupyterCAD.

Unlocking teamwork with real-time collaboration

Collaborative Editing

One of the standout features of JupyterCAD is its shared editing functionality, which seamlessly connects users across different interfaces within the JupyterCAD ecosystem. Whether collaborators are using the dedicated JupyterCAD application, the JupyterLab extension, or working with the Python API in a Notebook, any changes made to a shared document are instantly reflected for all users.

Get Duc Trung Le’s stories in your inbox

Join Medium for free to get updates from this writer.

Remember me for faster sign in

Real-time collaboration allows individuals working in the Python API to make modifications to the CAD document, while simultaneously providing a synchronized view for collaborators using the JupyterLab extension or the JupyterCAD application. This ensures that all participants have access to the most up-to-date version of the design, fostering efficient communication and eliminating the need for manual synchronization or file exchange.

Follow Mode

With JupyterCAD’s follow-mode feature, collaboration becomes even more fluid. You can follow another user’s camera movements and view adjustments in real-time. This mode allows you to gain insights into the design process, and enhance communication among team members.

Annotations System

The annotations system in JupyterCAD adds an interactive layer to 3D designs. Now you can add annotations to specific shapes within a CAD file, give context, provide feedback, or write instructions.