-
Notifications
You must be signed in to change notification settings - Fork 0
3.3 exportable.py
Supports exporting 3D models to the 3MF or STL formats.
from scad_export import Model
| Field Name | Type | Default | Description |
|---|---|---|---|
| name | string |
N/A (Required) |
The name of the part to export. This value is passed as an argument to the .scad export file as "name". |
| file_name | string |
The name formatted using the output_naming_format. |
The name to use for the output file. |
| quantity | integer |
1 |
The number of copies of the exported file to create. The copies are made using filesystem copy, rather than rendering the model multiple times. |
| format | ModelFormat | default_model_format | The output format to use for the model. To set the default for all models, set the default_model_format. |
| [any] |
string or number
|
No default | Additional arguments can be defined dynamically and will be passed to your .scad file when rendering. For example, if you provide the argument "size = 5", then that's the same as having a variable in your .scad file called "size" with a value of "5". |
Supports exporting a 2D OpenSCAD project to the DXF format.
from scad_export import Drawing
| Field Name | Type | Default | Description |
|---|---|---|---|
| name | string |
N/A (Required) |
The name of the part to export. This value is passed as an argument to the .scad export file as "name". |
| file_name | string |
The name formatted using the output_naming_format. |
The name to use for the output file. |
| quantity | integer |
1 |
The number of copies of the exported file to create. The copies are made using filesystem copy, rather than rendering the model multiple times. |
| [any] |
string or number
|
No default | Additional arguments can be defined dynamically and will be passed to your .scad file when rendering. For example, if you provide the argument "size = 5", then that's the same as having a variable in your .scad file called "size" with a value of "5". |
Supports exporting an image of a model to the PNG format.
from scad_export import Image
| Field Name | Type | Default | Description |
|---|---|---|---|
| name | string |
N/A (Required) |
The name of the part to export. This value is passed as an argument to the .scad export file as "name". |
| camera_position | string |
N/A (Required) |
The camera position to use for the picture of the model. The camera coordinates can be found at the bottom of the OpenSCAD application window when previewing a model. To make copying the coordinates easier, a custom function like echo cam can be used to output the camera position to the OpenSCAD console. |
| file_name | string |
The name formatted using the output_naming_format. |
The name to use for the output file. |
| image_size | ImageSize | default_image_size | The resolution of the output image. If you want all images to use the same resolution, set the default_image_size. |
| color_scheme | ColorScheme | default_image_color_scheme | Overrides the color scheme to use when taking the image. Supports all OpenSCAD color schemes. To set the default for all images, set the default_image_color_scheme. |
| [any] |
string or number
|
No default | Additional arguments can be defined dynamically and will be passed to your .scad file when rendering. For example, if you provide the argument "size = 5", then that's the same as having a variable in your .scad file called "size" with a value of "5". |
Folders specify the folder structure that should be used for output files. Folders can contain any number of other exportables, including additional Folders.
from scad_export import Folder
| Field Name | Type | Default | Description |
|---|---|---|---|
| name | string |
N/A (Required) |
The name of the folder. If the name includes any slash separators (/), a separate folder will be created for each segment of the name separated by slashes. The name will be formatted using the output_naming_format. |
| contents | list |
N/A (Required) |
A list of other exportable types, including Models, Drawings, Images, and nested Folders. |
Enum for select the model export type
from scad_export import ModelFormat
| Name | Value | Description |
|---|---|---|
| _3MF | .3mf |
Represents the 3MF format. The name begins with an underscore because names can't begin with numbers in Python. |
| STL | .stl |
Represents the STL format. |
The default color scheme to use when exporting images. The value will be passed to OpenSCAD using the --colorscheme command line arg. Colors defined in your .scad code will override the values here.
from scad_export import ColorScheme
| Name | Value |
|---|---|
| CORNFIELD | Cornfield |
| METALLIC | Metallic |
| SUNSET | Sunset |
| STAR_NIGHT | Starnight |
| BEFORE_DAWN | BeforeDawn |
| NATURE | Nature |
| DAYLIGHT_GEM | Daylight Gem |
| NOCTURNAL_GEM | Nocturnal Gem |
| DEEP_OCEAN | DeepOcean |
| SOLARIZED | Solarized |
| TOMORROW | Tomorrow |
| TOMORROW_NIGHT | Tomorrow Night |
| CLEAR_SKY | ClearSky |
| MONOTONE | Monotone |
The width and height of an exported image in pixels.
from scad_export import ImageSize
| Field Name | Type | Default | Description |
|---|---|---|---|
| width | integer |
1600 |
The width of the image in pixels. |
| height | integer |
900 |
The height of the image in pixels. |