Skip to content

schneik80/PowerTools-Onshape-Import

Repository files navigation

PowerTools: Import from Onshape

Docs: Usage Guide · Architecture

A Fusion add-in that lets you browse your Onshape documents, pick a Part Studio or Assembly, and import it into Fusion as a new untitled document. The transfer happens via Onshape's async STEP translation API; the resulting STEP file is downloaded to your machine and opened by Fusion's local STEP translator (no cloud import, no upload to Fusion Team).

Installation

  1. Clone or download this folder.
  2. Copy lib/fusionAddInUtils from any of the schneik80 PowerTools-* add-ins into lib/fusionAddInUtils here. (It's vendored Autodesk sample code that handles event-handler lifetime management; rather than redistribute it I link to the source.)
  3. In Fusion: Utilities → Add-Ins (or Shift+S) → green + → select this folder → Run.

Authorization

The add-in uses OAuth 2 to authenticate with Onshape. On first use a browser window opens automatically — log in to Onshape and click Authorize. Tokens are cached locally; subsequent uses are silent.

No manual key generation or credential files required.

Usage

  1. File menu (QAT toolbar, top-left) → Import from Onshape.
  2. The palette docks on the right. Use the filter buttons and search field to find a document; pick a workspace; pick a Part Studio or Assembly.
  3. Click Import (or double-click the tab). A progress dialog runs while Onshape generates the STEP and Fusion downloads it.
  4. The STEP opens as a new untitled document. Save it (or don't) — it's local and unsaved until you do.

How it works

sequenceDiagram
    participant UI as Palette UI
    participant E as entry.py
    participant A as api_client.py
    participant OS as Onshape

    UI->>E: listDocuments
    E->>A: list_documents()
    A->>OS: GET /documents
    OS-->>A: document list
    A-->>E: 
    E-->>UI: documents JSON

    UI->>E: listElements(did, wid)
    E->>A: list_elements()
    A->>OS: GET /elements
    OS-->>A: element list
    A-->>E: 
    E-->>UI: element list

    UI->>E: import(did, wid, eid)
    E->>A: start_step_translation()
    A->>OS: POST /translations
    OS-->>A: translation id
    loop poll until DONE
        E->>A: poll_translation()
        A->>OS: GET /translations/{tid}
        OS-->>A: status
    end
    E->>A: download_external_data()
    A->>OS: GET /externaldata/{fid}
    OS-->>A: STEP file bytes
    E->>E: importToNewDocument()<br/>(local Fusion STEP translator)
    E-->>UI: ok / error
Loading

The "open the STEP locally" step uses app.importManager.createSTEPImportOptions(path) followed by app.importManager.importToNewDocument(options). This invokes Fusion's bundled STEP translator on the local file — it does not upload to Fusion Team and does not create a DataFile. The returned Document is in-memory and untitled.

Roadmap

  • Versions / releases. Today we always export from the workspace's current state. Add a UI option to export from a specific Version.
  • Configurations. Configured Part Studios will need an extra step to send configuration= query params on the translation request.
  • Drawings. Could add DWG/DXF export and open via Fusion's drawing translator.
  • Enterprise URLs. Today ONSHAPE_BASE_URL is hard-coded to cad.onshape.com. Make it configurable for Enterprise tenants.

Trademarks

Onshape® is a registered trademark of PTC Inc. This add-in is an independent project and is not affiliated with, sponsored by, or endorsed by PTC Inc.

Autodesk® and Fusion® are registered trademarks of Autodesk, Inc. This add-in is an independent project and is not affiliated with, sponsored by, or endorsed by Autodesk, Inc.

License

GPL-3.0-or-later. See LICENSE and NOTICE for full details. Use of the Onshape API is subject to the Onshape Terms of Service.

About

Autodesk Fusion add-in: browse Onshape documents and import Part Studios or Assemblies as local STEP-based documents

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors