Skip to main content

Onshape Integration

A getting started guide for using Luminary Cloud's Onshape integration, covering authentication, geometry import, and more advanced usage.

Updated today

Overview

Luminary Cloud has a Connected Web App integration with Onshape that allows you to directly inspect, import, and manipulate parametric Onshape geometries all without leaving Luminary Cloud. This integration is perfect for building Physics AI datasets for training and rapidly simulating a multitude of design variants. Best of all, it involves no manual downloading or uploading of Onshape CAD files, provides a natural extension to your Onshape workflow, and filled with features to track the origin of your geometry back to Onshape and keep them in sync.

Authentication

Connecting to your Onshape account

To begin using Luminary Cloud's Onshape integration, you must link your Luminary Cloud account to your Onshape account. To do so, you simply need to head to the Luminary Cloud My Account Settings page and find the "Third Party Authentication" section. There, click on the "Connect Account" button. This will redirect you to the Onshape website to login, after which your Luminary Cloud and Onshape account will be connected.

Removing the Connection

To remove the connection between Luminary Cloud and your Onshape account, return to the Third Party Authentication section of your Luminary Cloud My Account Settings page. If you have an Onshape account associated with the Luminary Cloud account you are currently signed into, you will see a button to "Disconnect". Clicking this button will remove Luminary Cloud's access to any data in your Onshape account. Note that geometries already imported from your Onshape account will not be automatically removed, but any new action related to Onshape will not be allowed, such as performing a "Sync" to the current state of the Onshape geometry or making changes to the variables of the geometry.

Importing Geometry

Onshape has been seamlessly integrated with the Luminary Cloud interactive geometry experience. To import a model from Onshape, you simply follow the normal geometry import workflow. When creating a new project and clicking on the "Browse Files" button, you will see the Upload File dialog with an "Onshape" option.

Upon clicking on the Onshape option in the above dialog, you will be greeted by a browser of your Onshape documents. In the left column, we display your Onshape documents by name. When expanded, a list of the Onshape Workspaces and Onshape Versions will be given. Selecting a Workspace or Version will populate the second column in the Onshape document browser, which shows available Onshape Assemblies and Onshape Part Studios for import. You can also import individual Parts of a Part Studio by clicking first on the Part Studio and then on the individual Parts you would like to import. You can select multiple Parts of a Part Studio with CTRL + Left Click (Windows or Linux) or CMD + Left Click (Mac).

Upon clicking upload, Luminary Cloud will request the current state of the geometry and begin processing the geometry. Once complete, it will be presented as any other geometry import would in geometry. If the Onshape model made use of variables from an Onshape Variable Studio, you will also see the current variable values under the initial "Import" operation, as you would with any other parametric geometry format supported by Luminary. For more information on interacting with parametric geometry from Onshape, please see the Modifying Parametric Geometry section.

Importing Onshape geometry in this way is also supported via the "Add" button in the top left of the Luminary Cloud Geometry view. In this way, we support adding geometry from multiple different Onshape documents, workspaces, versions, and elements. You can also mix-and-match Onshape geometries with geometries from any other source supported by Luminary Cloud.

Importing an Onshape Workspace

When you import a geometry from an Onshape Workspace, Luminary Cloud will create a new version for that document with the name "Luminary Cloud Import Checkpoint - ${ID}", where ${ID} is a unique identifier. This ID can then be used to confirm which version of your geometry is currently imported to be used in Luminary. If you would like to synchronize the Onshape geometry imported to the current state of the Workspace you originally imported, you can simply click the "Sync" button in associated "Import" feature. This will create a new Onshape Version in your document with a new identifying ID that is the current state of the Workspace and import this new geometry.

Our integration will perform any actions it takes inside this Onshape version we have created to isolate our changes from those you might also be performing in the Onshape document. You should not modify anything related to that Version. When we make changes to the geometry due to parameter changes (see Modifying Parametric Geometry) it will be done in a temporary Workspace we create as a branch from this Luminary Cloud Import Checkpoint Version. Creation of this version also provides some indication in Onshape of the states of the geometry when it was used in Luminary.

Use of the "Hide Luminary Checkpoints" option in the Luminary Cloud Onshape Document browser will hide Luminary-created checkpoint Versions when using the browser. If you would like to see them, simply uncheck the option in the browser and they will be available to import from as well.

Importing an Onshape Version

When you import a geometry from an Onshape Version, Luminary Cloud will not create another version, and will instead use the version you supplied. The name of version you have imported from will be written into the "Import" feature name in Luminary, and can be used to determine the origin of the geometry in Onshape. As described above in Importing an Onshape Workspace, we will make temporary Workspaces branched from the original Version when performing any work inside the Luminary Cloud platform.

Importing individual Onshape parts

You can import individual Parts from an Onshape Part Studio, and we will only insert those as geometry for use in Luminary Cloud. This is useful when the parts of the geometry relevant for simulation are only a small subset of those needed for the full CAD description. When working with just a subset of parts, the "Sync" capability and parametric geometry changes will work just as before. Note, however, that we persist the connection to the Parts via Part IDs, which are not guaranteed to be stable. If changes you make to your Workspace prior to a "Sync", or a certain combination of variable values, result in significant changes to your model, the import of some of the Parts may fail.

Bringing in Tags from Onshape

It is simple to bring in tags from Onshape directly into Luminary Cloud to be used when setting up your simulation. To do so, you simply need to right click a surface in Onshape and select "Edit face appearance..." from the menu that opens. Once there, create a new appearance name, such as "Fuselage" in the below image. This surface will now be associated with the tag "Fuselage" when the geometry is imported into Luminary Cloud via the integration. We also generate tags for volumes according to the Onshape Part name, such as "WholePlane" in the below image.

Modifying Parametric Geometry

If you import an Onshape Workspace or Version that uses a Variable Student element to control parameters in your model, you will be able to control those elements from the Luminary Cloud application as well. In our UI, we will always present the variable values in SI units with degrees for angles, and expect changes to the variables to also follow this unit convention. Note that this does not mean that you need to use these workspace units in Onshape itself, we will handle the conversion for you.

To modify variable values, you simply need to click on the "Import" feature associated with the Onshape model and then modify any number of values associated with the variables in the geometry. Once you wish to apply the changes, click the "Apply". This will make Luminary Cloud request the new geometry from Onshape with the updated values. If you watch the Onshape document as this is happening, you will see a temporary Workspace be created from the Version Luminary Cloud is referencing. In this temporary workspace, we then make modifications to the Variable Studio values, export a new geometry, and delete the workspace. The most important thing is you will get the modified geometry into your Luminary Cloud project with the variable values used to create the geometry displayed.

When designing a parametric Onshape model to be used with the Luminary Cloud integration, there are a couple of rules to keep in mind:

  1. All variables you want to change should be in a Variable Studio element

  2. Only independent variables can be changed (e.g., no expressions or references to other variables). For instance, you can not change a variable with an expression like expr = 5 * #length, but can refactor it to be multiplier = 5 and expr = #multiplier * #length. The expr can still be used in the Onshape model, but will not be controllable from Luminary Cloud. The variable multiplier will be and can be used to manipulate the value of #expr, along with #length if it meets this criteria itself.

If a variable does not meet the above two criteria, it will not be displayed in the Luminary Cloud interface. If this is the case, please revisit your Onshape model and check the parameterization.

Troubleshooting Errors

You may see Onshape related issues appear as yellow triangles for warnings or red dots for errors in the Luminary Cloud feature tree. Please see below for how to handle them:

Warnings

  • "The Onshape element was empty."
    The Onshape model you are trying to import is either empty or had some other trouble (such as regenerating) resulting in no solid object.

  • "Onshape had issues generating the geometry. Issues detected in..."
    Your Onshape model has some warnings or errors on Onshape features. We just report them in our feature tree as well. They may or may not be concerning.

  • "All specified parts for import were not found in the Onshape document."
    This is the equivalent of "The Onshape element was empty": when you have chosen to only import a subselection of Parts from your Onshape Part Studio.

  • "Onshape had issues generating the geometry. We could not find parts..."
    Depending on operations, the regeneration of Onshape documents or other modifications can change the Part IDs we rely on for persisting the part selections. If that happens and the Part can no longer be located in the document, we return this warning with the listed part IDs and names. See Importing Individual Onshape Parts for more information.

Errors

  • "User has no associated Onshape account."
    You most likely do not have an active Onshape account associated with your Luminary account. Please see Authentication for more information.

  • "User is missing required permissions: ..."
    You have an active Onshape account associated to your Luminary account, but it has insufficient permissions to the Onshape document. We require that you must have READ, WRITE, and EXPORT permissions to use the model with the Luminary integration.

  • "Onshape has rate-limited your account. Retry after {#} seconds."
    Onshape has rate-limited your access to the Onshape API, which Luminary uses on your behalf. After waiting for the suggested number of seconds, the Onshape API and Luminary integration should begin working for you again.

  • "Onshape has rate-limited your account. Retry at a later time."
    Same as the above, however, we could not determine the amount of time you are required to wait. You should be able to use the Luminary integration at some later time.

  • "It is retriable and may work at a later time."
    A catch-all error for intermittent difficulties in accessing the Onshape API, covering HTTP errors such as 500, 502, 503, and 504, amongst others. Service disruptions are usually very brief and retrying the action should work.

Use in Luminary Cloud's Python SDK

The same functionality discussed in this article is accessible through the SDK. Geometries from Onshape can be imported in the typical Luminary Cloud SDK manner using create_geometry and providing the URL to an Onshape element. Parameters in the Onshape geometry can also be modified in the typical way Luminary handles parametric geometry in the SDK. Please see the SDK documentation for details.

Did this answer your question?