Skip to main content

Create and process a part

These are complete, runnable programs that take a CAD file from upload through to a finished part. They are worth reading before you write your own, because they show the order the calls happen in and what to do while processing runs.

Both examples create the part, upload the file to the URL you get back, request processing, wait for it to finish, then get the part.

Description:

Processing does not finish while your request waits. Requesting it hands back a job immediately and the part becomes available later, which is why every example includes a step that waits for the job to complete.

What the examples do​

Each link below goes to a small, self-contained command-line program in Toolpath's SDK repository. Both versions do six things:

  1. Create a part record.
  2. Upload your CAD file to the URL the API returns.
  3. Request processing for the part.
  4. Listen to the job's event stream and show progress until processing finishes.
  5. Fetch feature details.
  6. Print the complete part as JSON.

You supply two things when you run one: your API key, read from a TOOLPATH_API_KEY environment variable, and the path to a CAD file. Nothing else needs editing. Each directory has a README with the exact command for Windows, macOS, and Linux.

Supported CAD formats​

Neither endpoint is limited to STEP, and both accept the same list:

FormatExtensions
STEP.step, .stp
Parasolid.x_t, .x_b
SolidWorks part.sldprt
CATIA V5 part.catpart
NX / Creo part.prt
IGES.igs, .iges

Whatever you can send to POST /v1/parts, you can send to POST /v1/holders.

Send the filename, and make its extension match

The filename query parameter on POST /v1/parts and POST /v1/holders is what tells the API which reader to use — nothing inspects the bytes you upload. It is optional, and when you omit it the upload is stored as STEP, so a SolidWorks or IGES file sent without a filename fails during processing rather than at upload. Pass the real name of the file you are about to send:

const part = await client.parts.createPart({ filename: 'bracket.sldprt' })

The file itself does not have to be named that on your disk; only the extension you pass matters.

Read the source to see how the calls fit together, or run an example as-is to confirm your key and setup work before writing any of your own code.

TypeScript​

View the TypeScript example →

Uses the @toolpath/api package. The example includes a test showing how to exercise the same code. Run it with pnpm.

Python​

View the Python example →

The example uses the toolpath package from the cloned Toolpath repository; it is not on PyPI yet. Install Python 3.11 or newer and uv, then follow the example's README to run it.