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.
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:
- Create a part record.
- Upload your STEP file to the URL the API returns.
- Request processing for the part.
- Listen to the job's event stream and show progress until processing finishes.
- Fetch feature details.
- 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.
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
Uses the @toolpath/api package. The example includes a test showing how to exercise the same code.
Run it with pnpm.
Python
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.