.NET API
FileApi
File-menu utilities that are not the plain open/save lifecycle (that one lives in DocumentApi): standardizing an imported document, moving the user’s element library between machines, and the template.
from ArtisanPlugin.Scripting import FileApi
See also the Python package, ra.files.
Methods
| Method | |
|---|---|
ExportElements | Exports every saved element of one type to a JSON file (the ArtisanExportElementsByType tool, headless) — the way to carry the user’s presets (bezels, baskets, halos…) to another machine. |
ImportElements | Imports elements into the user’s library (the ArtisanImportElementsByFile tool, headless): either a single “.raelement” bundle (element + preview) or a “.json” array as written by ExportElements. |
SaveAsTemplate | Saves the active document as the Artisan template (the ArtisanSaveAsTemplate tool, headless): Rhino’s SaveAsTemplate to “ |
Standardize | Standardizes a document that came from elsewhere (the ArtisanStandardize tool, headless), running the same sequence as the command: explode every block instance, recover the gems (ArtisanGemsRecover), move solids/meshes to the metal layers (ArtisanOrganizeObjectsByLayers), purge all render materials, re-apply the Artisan design materials, and estimate the ring size. |
ExportElements
ElementsExport FileApi.ExportElements(string type, string path)
Exports every saved element of one type to a JSON file (the ArtisanExportElementsByType tool, headless) — the way to carry the user’s presets (bezels, baskets, halos…) to another machine. type is one of ElementsApi.Types() (“Bezel”, “Basket”, “Halo”, “Peghead”…); the store’s own names (“ADVANCED_BASKET”) are also accepted. ‘.json’ is appended when missing; the folder is created.
| Parameter | Type | Default |
|---|---|---|
type | string | required |
path | string | required |
Returns ElementsExport.
ImportElements
ElementsImport FileApi.ImportElements(string path)
Imports elements into the user’s library (the ArtisanImportElementsByFile tool, headless): either a single “.raelement” bundle (element + preview) or a “.json” array as written by ExportElements. Elements that already exist (same id) are skipped, like the tool; where the tool asks “add the new ones?” this just adds them. Returns what was imported.
| Parameter | Type | Default |
|---|---|---|
path | string | required |
Returns ElementsImport.
SaveAsTemplate
string FileApi.SaveAsTemplate(string path = null)
Saves the active document as the Artisan template (the ArtisanSaveAsTemplate tool, headless): Rhino’s SaveAsTemplate to “path overrides the destination (‘.3dm’ appended, folder created). Returns the full path written.
| Parameter | Type | Default |
|---|---|---|
path | string | null |
Returns string.
Standardize
StandardizeResult FileApi.Standardize()
Standardizes a document that came from elsewhere (the ArtisanStandardize tool, headless), running the same sequence as the command: explode every block instance, recover the gems (ArtisanGemsRecover), move solids/meshes to the metal layers (ArtisanOrganizeObjectsByLayers), purge all render materials, re-apply the Artisan design materials, and estimate the ring size. Long on heavy documents. Returns counts of what was cleaned.
Returns StandardizeResult.