File Mixin¶
Drawing file operations: open, save, close, new, and multi-drawing management.
adapters.mixins.file_mixin.FileMixin
¶
Mixin for file operations.
save_drawing
¶
Save drawing to file.
| PARAMETER | DESCRIPTION |
|---|---|
filepath
|
Full path to save file (e.g., 'C:/drawings/myfile.dwg')
TYPE:
|
filename
|
Just the filename (e.g., 'myfile.dwg'). If provided without filepath, uses configured output directory
TYPE:
|
format
|
File format (dwg, dxf, etc.). Default: dwg
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if successful, False otherwise
TYPE:
|
Note
- If both filepath and filename provided, filepath takes precedence
- If only filename provided, saved to config output directory
- If neither provided, uses current document name
open_drawing
¶
Open a drawing file in the CAD application via COM.
| PARAMETER | DESCRIPTION |
|---|---|
filepath
|
Absolute path to the drawing file to open (e.g.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the file was opened successfully, False otherwise. |
new_drawing
¶
Create a new blank drawing document in the CAD application via COM.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the document was created successfully, False otherwise. |
get_open_drawings
¶
Get list of all open drawing filenames.
| RETURNS | DESCRIPTION |
|---|---|
list
|
List of drawing names (e.g., ["drawing1.dwg", "drawing2.dwg"]) |
switch_drawing
¶
Switch to a different open drawing.
| PARAMETER | DESCRIPTION |
|---|---|
drawing_name
|
Name of the drawing to switch to (e.g., "drawing1.dwg")
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if successful, False otherwise |
close_drawing
¶
Close the current drawing.
| PARAMETER | DESCRIPTION |
|---|---|
save_changes
|
Whether to save changes before closing (default: False) True = save changes False = discard changes without prompting
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if successful, False otherwise |