save_as
Save the active SolidWorks document to an explicit file path, including fresh documents with no filename. Returns saved path and success status.
Instructions
Guardar el documento activo a una ruta explícita (Save As).
A diferencia de save_active_document, esta sí funciona con piezas recién creadas que aún no tienen nombre de archivo. Una vez guardadas, los siguientes save_active_document escriben a la misma ruta. [en: Save the active document to an explicit file path. Unlike save_active_document — which only works on docs that already have a filename — save_as handles a fresh, never-saved document and sets its filename in one call. Subsequent save_active_document calls then save back to this same path.]
Args: path: Absolute file path INCLUDING extension. SolidWorks infers the document type from the extension: .SLDPRT parts .SLDASM assemblies .SLDDRW drawings Passing the wrong extension for the active doc type causes SaveAs to fail.
Returns the same dict as save_active_document:
name: document title
path: filesystem path written to
saved: True if save succeeded
errors / warnings: 0 (the simpler SaveAs variant doesn't expose these — use save_active_document on a subsequent save if you need the bitmasks).
Common use: scripted runs that build or update a document, save it to a user-controlled directory, and hand the resulting path to a downstream step.
Caveats:
The parent directory must exist; save_as does NOT mkdir.
Resolve special folders through Windows or an explicit user-provided path. Desktop and Documents locations may be redirected by OneDrive or organization policy; do not guess a hard-coded location.
Example — save a fresh part: save_as(r"C:\CAD\output\bracket_v1.SLDPRT")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |