Skip to content

About

Solidworks plugin for directly importing models into pancakeslicer.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SolidCake

A SOLIDWORKS add-in that exports the active part or assembly and opens it in PancakeSlicer in one click — the model is already on the plate when the browser opens.

How it works

SOLIDWORKS  --SaveAs STL-->  temp file  --PUT /api/assets/<sha256>-->  PancakeSlicer
                                                              |
                                                              +--> browser opens /?import=<asset>
                                                                   (model on the plate)

The add-in stores the STL as a content-addressed asset on the server, then opens the web UI with ?import=<asset>. The web UI pulls the asset, imports it as a normal project, and the user slices in the browser as usual. Nothing is hardcoded about the server — the add-in only needs a base URL.

Layout

Path What it is
src/SolidCake.Core Settings file, HTTP client, and server discovery (netstandard2.0, no SOLIDWORKS dependency)
src/SolidCake.Addin The SOLIDWORKS add-in (net48, references the SOLIDWORKS interop DLLs)
tools/upload.py Standalone uploader, standard library only — useful for testing the contract

Requirements

  • Windows with SOLIDWORKS installed (the add-in targets .NET Framework 4.8)
  • The .NET SDK 8.0 or newer. The SDK can build net48 projects without Visual Studio because the project pulls in the reference assemblies from NuGet.
  • A reachable PancakeSlicer server

Visual Studio 2022 is optional. It is convenient for debugging, but not needed.

Build

From the repository root, in PowerShell:

dotnet build src/SolidCake.Addin/SolidCake.Addin.csproj -c Release

The first build restores the SOLIDWORKS interop packages from NuGet. If your SOLIDWORKS install is not in the default location, pass the interop directory:

dotnet build src/SolidCake.Addin/SolidCake.Addin.csproj -c Release `
  -p:SolidWorksApiDir="D:\SW\api\redist"

The output is src\SolidCake.Addin\bin\Release\net48\SolidCake.Addin.dll. The folder also receives the three SOLIDWORKS interop DLLs — registration needs them next to the add-in, so keep the folder intact and do not move the add-in DLL out of it.

Install

Run the installer from the repository root. It builds the add-in and registers it for COM. It needs administrator rights and will ask for them:

powershell -ExecutionPolicy Bypass -File .\install.ps1

Then start SOLIDWORKS. Tools > Add-ins should list SolidCake; tick it and a SolidCake toolbar appears.

To remove it:

powershell -ExecutionPolicy Bypass -File .\uninstall.ps1

What registration actually does

Two steps, both easy to get wrong by hand:

  1. regasm /codebase writes the COM registration for the add-in's CLSID and records the DLL's absolute path. Build somewhere stable — a bin\Release folder you intend to keep. Moving the DLL later breaks the registration.
  2. The add-in's [ComRegisterFunction] writes HKLM\SOFTWARE\SolidWorks\Addins\{guid}, which is what makes SOLIDWORKS list it under Tools > Add-ins.

install.ps1 runs the first and lets the second happen; uninstall.ps1 reverses both. The manual equivalent is:

$regasm = "$env:WINDIR\Microsoft.NET\Framework64\v4.0.30319\regasm.exe"
& $regasm /codebase "src\SolidCake.Addin\bin\Release\net48\SolidCake.Addin.dll"

If the add-in does not appear

  • Confirm the prompt was elevated. Registering under HKLM fails silently without admin rights.
  • Confirm the DLL is x64. The project targets x64; a 32-bit build will not load into 64-bit SOLIDWORKS.
  • Check that the path passed to /codebase is the same file you built. Moving the DLL after registration breaks the COM entry.

Configure

The settings live in the SolidCake task pane on the right of the SOLIDWORKS window. The pane has one job: know where the server is.

  1. Server — type the server address, or press Discover.
  2. Discover broadcasts on the LAN for a PancakeSlicer server, then falls back to the last-used address, localhost:6868 and the machine name. If it finds one it fills the field in and connects straight away.
  3. Open in PancakeSlicer exports the active document to STL, stores it on the server, and opens your browser with the model already on the plate. Pick the printer, filament and profile in the browser.

Type the address exactly as you reach the server — the port you give is the port used. https://server.example.com stays on 443; only a bare host such as server.lan gets http:// added. If discovery finds nothing (an older server, a network that drops broadcast, or a different subnet) type the address and press Connect — that always works.

Discovery cannot guess a name it has never been told. A server behind a reverse proxy advertises the address it sees on its own interface, which is usually not reachable from your desk, so set ORCA_WEB_PUBLIC_URL on the server to the URL you actually use (for example https://server.example.com) and discovery will advertise that instead.

The address is written to %APPDATA%\SolidCake\settings.ini, so it survives a restart. The file stays the source of truth and can still be edited by hand:

[server]
url=http://your-server-host:6868
token=

token is optional. Leave it empty if the server runs without ORCA_WEB_BEARER_TOKEN; otherwise paste the same value here. The token is stored in plain text — keep the file on a machine you trust and do not commit it.

Use

  1. Open a part or assembly.
  2. Click Open in PancakeSlicer on the SolidCake toolbar.
  3. The model is exported to STL, stored on the server, and your browser opens with the model already on the plate. Choose the printer, filament and profile there and slice as normal.

That is the whole point of the add-in: no Print to 3D, no output directory, no dragging a file into the browser.

The pane reports what is happening under the Connect button — the export and the upload.

When something does not work

Every step is written to a log:

%LOCALAPPDATA%\SolidCake\solidcake.log

It records the address the pane connected to and the server's status code and reply for each request. A failed upload also shows the message on screen with the log path. Nothing secret is written — the token is never logged.

Send that file when reporting a problem; it usually says what went wrong in one line.

Testing without SOLIDWORKS

tools/upload.py implements the same contract in Python and needs only the standard library:

python3 tools/upload.py bracket.stl --url http://server:6868

It prints the asset URL and the browser URL.

Notes and limitations

  • STL only for now. Assemblies export as a single merged mesh. 3MF export would preserve colors and multiple bodies but needs a different export path.
  • The browser, not an embedded panel. Rendering the slicer inside SOLIDWORKS would mean hosting a WebView2 control and sharing the GPU with the CAD viewport. The system browser is faster and cannot crash the CAD session.
  • Windows only. The add-in is a COM component; there is no macOS or Linux build of SOLIDWORKS to target.

About

Solidworks plugin for directly importing models into pancakeslicer.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages