Available Methods
Understanding Their Use Cases
1. Creating a New Model Version
This method allows automation functions to produce structured Speckle models, enabling users to store and interact with augmented, synthesized, or entirely new geometry and data. When to Use It: This method aligns with workflows where data should remain interactive, allowing downstream applications to consume and manipulate the generated results.- Augmenting an existing model: Enhancing a source model with derived data, such as clash results, enriched metadata, or structural analysis outcomes.
- Synthesizing new geometry: Generating new elements based on parametric constraints or inferred relationships, such as simplified massing models or AI-assisted design variations.
- Contextual model generation: Constructing additional contextual models (e.g., a terrain model derived from GIS data or a structure inferred from existing conditions).
2. Storing a File Artifact
File artifacts serve as an alternative when the function output is best represented as a document, dataset, or visualization rather than an interactive Speckle model. When to Use It: Unlike model versions, file artifacts are adjacent to the Speckle ecosystem, meaning they don’t provide interactive elements within Speckle itself but can be downloaded and used externally.- Exporting non-native formats: Storing alternative representations of model data, such as .obj, .gltf, or .dotbim files for use in third-party applications.
- Creating documentation & reports: Generating PDF reports that summarize results, analysis, or model insights.
- Storing structured data: Outputting .csv or .json files for integration with BI tools or external databases.
- Data persistence: Saving SQLite databases containing structured information that can be queried later.
- Multimedia outputs: Storing images, animations, or even movie files to visualize simulation results.
Choosing the Right Approach
While object result annotation allows interactive manipulation of automation results, model versions and file artifacts serve distinct purposes:
Speckle Automate offers the flexibility to choose the best-fit approach for your workflow. Whether you’re enriching project data with new model versions or exporting specialized artifacts, understanding these methods enables greater creativity in automation.
Example: Generating Reports
Speckle Automate functions can generate structured reports in various formats, such as JSON, HTML, and PDF, to document and visualize analysis results.Example: Generating a PDF Report
store_file_result takes the file’s path and uploads it while the file still exists, so call it inside the temporary directory block. The file name in the path is the name readers see.
report.py
Example: Creating a New Model Version
Automation functions can generate new structured models, storing enhanced data or derived geometry. The target model must not be the model that triggered the run. The returned version id is reserved: the version appears once the server finishes processing it.Example: Creating a New Model Version in Speckle
new_version.py
NewVersion.cs
BundleBuilder and wait for the server to create the version. See Publish a bundle.
We can also populate the context view with details of the created model:
LinkModels.cs
SetContextView records the new model version as the run’s context view. The 3D viewer does not show Automate results; see Viewing Automation Results for where run results appear. The automation context, together with the rest of specklepy or Speckle.Sdk, covers both the run’s results and the project’s data.
Best Practices
- Give each file a descriptive name and the right extension: readers see that name.
- Generate files after processing, once the results are final.
- Write files to a temporary directory, and store them before the directory is removed.
- Keep files to a size readers can download comfortably.