Skip to content

Allsolve SDK API Reference

allsolve SDK 0.1.6-beta

allsolve.import_project

Contains a PoC of a convenience import format parser.

import_project

def import_project(file_or_data: str | dict,
project_to_modify: Project | None = None) -> Project

Import a project from a file or a dictionary.

Takes a file in YAML or JSON format, an example with all supported fields etc. is given in example/import_geom/project-format.yaml.

Arguments:

  • file_or_data - The path to the file to import or a dictionary.
  • project_to_modify - The project to modify. If not provided, a new project is created.

Returns:

The imported project object.

allsolve.material

MaterialProperty Objects

class MaterialProperty()

MaterialProperty is a base class for managing material properties.

Material Objects

class Material()

Material is a class for managing materials in a project.

create

@classmethod
def create(cls,
name: str,
color: str,
description: str | None = None,
properties: List[MaterialProperty.PhysicalProperty] = [],
target_region: Region | None = None,
abbreviation: str | None = None,
project_id: str | None = None) -> Self

Create a new material.

get

@classmethod
def get(cls, material_id: str, project_id: str | None = None) -> Self

Get a material by its ID.

get_all

@classmethod
def get_all(cls, project_id: str | None = None) -> List[Self]

Get all materials in a project.

id

@property
@prevent_deleted
def id() -> str

Get the ID of the material.

name

@property
@prevent_deleted
def name() -> str

Get the name of the material.

name

@name.setter
@prevent_deleted
def name(name: str) -> None

Set the name of the material. Use save() to commit the change.

description

@property
@prevent_deleted
def description() -> str | None

Get the description of the material.

description

@description.setter
@prevent_deleted
def description(description: str) -> None

Set the description of the material. Use save() to commit the change.

color

@property
@prevent_deleted
def color() -> str

Get the color of the material.

color

@color.setter
@prevent_deleted
def color(color: str) -> None

Set the color of the material. Use save() to commit the change.

target

@property
@prevent_deleted
def target() -> str | None

Get the target of the material.

target

@target.setter
@prevent_deleted
def target(target: str) -> None

Set the target of the material. Use save() to commit the change.

properties

@property
@prevent_deleted
def properties() -> List[rawapi.PhysicalProperty]

Get the properties of the material.

properties

@properties.setter
@prevent_deleted
def properties(properties: List[rawapi.PhysicalProperty]) -> None

Set the properties of the material. Use save() to commit the change.

abbreviation

@property
@prevent_deleted
def abbreviation() -> str | None

Get the abbreviation of the material.

abbreviation

@abbreviation.setter
@prevent_deleted
def abbreviation(abbreviation: str) -> None

Set the abbreviation of the material. Use save() to commit the change.

delete

@prevent_deleted
def delete() -> None

Delete the material.

save

@prevent_deleted
def save() -> None

Explicitly save the changes to the cloud made by setting properties name, description, color, and properties.

allsolve.token

allsolve.util

NotInitializedError Objects

class NotInitializedError(Exception)

Exception for when a class or data is not initialized.

DeletedError Objects

class DeletedError(Exception)

Exception for when an object is deleted.

NotProjectAPIKeyError Objects

class NotProjectAPIKeyError(Exception)

Exception for when a project API key is not set.

allsolve.job

Job Objects

class Job()

Job for a project.

Jobs are created when a geometry or a mesh is processed, or when a simulation is run.

id

@property
def id() -> str

Get the job ID

get_status

def get_status() -> str | None

Get the current status of the job.

Returns:

The status of the job.

refresh_status

def refresh_status(delay_s: float = DEFAULT_DELAY_S) -> str | None

Refresh the status of the job from the server.

Arguments:

  • delay_s - Optional time to wait before refreshing the status

Returns:

The status of the job.

is_running

def is_running(refresh_delay_s: float | None = None) -> bool

Check if the job is still running.

Arguments:

  • refresh_delay_s - Optional time to wait before checking the status

Returns:

True if the job is still running, False otherwise.

get_logs

def get_logs(limit: int = 100) -> List[str]

Get log messages, starting from where we left off previously

Arguments:

  • limit - Optional maximum number of logs to retrieve

Returns:

A list of log messages.

def print_new_loglines(file: TextIO = sys.stdout, limit: int = 100) -> None

Print new log lines to the specified output

Arguments:

  • file - Optional file to print the logs to.
  • limit - Optional maximum number of logs to retrieve and print.

get_status_reason

def get_status_reason() -> str | None

Get the reason for the current job status, if available

Returns:

The reason for the current job status, if available.

allsolve.region

RegionOperation Objects

class RegionOperation(Enum)

Enum for the RegionOperation.

Region Objects

class Region()

Region of a geometry.

get_all

@classmethod
def get_all(cls, project_id: str | None = None) -> List[Self]

Get all regions in the project.

Arguments:

  • project_id - The ID of the project. Can be omitted if project API key is used.

Returns:

A list of Region objects.

create

@classmethod
def create(cls,
name: str,
entity_type: rawapi.EntityType,
entity_tags: List[int],
region_rule: rawapi.RegionRule | None = None,
project_id: str | None = None) -> Self

Create a region in the project.

Arguments:

  • name - The name of the region.
  • entity_type - The type of the entity.
  • entity_tags - The tags of the entity.
  • region_rule - Optional region rule of the region.
  • project_id - The ID of the project. Can be omitted if project API key is used.

Returns:

The created region.

id

@property
@prevent_deleted
def id() -> str

Get the ID of the region.

name

@property
@prevent_deleted
def name() -> str

Get the name of the region.

entity_tags

@property
@prevent_deleted
def entity_tags() -> List[int]

Get the entity tags of the region.

entity_type

@property
@prevent_deleted
def entity_type() -> rawapi.EntityType

Get the entity type of the region.

delete

@prevent_deleted
def delete() -> None

Delete the region.

KeyValueAttributePath Objects

class KeyValueAttributePath(rawapi.AttributePath)

KeyValueAttributePath.

RegionRule Objects

class RegionRule(Region)

RegionRule.

create

@classmethod
def create(cls,
name: str,
entity_type: rawapi.EntityType,
attribute_path: rawapi.AttributePath | None = None,
bounding_box: rawapi.ExpressionBoundingBox | None = None,
min_size: rawapi.ExpressionVector | None = None,
max_size: rawapi.ExpressionVector | None = None,
project_id: str | None = None) -> Self

Create a region rule in the project.

Arguments:

  • name - The name of the region.
  • entity_type - The type of the entity.
  • attribute_path - The attribute path of the region.
  • bounding_box - The bounding box of the region.
  • min_size - The minimum size of the region.
  • max_size - The maximum size of the region.
  • project_id - The ID of the project. Can be omitted if project API key is used.

Returns:

The created region rule.

ComputedRegion Objects

class ComputedRegion(Region)

ComputedRegion.

create

@classmethod
def create(cls,
name: str,
entity_type: rawapi.EntityType,
operation: rawapi.RegionRuleOperation,
source_region_ids: List[str],
project_id: str | None = None) -> Self

Create a computed region in the project.

Arguments:

  • name - The name of the region.
  • entity_type - The type of the entity.
  • operation - The operation to perform on the source regions.
  • source_region_ids - The IDs of the source regions.
  • project_id - The ID of the project. Can be omitted if project API key is used.

Returns:

The created computed region.

allsolve.simulation.simulation

CPU Objects

class CPU(Enum)

Enum for the type of CPU.

Runtime Objects

class Runtime()

Runtime for a simulation.

Script Objects

class Script()

Script for a simulation.

SolverMode Objects

class SolverMode()

Solver mode for a simulation.

Simulation Objects

class Simulation()

Simulation of a project.

get

@classmethod
def get(cls, simulation_id: str, project_id: str | None = None) -> Self

Get a simulation by its ID.

Arguments:

  • simulation_id - The ID of the simulation.
  • project_id - The ID of the project. Can be omitted if project API key is used.

Returns:

The simulation.

get_all

@classmethod
def get_all(cls, project_id: str | None = None) -> List[Self]

Get all simulations in the given project.

Arguments:

  • project_id - The ID of the project. Can be omitted if project API key is used.

Returns:

A list of simulations.

copy_simulation

@classmethod
def copy_simulation(cls,
simulation_id: str,
project_id: str | None = None) -> Self

Make a copy of the given simulation identified by its ID. Useful for creating simulations from a template.

Arguments:

  • simulation_id - The id of the source simulation.
  • project_id - The id of the project where the source and target simulation exist. If project API key is used, this is optional.

Returns:

The copied simulation.

create

@classmethod
def create(cls,
name: str,
description: str,
max_run_time_minutes: int,
solver_mode: rawapi.DistributedSolverMode,
mesh_id: str | None = None,
variable_overrides_id: str | None = None,
project_id: str | None = None) -> Self

Create a new simulation in the given project.

Arguments:

  • name - The name of the new simulation.
  • description - The description of the new simulation.
  • max_run_time_minutes - The maximum run time of the simulation.
  • solver_mode - The solver mode of the simulation.
  • mesh_id - The ID of the mesh to use in the simulation.
  • variable_overrides_id - The optional ID of the VariableOverrides to use in the simulation.
  • project_id - The id of the project where the new simulation should be created. If project API key is used, this is optional.

Returns:

The created simulation.

id

@property
@prevent_deleted
def id() -> str

Get the ID of the simulation.

name

@property
@prevent_deleted
def name() -> str

Get the name of the simulation.

name

@name.setter
@prevent_deleted
def name(name: str) -> None

Set the name of the simulation.

description

@property
@prevent_deleted
def description() -> str | None

Get the description of the simulation.

description

@description.setter
@prevent_deleted
def description(description: str) -> None

Set the description of the simulation.

mesh_id

@property
@prevent_deleted
def mesh_id() -> str | None

Get the ID of the mesh used in the simulation.

mesh_id

@mesh_id.setter
@prevent_deleted
def mesh_id(mesh_id: str) -> None

Set the ID of the mesh used in the simulation.

max_run_time_minutes

@property
@prevent_deleted
def max_run_time_minutes() -> int

Get the maximum run time of the simulation.

max_run_time_minutes

@max_run_time_minutes.setter
@prevent_deleted
def max_run_time_minutes(max_run_time_minutes: int) -> None

Set the maximum run time of the simulation.

solver_mode

@property
@prevent_deleted
def solver_mode() -> rawapi.DistributedSolverMode

Get the solver mode of the simulation.

solver_mode

@solver_mode.setter
@prevent_deleted
def solver_mode(solver_mode: rawapi.DistributedSolverMode) -> None

Set the solver mode of the simulation.

node_count

@property
@prevent_deleted
def node_count() -> int | None

Get the number of nodes used in the simulation.

node_type

@property
@prevent_deleted
def node_type() -> CPU

Get the type of nodes used in the simulation.

shared_files

@property
@prevent_deleted
def shared_files() -> List[rawapi.InputFile]

Get the shared files used in the simulation.

files

@property
@prevent_deleted
def files() -> List[rawapi.InputFile]

Get the files used in the simulation.

variable_overrides

@property
@prevent_deleted
def variable_overrides() -> VariableOverrides | None

Get the variable overrides of the simulation.

variable_overrides

@variable_overrides.setter
@prevent_deleted
def variable_overrides(variable_overrides: VariableOverrides | None) -> None

Set the variable overrides of the simulation.

set_scripts

@prevent_deleted
def set_scripts(scripts: List[Script]) -> None

Set the scripts used in the simulation.

refresh_status

@prevent_deleted
def refresh_status(delay_s: float = 1) -> str | None

Refresh the status of the processing of the simulation.

Arguments:

  • delay_s - Optional delay in seconds between checking the status of the simulation.

Returns:

The status of the processing of the simulation.

get_status

@prevent_deleted
def get_status() -> str | None

Get the status of the processing of the simulation.

Returns:

The status of the processing of the simulation.

is_running

@prevent_deleted
def is_running(refresh_delay_s: float | None = None) -> bool

Check if the processing of the simulation is running.

Arguments:

  • refresh_delay_s - Optional delay in seconds between checking the status of the simulation.

Returns:

True if the simulation is running, False otherwise.

get_status_reason

@prevent_deleted
def get_status_reason() -> str | None

Get the status reason of the simulation.

Returns:

The status reason of the simulation.

get_logs

@prevent_deleted
def get_logs(limit: int = 100) -> List[str]

Get the logs of the simulation.

Arguments:

  • limit - Optional maximum number of logs to return.

Returns:

The logs of the simulation.

@prevent_deleted
def print_new_loglines(file: TextIO = sys.stdout, limit: int = 100) -> None

Print the new log lines of the simulation.

Arguments:

  • file - Optional file to print the logs to.
  • limit - Optional maximum number of logs to print.

set_runtime

@prevent_deleted
def set_runtime(runtime: Runtime) -> None

Set the runtime of the simulation.

save

@prevent_deleted
def save() -> None

Explictly save the changes to the cloud made by set_runtime method or setting properties name, description, mesh_id, max_run_time_minutes, solver_mode and variable_overrides.

Otherwise the changes are saved automatically when start() is called.

set_shared_files

@prevent_deleted
def set_shared_files(handles: List[rawapi.InputFile]) -> None

Takes a list of project shared file handles and marks them to be used with this simulation. To remove files, remove them from the list and set again.

Arguments:

  • handles - List of project shared file handles to use in the simulation

add_file

@prevent_deleted
def add_file(filepath: str) -> rawapi.InputFile

Add the file in the given path to the project as shared file

Arguments:

  • filepath - path to a file in the local system. If used in a simulation, it is available with its basename.

Returns:

The shared file handle.

add_json_file

@prevent_deleted
def add_json_file(name: str, content: dict) -> rawapi.InputFile

Add shared file to the project with the given dictionary serialized into JSON as content.

Arguments:

  • name - The name for the file during the simulation
  • content - dictionary containing your data

Returns:

The shared file handle.

start

@prevent_deleted
def start() -> None

Start the simulation.

abort

@prevent_deleted
def abort() -> None

Abort the simulation.

get_output_csv

@prevent_deleted
def get_output_csv(delimiter=",", refresh: bool = False) -> str

Get the output of the simulation in CSV format.

Arguments:

  • delimiter - The delimiter to use in the CSV file.
  • refresh - Whether to refresh the output data.

Returns:

String containing the output of the simulation in CSV format.

get_output_data

@prevent_deleted
def get_output_data(refresh: bool = True) -> SimulationOutputData

Returns the output data of the simulation.

Arguments:

  • refresh - Whether to refresh the output data.

Returns:

allsolve.sim.SimulationOutputData object

get_output_values

@prevent_deleted
def get_output_values(sweep_index: int = 0, refresh: bool = False) -> dict

Get the output values of the simulation.

Arguments:

  • sweep_index - The index of the sweep.
  • refresh - Whether to refresh the output values.

Returns:

The output values of the simulation.

save_output_field

@prevent_deleted
def save_output_field(name: str,
sweep_index: int = 0,
step_index: int | None = None,
output_dir: str = "./") -> None

Save the output field of the simulation.

Arguments:

  • name - The name of the field to save.
  • sweep_index - The index of the sweep.
  • step_index - The index of the step or None.
  • output_dir - The directory to save the field to.

save_output_mesh

@prevent_deleted
def save_output_mesh(name: str,
sweep_index: int = 0,
step_index: int | None = None,
output_dir: str = "./") -> None

Save the output mesh of the simulation.

Arguments:

  • name - The name of the mesh to save.
  • sweep_index - The index of the sweep.
  • step_index - The index of the step or None.
  • output_dir - The directory to save the mesh to.

save_output_files

@prevent_deleted
def save_output_files(filenames: List[str], output_dir: str = "./") -> None

Save the output files of the simulation.

Arguments:

  • filenames - The names of the files to save.
  • output_dir - The directory to save the files to.

copy

@prevent_deleted
def copy() -> Self

Make a copy of the simulation. Useful for creating simulations from a template.

Returns:

The copied simulation.

delete

@prevent_deleted
def delete() -> None

Delete the simulation from the project. After deletion, the Simulation object cannot be used and should be discarded.

allsolve.simulation

allsolve.simulation.simulation_output_data

allsolve.mesh

ExtrusionLayerDefinition Objects

class ExtrusionLayerDefinition()

A layer definition for SlantedExtrusion, PathExtrusion and FlattenAndRebuildExtrusion.

Arguments:

  • relative_height - The relative height of the layer.
  • sublayer_count - The number of sublayers in the layer.

MeshRefinement Objects

class MeshRefinement()

A refinement for a mesh.

Arguments:

  • region - The region to refine.
  • max_size - The maximum size of the refinement.

SlantedExtrusion Objects

class SlantedExtrusion()

A slanted extrusion for a mesh.

Arguments:

  • volumes - The volumes to extrude.
  • from_surfaces - The surfaces to extrude from.
  • to_surfaces - The surfaces to extrude to.
  • layers - The layers of the extrusion.
  • quadrangles - Whether to use quadrangles for the extrusion.

PathExtrusion Objects

class PathExtrusion()

A path extrusion for a mesh.

Arguments:

  • volumes - The volumes to extrude.
  • from_surfaces - The surfaces to extrude from.
  • to_surfaces - The surfaces to extrude to.
  • layers - The layers of the extrusion.
  • quadrangles - Whether to use quadrangles for the extrusion.

FlattenAndRebuildExtrusion Objects

class FlattenAndRebuildExtrusion()

A flatten and rebuild extrusion for a mesh.

Arguments:

  • volumes - The volumes to extrude.
  • layers - The layers of the extrusion.
  • quadrangles - Whether to use quadrangles for the extrusion.
  • direction_vector - The direction vector for the extrusion.

MeshExtrusion Objects

class MeshExtrusion()

A simple extrusion for a mesh.

Arguments:

  • regions - The regions to extrude.
  • sub_layer_counts - The number of sublayers for each layer.
  • extrusion_overlap_mode - The overlap mode for the extrusion.
  • type - The type of extrusion.

MeshQuality Objects

class MeshQuality(Enum)

Enum for the quality of a mesh.

MeshSettings Objects

class MeshSettings()

Container for settings that can be configured when creating a mesh.

Mesh Objects

class Mesh()

Mesh of a project geometry.

create

@classmethod
def create(cls,
project_id: str,
mesh_settings: MeshSettings | None = None) -> Self

Create a new mesh in the project.

Arguments:

  • project_id - The ID of the project to create the mesh in.
  • mesh_settings - Optional settings for the mesh.

Returns:

The created mesh.

get

@classmethod
def get(cls, mesh_id: str, project_id: str | None = None) -> Self

Get a mesh by its ID.

Arguments:

  • mesh_id - The ID of the mesh.
  • project_id - The ID of the project. Can be omitted if project API key is used.

Returns:

The mesh.

get_all

@classmethod
def get_all(cls, project_id: str | None = None) -> List[Self]

Get all meshes in the project.

Arguments:

  • project_id - The ID of the project. Can be omitted if project API key is used.

Returns:

A list of Mesh objects.

id

@property
@prevent_deleted
def id() -> str

Get the ID of the mesh.

name

@property
@prevent_deleted
def name() -> str

Get the name of the mesh.

name

@name.setter
@prevent_deleted
def name(name: str) -> None

Set the name of the mesh. Use save() to commit the change.

quality

@property
@prevent_deleted
def quality() -> MeshQuality

Get the quality of the mesh.

quality

@quality.setter
@prevent_deleted
def quality(quality: MeshQuality) -> None

Set the quality of the mesh. Use save() to commit the change.

node_type

@property
@prevent_deleted
def node_type() -> str | None

Get the node type of the mesh.

node_type

@node_type.setter
@prevent_deleted
def node_type(node_type: str) -> None

Set the node type of the mesh. Use save() to commit the change.

max_run_time_minutes

@property
@prevent_deleted
def max_run_time_minutes() -> int

Get the maximum run time of the mesh.

max_run_time_minutes

@max_run_time_minutes.setter
@prevent_deleted
def max_run_time_minutes(max_run_time_minutes: int) -> None

Set the maximum run time of the mesh. Use save() to commit the change.

use_mesh_refiner

@property
@prevent_deleted
def use_mesh_refiner() -> bool

Get whether the mesh uses the mesh refiner.

use_mesh_refiner

@use_mesh_refiner.setter
@prevent_deleted
def use_mesh_refiner(use_mesh_refiner: bool) -> None

Set whether the mesh uses the mesh refiner. Use save() to commit the change.

mesh_size_min

@property
@prevent_deleted
def mesh_size_min() -> float | None

Get the minimum mesh size of the mesh.

mesh_size_min

@mesh_size_min.setter
@prevent_deleted
def mesh_size_min(mesh_size_min: float) -> None

Set the minimum mesh size of the mesh. Use save() to commit the change.

mesh_size_max

@property
@prevent_deleted
def mesh_size_max() -> float | None

Get the maximum mesh size of the mesh.

mesh_size_max

@mesh_size_max.setter
@prevent_deleted
def mesh_size_max(mesh_size_max: float) -> None

Set the maximum mesh size of the mesh. Use save() to commit the change.

scale_factor

@property
@prevent_deleted
def scale_factor() -> float | None

Get the scale factor of the mesh.

scale_factor

@scale_factor.setter
@prevent_deleted
def scale_factor(scale_factor: float) -> None

Set the scale factor of the mesh. Use save() to commit the change.

curvature_enhancement

@property
@prevent_deleted
def curvature_enhancement() -> float | None

Get the curvature enhancement of the mesh.

curvature_enhancement

@curvature_enhancement.setter
@prevent_deleted
def curvature_enhancement(curvature_enhancement: float) -> None

Set the curvature enhancement of the mesh. Use save() to commit the change.

curved_mesh

@property
@prevent_deleted
def curved_mesh() -> bool

Get whether the mesh is curved.

curved_mesh

@curved_mesh.setter
@prevent_deleted
def curved_mesh(curved_mesh: bool) -> None

Set whether the mesh is curved. Use save() to commit the change.

target_width_to_height_ratio

@property
@prevent_deleted
def target_width_to_height_ratio() -> float | None

Get the target width to height ratio of the mesh.

target_width_to_height_ratio

@target_width_to_height_ratio.setter
@prevent_deleted
def target_width_to_height_ratio(target_width_to_height_ratio: float) -> None

Set the target width to height ratio of the mesh. Use save() to commit the change.

refinements

@property
@prevent_deleted
def refinements() -> List[MeshRefinement] | None

Get the refinements of the mesh.

refinements

@refinements.setter
@prevent_deleted
def refinements(refinements: List[MeshRefinement]) -> None

Set the refinements of the mesh. Use save() to commit the change.

extrusion

@property
@prevent_deleted
def extrusion() -> MeshExtrusion | None

Get the extrusion of the mesh.

extrusion

@extrusion.setter
@prevent_deleted
def extrusion(extrusion: MeshExtrusion) -> None

Set the extrusion of the mesh. Use save() to commit the change.

slanted_extrusions

@property
@prevent_deleted
def slanted_extrusions() -> List[SlantedExtrusion] | None

Get the extrusions of the mesh.

set_slanted_extrusions

@slanted_extrusions.setter
@prevent_deleted
def set_slanted_extrusions(
slanted_extrusions: List[SlantedExtrusion] | None) -> None

Set the slanted extrusions of the mesh. Use save() to commit the change.

path_extrusions

@property
@prevent_deleted
def path_extrusions() -> List[PathExtrusion] | None

Get the path extrusions of the mesh.

set_path_extrusions

@path_extrusions.setter
@prevent_deleted
def set_path_extrusions(path_extrusions: List[PathExtrusion] | None) -> None

Set the path extrusions of the mesh. Use save() to commit the change.

flatten_and_rebuild_extrusions

@property
@prevent_deleted
def flatten_and_rebuild_extrusions(
) -> List[FlattenAndRebuildExtrusion] | None

Get the flatten and rebuild extrusions of the mesh.

set_flatten_and_rebuild_extrusions

@flatten_and_rebuild_extrusions.setter
@prevent_deleted
def set_flatten_and_rebuild_extrusions(
flatten_and_rebuild_extrusions: List[FlattenAndRebuildExtrusion] | None
) -> None

Set the flatten and rebuild extrusions of the mesh. Use save() to commit the change.

variable_overrides

@property
@prevent_deleted
def variable_overrides() -> List[VariableOverrides] | None

Get the variable overrides of the mesh.

variable_overrides

@variable_overrides.setter
@prevent_deleted
def variable_overrides(
variable_overrides: List[VariableOverrides] | None) -> None

Set the variable overrides of the mesh. Use save() to commit the change.

save

@prevent_deleted
def save() -> None

Explicitly save the changes to the cloud made by setting properties name, quality, node_type, max_run_time_minutes, mesh_size_min, mesh_size_max, scale_factor, curvature_enhancement, curved_mesh, refinements and variable_overrides.

start

@prevent_deleted
def start(variable_overrides_id: str | None = None) -> None

Start processing the mesh.

Arguments:

  • variable_overrides_id - Optional VariableOverrides id to use for the mesh.

run

@prevent_deleted
def run(variable_overrides_id: str | None = None,
print_logs: bool = False,
refresh_delay_s: float = 1) -> None

Process the mesh and returns when the processing is complete.

Arguments:

  • variable_overrides_id - Optional VariableOverrides id to use for the mesh.
  • print_logs - If True, print logs to the console.
  • refresh_delay_s - Optional delay in seconds between checking the status of the job.

abort

@prevent_deleted
def abort() -> None

Abort the processing of the mesh.

get_status

@prevent_deleted
def get_status() -> str | None

Get the status of the processing of the mesh.

Returns:

The status of the processing of the mesh.

is_running

@prevent_deleted
def is_running(refresh_delay_s: float | None = None) -> bool

Check if the processing of the mesh is running.

Arguments:

  • refresh_delay_s - Optional delay in seconds between checking the status of the job.

Returns:

True if the processing of the mesh is running, False otherwise.

refresh_status

@prevent_deleted
def refresh_status(delay_s: float = 1) -> str | None

Refresh the status of the processing of the mesh.

Arguments:

  • delay_s - Optional delay in seconds between checking the status of the job.

Returns:

The status of the processing of the mesh.

get_logs

@prevent_deleted
def get_logs(limit: int = 100) -> List[str]

Get the logs of the processing of the mesh.

Arguments:

  • limit - Optional maximum number of logs to return.

Returns:

The logs of the processing of the mesh.

@prevent_deleted
def print_new_loglines(file: TextIO = sys.stdout, limit: int = 100) -> None

Print the new log lines of the processing of the mesh.

Arguments:

  • file - Optional file to print the logs to.
  • limit - Optional maximum number of logs to print.

delete

@prevent_deleted
def delete() -> None

Delete the mesh from the project.

copy

@prevent_deleted
def copy(name: str | None = None) -> Self

Copy the mesh.

Arguments:

  • name - Optional name of the new mesh.

Returns:

The copied mesh.

save_mesh_file

@prevent_deleted
def save_mesh_file(output_dir: str = "./",
filename: str = "mesh.msh",
variable_overrides_id: str | None = None) -> None

Save the mesh file to a file on local file system.

By default, the mesh file is saved to the current working directory as mesh.msh.

Arguments:

  • output_dir - The optional directory to save the mesh file to.
  • filename - The optional filename to save the mesh file to.
  • variable_overrides_id - The optional variable overrides id to use for the mesh.

allsolve.api

is_setup

def is_setup() -> bool

Check if the Allsolve API client has been initialized.

setup

def setup(api_key: str, api_secret: str, host="http://localhost:3001")

Initialize the Allsolve API client and perform authentication.

Arguments:

  • api_key - The API key.
  • api_secret - The API secret.
  • host - The host to use.

Raises:

Can raise exception if the authentication request to the Allsolve API fails.

allsolve.file

delete_file

def delete_file(handle: rawapi.InputFile,
project_id: str | None = None) -> None

Delete a file from the project.

Arguments:

  • handle - The handle of the file to delete.
  • project_id - The project ID. Can be omitted when using a project API key.

allsolve.geometry

GDSUnit Objects

class GDSUnit()

GDSUnit describes a unit in GDS2 file.

value

@property
def value() -> str | None

Get the value of the GDS unit.

value

@value.setter
def value(value: str | None) -> None

Set the value of the GDS unit.

GDSAbsoluteLayer Objects

class GDSAbsoluteLayer()

GDSAbsoluteLayer describes a layer in GDS2 file with thickness and absolute z0.

name

@property
def name() -> str

Get the name of the layer.

name

@name.setter
def name(value: str) -> None

Set the name of the layer.

absolute_z0

@property
def absolute_z0() -> GDSUnit

Get the absolute z0 of the layer.

absolute_z0

@absolute_z0.setter
def absolute_z0(value: GDSUnit) -> None

Set the absolute z0 of the layer.

disabled

@property
def disabled() -> bool

Get the disabled state of the layer.

disabled

@disabled.setter
def disabled(value: bool) -> None

Set the disabled state of the layer.

GDSStackedLayer Objects

class GDSStackedLayer()

GDSStackedLayer describes a layer in GDS2 file with thickness. Z0 is calculated from previous layers.

name

@property
def name() -> str

Get the name of the layer.

name

@name.setter
def name(value: str) -> None

Set the name of the layer.

thickness

@property
def thickness() -> GDSUnit

Get the thickness of the layer.

thickness

@thickness.setter
def thickness(value: GDSUnit) -> None

Set the thickness of the layer.

disabled

@property
def disabled() -> bool

Get the disabled state of the layer.

disabled

@disabled.setter
def disabled(value: bool) -> None

Set the disabled state of the layer.

GDS2ImportConfig Objects

class GDS2ImportConfig()

GDS2ImportConfig holds parameters for importing a geometry from a GDS2 file. Configuration requires an unit and layers defined in absolute or/and stacked order. Each layer should have thickness and a name as defined in the GDS2 file. Absolute layers should have also absolute z0.

unit

@property
def unit() -> GeometryUnit

Get the unit of the GDSImportConfig.

GeometryElement Objects

class GeometryElement()

GeometryElement is a base class for importing a geometry to a project.

ImportGeometry Objects

class ImportGeometry()

ImportGeometry is a base class for importing a geometry to a project from a file.

ImportStep Objects

class ImportStep(ImportGeometry)

ImportStep is a class for importing a STEP file to a project.

ImportIges Objects

class ImportIges(ImportGeometry)

ImportIges is a class for importing an IGES file to a project.

ImportBrep Objects

class ImportBrep(ImportGeometry)

ImportBrep is a class for importing a BREP file to a project.

ImportSat Objects

class ImportSat(ImportGeometry)

ImportSat is a class for importing a SAT file to a project.

ImportMsh Objects

class ImportMsh(ImportGeometry)

ImportMsh is a class for importing a MSH file to a project.

ImportNas Objects

class ImportNas(ImportGeometry)

ImportNas is a class for importing a NAS file to a project.

ImportGds2 Objects

class ImportGds2(ImportGeometry)

ImportGds2 is a class for importing a GDS2 file to a project.

Geometry Objects

class Geometry()

Geometry for a project.

create

@classmethod
def create(cls, geometry_imports: List[GeometryElement.ImportGeometry],
project_id: str) -> Self

Create a new geometry element in the given project. Uploads the geometry file to the project.

Arguments:

  • geometry_imports - A list of geometry import objects. Currently only one geometry import per project is supported.
  • project_id - The id of the project where the new geometry element should be created.

Returns:

The created geometry element.

get

@classmethod
def get(cls, project_id: str) -> List[Self]

Get list of Geometry objects in the given project. Currently only one Geometry per project is supported.

Arguments:

  • project_id - The ID of the project. Can be omitted if project API key is used.

Returns:

A list of Geometry objects.

delete_geometry

@classmethod
def delete_geometry(cls: type[Self], project_id: str) -> None

Delete the geometry from the project.

id

@property
@prevent_deleted
def id() -> str

Get the ID of the geometry element.

name

@property
@prevent_deleted
def name() -> str

Get the name of the geometry element.

file_uploaded_at

@property
@prevent_deleted
def file_uploaded_at() -> datetime | None

Get the time the geometry file was uploaded.

start

@prevent_deleted
def start() -> None

Start processing the imported geometry file.

run

@prevent_deleted
def run(print_logs: bool = False, refresh_delay_s: float = 1) -> None

Processes the imported geometry file and returns when the processing is complete.

Arguments:

  • print_logs - If True, print logs to the console.
  • refresh_delay_s - Optional delay in seconds between checking the status of the job.

abort

@prevent_deleted
def abort() -> None

Abort the processing of the geometry file.

get_status

@prevent_deleted
def get_status() -> str | None

Get the status of the processing of the geometry file.

Returns:

The status of the processing of the geometry file.

is_running

@prevent_deleted
def is_running(refresh_delay_s: float | None = None) -> bool

Check if the processing of the geometry file is running.

Arguments:

  • refresh_delay_s - Optional delay in seconds between checking the status of the job.

Returns:

True if the processing of the geometry file is running, False otherwise.

refresh_status

@prevent_deleted
def refresh_status(delay_s: float = 1) -> str | None

Refresh the status of the processing of the geometry file.

Arguments:

  • delay_s - Optional delay in seconds between checking the status of the job.

Returns:

The status of the processing of the geometry file.

get_logs

@prevent_deleted
def get_logs(limit: int = 100) -> List[str]

Get the logs of the processing of the imported geometry file.

Arguments:

  • limit - Optional maximum number of logs to return.

Returns:

A list of log messages.

@prevent_deleted
def print_new_loglines(file: TextIO = sys.stdout, limit: int = 100) -> None

Print the new log lines of the processing of the imported geometry file.

Arguments:

  • file - Optional file to print the logs to.
  • limit - Optional maximum number of logs to print.

delete

@prevent_deleted
def delete() -> None

Delete the geometry from the project.

allsolve.expression

SharedExpression Objects

class SharedExpression()

SharedExpression is for managing shared expressions.

The “Shared” means that they are stored in the system so that they can referred to in other places using their identifier.

create

@classmethod
def create(cls,
name: str,
expression_type: ExpressionType = ExpressionType.EXPRESSION,
description: str = "",
expression: Optional[str | float | int] = None,
args: Optional[List[ExpressionArg]
| List[rawapi.SharedExpressionArg]] = None,
values: Optional[List[Union[float, int]]] = None,
project_id: str | None = None) -> Self

Create a new shared expression.

get

@classmethod
def get(cls, expr_id: str, project_id: str | None = None) -> Self

Get a shared expression by its ID.

get_all

@classmethod
def get_all(cls, project_id: str | None = None) -> List[Self]

Get all shared expressions in a project.

id

@property
@prevent_deleted
def id() -> str

Get the ID of the shared expression.

name

@property
@prevent_deleted
def name() -> str

Get the name of the shared expression.

name

@name.setter
@prevent_deleted
def name(name: str) -> None

Set the name of the shared expression. Use save() to commit the change.

description

@property
@prevent_deleted
def description() -> str

Get the description of the shared expression.

description

@description.setter
@prevent_deleted
def description(description: str) -> None

Set the description of the shared expression. Use save() to commit the change.

type

@property
@prevent_deleted
def type() -> rawapi.SharedExpressionType

Get the type of the shared expression.

type

@type.setter
@prevent_deleted
def type(expression_type: rawapi.SharedExpressionType) -> None

Set the type of the shared expression. Use save() to commit the change.

origin

@property
@prevent_deleted
def origin() -> Optional[str]

Get the origin (original shared expression ID if this is a copy).

origin

@origin.setter
@prevent_deleted
def origin(origin: Optional[str]) -> None

Set the origin of the shared expression. Use save() to commit the change.

args

@property
@prevent_deleted
def args() -> Optional[List[rawapi.SharedExpressionArg]]

Get the arguments of the shared expression.

args

@args.setter
@prevent_deleted
def args(args: Optional[List[rawapi.SharedExpressionArg]]) -> None

Set the arguments of the shared expression. Use save() to commit the change.

expression

@property
@prevent_deleted
def expression() -> Optional[str]

Get the expression string.

expression

@expression.setter
@prevent_deleted
def expression(expression: Optional[str]) -> None

Set the expression string. Use save() to commit the change.

values

@property
@prevent_deleted
def values() -> Optional[List[Union[float, int]]]

Get the values of the shared expression.

values

@values.setter
@prevent_deleted
def values(values: Optional[List[Union[float, int]]]) -> None

Set the values of the shared expression. Use save() to commit the change.

delete

@prevent_deleted
def delete() -> None

Delete the shared expression.

save

@prevent_deleted
def save() -> None

Explicitly save the changes to the cloud made by setting properties like name, description, type, expression, args, origin and values.

allsolve.project

ProjectType Objects

class ProjectType(Enum)

Enum for the type of project.

GeometryPipelineVersion Objects

class GeometryPipelineVersion(Enum)

Enum for the version of the geometry pipeline.

Project Objects

class Project()

A project in the AllSolve.

from_token

@classmethod
def from_token(cls) -> Self

Get the project associated with the project API key.

Returns:

The project associated with the project API key.

Raises:

  • NotProjectAPIKeyError - If not authenticated with a project API key.

get

@classmethod
def get(cls, project_id: str) -> Self

Get a project using the project ID.

Arguments:

  • project_id - The ID of the project to get.

Returns:

The project with the given ID.

get_all

@classmethod
def get_all(cls) -> List[Self]

Get all projects.

Returns:

A list of projects that the authentication has access to.

create

@classmethod
def create(
cls,
name: str,
description: str,
organization_write_access: bool | None = None,
labels: List[str] | None = None,
type: ProjectType = ProjectType.NORMAL,
geometry_pipeline_version: GeometryPipelineVersion = GeometryPipelineVersion
.V1
) -> Self

Create a new project.

Arguments:

  • name - The name of the project.
  • description - The description of the project.
  • organization_write_access - Optional boolean whether the organization has write access to the project.
  • labels - Optional list of labels for the project.
  • type - Optional ProjectType. Default is ProjectType.NORMAL. Use ProjectType.SCRIPT_ONLY for projects that do not have geometry.
  • geometry_pipeline_version - Optional GeometryPipelineVersion. Default is V1.

Returns:

The created project.

id

@property
@prevent_deleted
def id() -> str

Get the ID of the project.

name

@property
@prevent_deleted
def name() -> str

Get the name of the project.

name

@name.setter
@prevent_deleted
def name(name: str) -> None

Set the name of the project.

description

@property
@prevent_deleted
def description() -> str

Get the description of the project.

description

@description.setter
@prevent_deleted
def description(description: str) -> None

Set the description of the project.

readonly

@property
@prevent_deleted
def readonly() -> bool

Get whether the project is read-only.

labels

@property
@prevent_deleted
def labels() -> List[str]

Get the labels of the project.

script_only

@property
@prevent_deleted
def script_only() -> bool

Get whether the project is script-only.

geometry_pipeline_version

@property
@prevent_deleted
def geometry_pipeline_version() -> GeometryPipelineVersion

Get the geometry pipeline version of the project.

get_geometry

@prevent_deleted
def get_geometry() -> List[Geometry]

Get geometry elements in the project. Currently only one geometry element per project is supported.

Returns:

A list of geometry elements in the project.

import_step

@prevent_deleted
def import_step(filepath: str) -> Geometry

Import the geometry file in the given path to the project.

Arguments:

  • filepath - path to a file in the local system

Returns:

The created geometry.

import_iges

@prevent_deleted
def import_iges(filepath: str) -> Geometry

Import the geometry file in the given path to the project.

Arguments:

  • filepath - path to a file in the local system

Returns:

The created geometry.

import_brep

@prevent_deleted
def import_brep(filepath: str) -> Geometry

Import the geometry file in the given path to the project.

Arguments:

  • filepath - path to a file in the local system

Returns:

The created geometry.

import_sat

@prevent_deleted
def import_sat(filepath: str) -> Geometry

Import the geometry file in the given path to the project.

Arguments:

  • filepath - path to a file in the local system

Returns:

The created geometry.

import_msh

@prevent_deleted
def import_msh(filepath: str) -> Geometry

Import the geometry file in the given path to the project.

Arguments:

  • filepath - path to a file in the local system

Returns:

The created geometry.

import_nas

@prevent_deleted
def import_nas(filepath: str) -> Geometry

Import the geometry file in the given path to the project.

Arguments:

  • filepath - path to a file in the local system

Returns:

The created geometry.

import_gds2

@prevent_deleted
def import_gds2(filepath: str, config: GDS2ImportConfig) -> Geometry

Import the geometry file in the given path to the project.

Arguments:

  • filepath - path to a file in the local system
  • config - configuration for the GDS import.

Returns:

The created geometry.

add_shared_file

@prevent_deleted
def add_shared_file(filepath: str) -> rawapi.InputFile

Add the file in the given path to the project as shared file

Arguments:

  • filepath - path to a file in the local system. If used in a simulation, it is available with its basename.

Returns:

A handle to the created file.

add_shared_json_file

@prevent_deleted
def add_shared_json_file(name: str, content: dict) -> rawapi.InputFile

Add shared file to the project with the given dictionary serialized into JSON as content.

Arguments:

  • name - The name for the file during the simulation
  • content - The content of the file

Returns:

A handle to the created file.

get_files

@prevent_deleted
def get_files() -> List[rawapi.InputFile]

Get all files in the project.

Returns:

A list of files in the project.

get_meshes

@prevent_deleted
def get_meshes() -> List[Mesh]

Get all meshes in the project.

Returns:

A list of meshes in the project.

create_mesh

@prevent_deleted
def create_mesh(mesh_settings: MeshSettings) -> Mesh

Create a new mesh in the project.

Arguments:

  • mesh_settings - The settings for the mesh.

Returns:

The created mesh.

get_simulation

@prevent_deleted
def get_simulation(simulation_id: str) -> Simulation

Get a simulation using the simulation ID.

Arguments:

  • simulation_id - The ID of the simulation to get.

Returns:

The simulation with the given ID.

get_simulations

@prevent_deleted
def get_simulations() -> List[Simulation]

Get all simulations in the project.

Returns:

A list of simulations in the project.

copy_simulation

@prevent_deleted
def copy_simulation(simulation_id: str) -> Simulation

Create a copy of a simulation in the project.

Arguments:

  • simulation_id - The ID of the simulation to copy.

Returns:

The copied simulation.

get_regions

@prevent_deleted
def get_regions() -> List[Region]

Get all regions in the project.

Returns:

A list of regions in the project.

create_region_basic

@prevent_deleted
def create_region_basic(name: str, entity_type: rawapi.EntityType,
entity_tags: List[int]) -> Region

Create a basic region in the project.

Arguments:

  • name - The name of the region.
  • entity_type - The type of the entity.
  • entity_tags - The tags of the entity.

Returns:

The created region.

create_region_computed

@prevent_deleted
def create_region_computed(name: str, entity_type: rawapi.EntityType,
operation: RegionOperation,
source_region_ids: List[str]) -> ComputedRegion

Create a computed region in the project.

Arguments:

  • name - The name of the region.
  • entity_type - The type of the entity.
  • operation - The operation to perform on the source regions.
  • source_region_ids - The IDs of the source regions.

Returns:

The created computed region.

create_region_rule

@prevent_deleted
def create_region_rule(
name: str,
entity_type: rawapi.EntityType,
attribute_path: rawapi.AttributePath | None = None,
bounding_box: rawapi.ExpressionBoundingBox | None = None,
min_size: rawapi.ExpressionVector | None = None,
max_size: rawapi.ExpressionVector | None = None) -> Region

Create a region rule in the project.

Arguments:

  • name - The name of the region.
  • entity_type - The type of the entity.
  • attribute_path - The attribute path to use for the region.
  • bounding_box - The bounding box to use for the region.
  • min_size - The minimum size to use for the region.
  • max_size - The maximum size to use for the region.

Returns:

The created region rule.

create_variable

@prevent_deleted
def create_variable(name: str,
expression: str,
description: str = "") -> SharedExpression

Create an expression in the project.

create_function

@prevent_deleted
def create_function(name: str,
args: List[str],
expression: str,
description: str = "") -> SharedExpression

Create a function in the project.

create_interpolated_function

@prevent_deleted
def create_interpolated_function(name: str,
args: List[Tuple[str, List[float]]],
values: List[float],
description: str = "") -> SharedExpression

Create an interpolated function in the project.

Arguments:

  • name - The name of the interpolated function.
  • args - The arguments of the interpolated function.
  • values - The values of the interpolated function.

Returns:

The created interpolated function.

create_variable_overrides

@prevent_deleted
def create_variable_overrides(
name: str,
overrides: List[Tuple[SharedExpression,
str | float | int | List[str | float | int]]]
) -> VariableOverrides

Create a VariableOverrides in the project. It can be used to override a value of a single or multiple variables, or to create a sweep over variables.

Arguments:

  • name - The name of the set of variable overrides.
  • overrides - A list of variable overrides. The first element of the tuple is the variable to override and the second is the new value for the variable.

Returns:

The created variable overrides.

get_variable_overrides

@prevent_deleted
def get_variable_overrides() -> List[VariableOverrides]

Get all variable overrides in the project.

get_materials

@prevent_deleted
def get_materials() -> List[Material]

Get all materials in the project.

Returns:

A list of materials in the project.

save

@prevent_deleted
def save() -> None

Explictly save the changes to the cloud made by setting properties name and description.

delete

@prevent_deleted
def delete() -> None

Delete the project.

copy

@prevent_deleted
def copy(with_results: bool = False,
name: str | None = None,
wait_for_completion: bool = True) -> Self

Copies the project and returns the copied project.

Arguments:

  • with_results - If True then files of the original project are copied to the new project.
  • name - The name of the new project.
  • wait_for_completion - If True, the copied project is returned after the copy job is completed. If False, get_copy_job() should be used to check the status of the copy job.

Returns:

The copied project.

get_copy_job

@prevent_deleted
def get_copy_job() -> Job | None

Get the copy job for the project. The copy job exists only if the project was copied from another project with results.

Returns:

The copy job for the project.

allsolve.override

VariableOverrides Objects

class VariableOverrides()

VariableOverrides is for managing variable overrides. It can be used to override a value of a single or multiple variables in a project, or to create a sweep over variables.

create

@classmethod
def create(cls,
name: str,
overrides: List[Tuple[SharedExpression,
str | float | int | List[str | float | int]]],
override_type: rawapi.SharedExpressionOverrideType = rawapi.
SharedExpressionOverrideType.SWEEP,
project_id: str | None = None) -> Self

Create a new VariableOverrides.

Arguments:

  • name - The name of the set of variable overrides.
  • overrides - A list of overrides of the VariableOverrides. The first element of the tuple is the variable to override and the second is the new value for the variable.
  • override_type - The type of the VariableOverrides. Normal or Sweep.
  • project_id - The ID of the project.

Returns:

The created VariableOverrides.

get

@classmethod
def get(cls,
variable_overrides_id: str,
project_id: str | None = None) -> Self

Get a VariableOverrides by its ID.

get_all

@classmethod
def get_all(cls, project_id: str | None = None) -> List[Self]

Get all VariableOverrides in a project.

id

@property
@prevent_deleted
def id() -> str

Get the ID of the VariableOverrides.

name

@property
@prevent_deleted
def name() -> str

Get the name of the VariableOverrides.

name

@name.setter
@prevent_deleted
def name(name: str) -> None

Set the name of the VariableOverrides.

type

@property
@prevent_deleted
def type() -> rawapi.SharedExpressionOverrideType

Get the type of the VariableOverrides.

overrides

@property
@prevent_deleted
def overrides() -> List[Tuple[SharedExpression, str]]

Get the overrides of the VariableOverrides. The list is a copy of the overrides in the VariableOverrides. It the list is modified, use overrides setter to save the change. The list is a list of tuples, where the first element is the variable and the second is the new value for the variable.

overrides

@overrides.setter
@prevent_deleted
def overrides(
overrides: List[Tuple[SharedExpression,
str | float | int | List[str | float | int]]]
) -> None

Set the overrides of the VariableOverrides.

delete

@prevent_deleted
def delete() -> None

Delete the VariableOverrides.

allsolve.output_index