Skip to content

Allsolve SDK API Reference

Contains a PoC of a convenience import format parser.

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_project/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.

def parse_tuple(
value: dict | tuple | list | None,
expected_dimensions: int = 3) -> tuple[float | str, ...] | None

Parse a tuple value from YAML/JSON dictionary format. Accepts dictionary format with x, y, z keys (or x, y for 2D).

class MaterialProperty()

MaterialProperty is a base class for managing material properties.

class Material()

Material is a class for managing materials in a project.

@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,
orientation: str | Tuple[float | int, float | int, float | int]
| None = None,
enabled: str | None = None,
project_id: str | None = None) -> Self

Create a new material.

Arguments:

  • name - The name of the material.
  • color - The color of the material. Format: “#RRGGBB”
  • description - Optional description of the material.
  • properties - List of PhysicalProperty objects of the material.
  • target_region - The target Region of the material.
  • abbreviation - Optional abbreviation of the material.
  • orientation - Optional orientation of the material. Can be a tuple of 3 floats or a string like “[90; 0; 0]”
  • enabled - Optional enabled expression of the material. Can be a string expression like “eq(my_variable, 1)”
  • project_id - The ID of the project.

Returns:

The created Material.

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

Get a material by its ID.

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

Get all materials in a project.

@property
@prevent_deleted
def id() -> str

Get the ID of the material.

@property
@prevent_deleted
def name() -> str

Get the name of the material.

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

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

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

Get the description of the material.

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

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

@property
@prevent_deleted
def color() -> str

Get the color of the material.

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

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

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

Get the target of the material.

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

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

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

Get the properties of the material.

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

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

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

Get the abbreviation of the material.

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

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

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

Get the orientation of the material.

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

Set the orientation of the material. Can be a tuple of 3 floats or a string like “[90; 0; 0]” Use save() to commit the change.

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

Get the enabled status of the material.

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

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

@prevent_deleted
def delete() -> None

Delete the material.

@prevent_deleted
def save() -> None

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

Integer compression library for efficient storage of integer sequences.

Uses differential encoding combined with optional zstd compression or RLE.

class Scheme(IntEnum)

Compression scheme used for encoding.

Simple differential encoding

Differential + run-length encoding

Differential + zstd compression

def encode(ints: List[int],
zstd_compressor: Optional[zstd.ZstdCompressor] = None) -> bytes

Encode a list of integers using differential compression.

Automatically selects the best compression scheme:

  • DIFF for small arrays (≤4 elements)
  • DIFF_RLE for constant-difference sequences
  • DIFF_ZSTD for larger variable arrays

Arguments:

  • ints - List of integers to compress.
  • zstd_compressor - Optional pre-created zstd compressor for reuse. If None, a new one will be created when needed.

Returns:

Compressed bytes.

def decode(
encoded: bytes,
zstd_decompressor: Optional[zstd.ZstdDecompressor] = None
) -> List[int]

Decode compressed integer data.

Arguments:

  • encoded - Compressed bytes from encode().
  • zstd_decompressor - Optional pre-created zstd decompressor for reuse. If None, a new one will be created when needed.

Returns:

List of decoded integers.

class NotInitializedError(Exception)

Exception for when a class or data is not initialized.

class DeletedError(Exception)

Exception for when an object is deleted.

class NotProjectAPIKeyError(Exception)

Exception for when a project API key is not set.

def prevent_deleted(f)

Decorator to prevent access to methods/properties of deleted objects. Raises DeletedError if the object’s _deleted attribute is True.

class Job()

Job for a project.

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

@property
def id() -> str

Get the job ID

def get_status() -> str | None

Get the current status of the job.

Returns:

The status of the job.

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.

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.

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.
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.

class RegionOperation(Enum)

Enum for the RegionOperation.

class Region()

Region of a geometry.

@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.

@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.

@property
@prevent_deleted
def id() -> str

Get the ID of the region.

@property
@prevent_deleted
def name() -> str

Get the name of the region.

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

Get the entity tags of the region.

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

Get the entity type of the region.

@prevent_deleted
def delete() -> None

Delete the region.

class KeyValueAttributePath(rawapi.AttributePath)

KeyValueAttributePath.

class RegionRule(Region)

RegionRule.

@classmethod
def create(cls,
name: str,
entity_type: rawapi.EntityType,
attribute_path: rawapi.AttributePath | list[tuple[str, str]]
| 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. Can be a list of tuples (key, value).
  • Example - [(“LayerName”, “Polysilicon”)]
  • 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.

class ComputedRegion(Region)

ComputedRegion.

@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.

class CPU(Enum)

Enum for the type of CPU.

class Runtime()

Runtime for a simulation.

class Script()

Script for a simulation.

class SolverMode()

Solver mode for a simulation.

class Simulation(JobMixin)

Simulation of a project.

@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.

@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.

@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.

@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.

@property
@prevent_deleted
def id() -> str

Get the ID of the simulation.

@property
@prevent_deleted
def name() -> str

Get the name of the simulation.

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

Set the name of the simulation.

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

Get the description of the simulation.

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

Set the description of the simulation.

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

Get the ID of the mesh used in the simulation.

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

Set the ID of the mesh used in the simulation.

@property
@prevent_deleted
def max_run_time_minutes() -> int

Get the maximum run time of the simulation.

@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.

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

Get the solver mode of the simulation.

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

Set the solver mode of the simulation.

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

Get the number of nodes used in the simulation.

@property
@prevent_deleted
def node_type() -> CPU

Get the type of nodes used in the simulation.

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

Get the shared files used in the simulation.

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

Get the files used in the simulation.

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

Get the variable overrides of the simulation.

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

Set the variable overrides of the simulation.

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

Set the scripts used in the simulation.

@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.

@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.

@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.

@prevent_deleted
def get_status_reason() -> str | None

Get the status reason of the simulation.

Returns:

The status reason of the simulation.

@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.
@prevent_deleted
def set_runtime(runtime: Runtime) -> None

Set the runtime of the simulation.

@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.

@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
@prevent_deleted
def add_file(filepath: str) -> rawapi.InputFile

Add the file in the given path to the simulation as an input file.

Arguments:

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

Returns:

The file handle.

Raises:

  • FileExistsError - If a file with the same name already exists and is fully uploaded.
@prevent_deleted
def add_json_file(name: str, content: dict) -> rawapi.InputFile

Add a JSON file to the simulation 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 file handle.

Raises:

  • FileExistsError - If a file with the same name already exists and is fully uploaded.
@prevent_deleted
def start() -> None

Start the simulation.

@prevent_deleted
def abort() -> None

Abort the simulation.

@prevent_deleted
def get_output_csv(
delimiter=",",
refresh: bool = False,
csv_format: CsvExportFormat = CsvExportFormat.EXPLODED) -> 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.
  • csv_format - The format of the CSV file.

Returns:

String containing the output of the simulation in CSV format.

@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

@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.

@prevent_deleted
def clean_output_data_cache() -> None

Clean the output data cache for this simulation. This invalidates any existing SimulationOutputData objects for this simulation.

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

Save the output field of the simulation.

Arguments:

  • name - The name of the field to save.
  • output_dir - The directory to save the field to.
  • sweep_index - The optional index of the sweep.
  • step_index - The optional index of the step or None.
@prevent_deleted
def save_output_mesh(name: str,
output_dir: str = "./",
sweep_index: int = 0,
step_index: int | None = None) -> None

Save the output mesh of the simulation.

Arguments:

  • name - The name of the mesh to save.
  • output_dir - The directory to save the mesh to.
  • sweep_index - The optional index of the sweep.
  • step_index - The optional index of the step or None.
@prevent_deleted
def save_output_files(filenames: List[str],
output_dir: str = "./",
sweep_index: int = 0,
step_index: int | None = None) -> 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.
  • sweep_index - The optional index of the sweep.
  • step_index - The optional index of the step or None.
@prevent_deleted
def copy() -> Self

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

Returns:

The copied simulation.

@prevent_deleted
def delete() -> None

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

class InfoRow(_Row)

The root job id in case of sweep simulations.

class SimulationOutput()

Sweep step job id or the main job id in case of non-sweep simulations.

Sweep step index.

Sweep step overrides by variable name.

class SimulationStepRow(_Row)

The raw string representation of the step. This is needed to preserve the format used in the field output files.

The step as a float. None if no step was specified when the value was created in the simulation.

class FieldOutputDefinitionRow(_Row)

The type of the field.

The user specified name for the field output.

An optional specifier added by the user or by the code generator. For example, some field outputs produce both real and imaginary parts, even though the user has just specified a single output. In this case the name of both fields will be the user specified name, but the specifier will be "real" or "imaginary".

Users can also give any specifier they want in modified or custom scripts.

A format string to produce the file names of field outputs. The format string will have placeholders {step} and {rank}. To get the file name, use the raw string step SimulationStepRow._step to replace {step} and the rank integer to replace {rank}.

The prefix part of file_name_format. Only contains the name and optionally the specifier in a filename friendly format.

The ranks that produced this field output.

class ValueOutputDefinitionRow(_Row)

The user specified name for the value output.

An optional specifier added by the user or by the code generator. For example, some value outputs produce both real and imaginary parts, even though the user has just specified a single output. In this case the name of both values will be the user specified name, but the specifier will be "real" or "imaginary".

class BlobDatabase()

All the data of the blob database. To get the data of the blob with id blob_id, use db.data[db.offsets[blob_id - 1] : db.offsets[blob_id]])].

class SimulationOutputDatabase()
def get_value_data(value: ValueOutput) -> array.array[float]

Get data for a value output.

class CsvExportFormat(Enum)

The format of the CSV file. EXPLODED format outputs one row per value. Exploded format is slower with large datasets. NORMAL format outputs one row per step. When multiple values are present per step, the values are output as an array. Normal format is faster with large datasets.

Value identifier consists of the name and the specifier.

Value header or value id. Value header is the value name followed by the specifier in parentheses. If the specifier is None, the parentheses are not included.

class SimulationOutputData()
def refresh() -> None

Download the simulation output data. Data is stored in the cache directory.

def clean_cache() -> None

Clean the local output data cache directory for this simulation. To use output data again, you need to call refresh to download the data again.

def to_dict(sweep_index: int = 0) -> dict[str, dict[str, list[float]]]

Returns the value output data of a single sweep step as a dictionary.

def to_csv_stream(
delimiter=",",
stream: TextIO | None = None,
csv_format: CsvExportFormat = CsvExportFormat.EXPLODED
) -> StringIO | None

Write CSV data to a stream.

Arguments:

  • delimiter - The delimiter to use in the CSV output.
  • stream - Optional stream to write to.

Returns:

None if stream was provided, StringIO if no stream was provided.

Examples:

csv_stream = data.to_csv_stream()

with open(“output.csv”, “w”) as f: data.to_csv_stream(stream=f)

def get_value_headers() -> list[str]

Returns header strings of all value outputs. The header equals the name of the value output plus the specifier if it was provided. The specifier is included after the name in parentheses.

Examples:

  • Name “Resistance” and no specifier —> “Resistance”
  • Name “Impedance” and specifier “real” —> “Impedance (real)“
def get_value_ids() -> list[ValueId]

Returns the identifier tuples of all value outputs. An identifier tuple consists of the name and the specifier.

Examples:

  • Name “Resistance” and no specifier —> (“Resistance”, None)
  • Name “Impedance” and specifier “real” —> (“Impedance”, “real”)
def get_sweep_step_overrides() -> list[dict[str, list[float]]]

Returns the variable overrides for each sweep step. The returned list can be used to find the sweep index based on a variable’s value.

The following example finds the index of the sweep step where “my_variable” had the value 42:

overrides = data.get_sweep_step_overrides()
sweep_index = -1
for i, step_overrides in enumerate(overrides):
if step_overrides["my_variable"][0] == 42:
sweep_index = i
break

The found sweep index can then be passed into various methods of this class to get the data of that sweep step.

For simple key-value pairs, use the get_sweep_index method.

def get_sweep_index(variable_name: str, value: float | list[float]) -> int

Finds the sweep index based on a variable name and a value.

If multiple sweep steps have the same variable name and value, the first one found is returned.

Examples:

# Get the sweep index for the variable "my_variable" with the value 42
sweep_index = data.get_sweep_index("my_variable", 42)
# Get the sweep index for the variable "my_variable" with the value [1.0, 2.0]
sweep_index = data.get_sweep_index("my_variable", [1.0, 2.0])

If you meed more fine-grained control, use the get_sweep_step_overrides method.

def get_sweep_count() -> int

Returns the total number of sweep steps.

def get_step_count(sweep_index: int | None = None) -> int

Returns the total number of steps. This function returns the number of time steps in transient simulations and the number of eigenmodes in eigenvalue simulations. This is not to be confused with sweep steps. Each sweep step can have multiple steps.

If no value is passed in, the total number of steps is returned. Note that each sweep step can have different set of steps. All steps are not necessarily present in all sweep steps.

If a sweep index is passed in, the number of steps in that sweep step is returned.

def get_step_labels() -> list[str]

Returns the labels of all steps. A label is the string representation of a step. A step here means the time step in a transient simulation or the eigenmode index in an eigenvalue simulation. This is not to be confused with sweep steps. Each sweep step can have multiple steps.

The label can either be a stringified numeric value or the special string SimulationOutputData.NO_STEP. NO_STEP is used as the step label when data is saved without specifying a step.

def get_step_label(step_index: int) -> str

Returns the step_indexth value of the get_step_labels list.

def get_step_index(step_label: str | float | int | None) -> int

Finds the step index based on a label or a numeric value. A step here means the time step in a transient simulation or the eigenmode index in an eigenvalue simulation. This is not to be confused with sweep steps. Each sweep step can have multiple steps.

Examples:

# Get the step index for the step label "0.2"
step_index = data.get_step_index("0.2")
# Get the step index for the step whose numeric value is 1.0
step_index = data.get_step_index(1.0)
# Get the the step index for data that was saved without specifying a step
step_index = data.get_step_index(SimulationOutputData.NO_STEP)
  • NOTE - It’s always better find using a float value than the string string label. If you use the string representation of a float value, it needs to be exactly the same as the one stored in the database. There’s no guarantee that the string representation was produced using str(float_value).
def get_array_index_count_at(sweep_index: int, step_index: int,
value_header: ValueHeaderOrId) -> int

Equivalent to len(get_values_at(sweep_index, step_index, value_header)).

def get_value_at(sweep_index: int,
step_index: int,
value_header: ValueHeaderOrId,
array_index: int | None = None) -> float | None

Equivalent to get_values_at(sweep_index, step_index, value_header)[array_index].

def get_values_at(sweep_index: int, step_index: int,
value_header: ValueHeaderOrId) -> list[float] | None

Returns the value output data of the value identified by value_header at the given sweep index and step index. See the get_sweep_index and get_step_index methods for more information on how to determine the sweep index and step index.

The value_header can either be:

  • A string representing the value header. For example, “Impedance (real)” where “Impedance” is the name and “real” is the specifier. If there’s no specifier, the header is just the value output’s name, so in this case “Impedance”.

  • A tuple consisting of the name and the specifier. For example, (“Impedance”, “real”) where “Impedance” is the name and “real” is the specifier. If there’s no specifier, the tuple still needs to contain two elements: the name and None. For example (“Impedance”, None). But in case there’s no specifier, you can just pass in the name as a string since it matches the header format.

Examples:

sweep_index = data.get_sweep_index("my_variable", 42)
step_index = data.get_step_index(0.1)
# Get the resistance at the given sweep index and step index.
values = data.get_values_at(sweep_index, step_index, "Resistance")
# Get the real part of the impedance at the given sweep index and step index.
values = data.get_values_at(sweep_index, step_index, ("Impedance", "real"))
# Get the real part of the impedance using a header string
values = data.get_values_at(sweep_index, step_index, "Impedance (real)")
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.
class MeshRefinement()

A refinement for a mesh.

Arguments:

  • region - The region to refine.
  • max_size - The maximum size of the refinement.
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.
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.
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.
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.
class MeshDensity(Enum)

Enum for the density of a mesh.

class MeshQuality(Enum)

Enum for the quality of a mesh. @deprecated: Use MeshDensity instead.

class MeshSettings()

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

class Mesh(JobMixin)

Mesh of a project geometry.

@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.

@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.

@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.

@property
@prevent_deleted
def id() -> str

Get the ID of the mesh.

@property
@prevent_deleted
def name() -> str

Get the name of the mesh.

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

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

@property
@deprecated("Use density instead")
@prevent_deleted
def quality() -> MeshQuality

Get the quality of the mesh.

@quality.setter
@deprecated("Use density instead")
@prevent_deleted
def quality(quality: MeshQuality) -> None

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

@property
@prevent_deleted
def density() -> MeshDensity

Get the density of the mesh.

@density.setter
@prevent_deleted
def density(density: MeshDensity) -> None

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

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

Get the node type of the mesh.

@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.

@property
@prevent_deleted
def max_run_time_minutes() -> int

Get the maximum run time of the mesh.

@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.

@property
@prevent_deleted
def use_mesh_refiner() -> bool

Get whether the mesh uses the 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.

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

Get the minimum mesh size of the mesh.

@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.

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

Get the maximum mesh size of the mesh.

@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.

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

Get the scale factor of the mesh.

@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.

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

Get the curvature enhancement of the mesh.

@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.

@property
@prevent_deleted
def curved_mesh() -> bool

Get whether the mesh is curved.

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

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

@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.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.

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

Get the refinements of the mesh.

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

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

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

Get the extrusion of the mesh.

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

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

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

Get the extrusions of the mesh.

@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.

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

Get the path extrusions of the mesh.

@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.

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

Get the flatten and rebuild extrusions of the mesh.

@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.

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

Get the variable overrides of the mesh.

@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.

@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.

@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.
@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.
@prevent_deleted
def abort() -> None

Abort the processing of the mesh.

@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.

@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.

@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.

@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.
@prevent_deleted
def delete() -> None

Delete the mesh from the project.

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

Copy the mesh.

Arguments:

  • name - Optional name of the new mesh.

Returns:

The copied mesh.

@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.
def is_setup() -> bool

Check if the Allsolve API client has been initialized.

def get_cache_dir() -> str | None

Get the cache directory path. The cache directory is created in the cache_base_dir directory, which can be set in setup method.

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

Initialize the Allsolve API client and perform authentication.

Arguments:

  • api_key - The API key.
  • api_secret - The API secret.
  • host - The host to use.
  • cache_base_dir - Optional directory path for caching simulation data. If not provided, then cache directory will be created in the current working directory.

Raises:

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

def clean_cache() -> None

Delete the cache directory used by all Allsolve projects.

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.
class GDSUnit()

GDSUnit describes a unit in GDS2 file.

@property
def value() -> str | None

Get the value of the GDS unit.

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

Set the value of the GDS unit.

class GDSAbsoluteLayer()

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

@property
def name() -> str

Get the name of the layer.

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

Set the name of the layer.

@property
def absolute_z0() -> GDSUnit

Get the absolute z0 of the layer.

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

Set the absolute z0 of the layer.

@property
def disabled() -> bool

Get the disabled state of the layer.

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

Set the disabled state of the layer.

class GDSStackedLayer()

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

@property
def name() -> str

Get the name of the layer.

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

Set the name of the layer.

@property
def thickness() -> GDSUnit

Get the thickness of the layer.

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

Set the thickness of the layer.

@property
def disabled() -> bool

Get the disabled state of the layer.

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

Set the disabled state of the layer.

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.

@property
def unit() -> GeometryUnit

Get the unit of the GDSImportConfig.

class GeometryElement()

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

class ImportGeometry()

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

class ImportStep(ImportGeometry)

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

class ImportIges(ImportGeometry)

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

class ImportBrep(ImportGeometry)

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

class ImportSat(ImportGeometry)

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

class ImportMsh(ImportGeometry)

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

class ImportNas(ImportGeometry)

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

class ImportGds2(ImportGeometry)

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

class CadGeometryType(Enum)

Enum for CAD geometry element types.

class CadGeometryElement(abc.ABC)

CadGeometryElement is a base class for creating CAD geometry programmatically. Subclasses provide convenient ways to create specific geometry types like boxes, cylinders, etc.

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

Get the ID of the geometry element.

@property
@prevent_deleted
def project_id() -> str

Get the project ID of the geometry element.

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

Get the name of the geometry element.

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

Set the name of the geometry element.

@property
@prevent_deleted
def enabled() -> str | bool | None

Get the enabled state of the geometry element. Can be a boolean or a string expression.

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

Set the enabled state of the geometry element. Can be a boolean or a string expression.

@property
@abc.abstractmethod
def type() -> CadGeometryType

Get the type of the geometry element.

Returns:

The CadGeometryType enum value for this geometry element.

@prevent_deleted
def delete() -> None

Delete the geometry element from the project.

@prevent_deleted
def save() -> None

Save the changes to the geometry element. Calling save() on a geometry element that is not added to the project using GeometryBuilder will raise a ValueError.

class CadTranslate(CadGeometryElement)

CadTranslate represents a translate of a CAD geometry element.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

@property
@prevent_deleted
def entity_tags() -> list[int] | None

Get the entity tags of the translate.

@entity_tags.setter
@prevent_deleted
def entity_tags(entity_tags: list[int] | None) -> None

Set the entity tags of the translate.

@property
@prevent_deleted
def cad_names() -> list[str] | None

Get the CAD names of the union.

@cad_names.setter
@prevent_deleted
def cad_names(cad_names: list[str] | None) -> None

Set the CAD names of the translate.

@property
@prevent_deleted
def cad_paths() -> list[CadPath] | None

Get the CAD paths of the translate.

@cad_paths.setter
@prevent_deleted
def cad_paths(cad_paths: list[CadPath] | None) -> None

Set the CAD paths of the translate.

@property
@prevent_deleted
def translation() -> tuple[float | str, float | str, float | str] | None

Get the translation vector.

@translation.setter
@prevent_deleted
def translation(
translation: tuple[float | str, float | str, float | str]) -> None

Set the translation vector.

@property
@prevent_deleted
def copy_object() -> bool

Get the copy_object flag.

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

Set the copy_object flag.

@property
@prevent_deleted
def repeat() -> int | str | None

Get the repeat count.

@repeat.setter
@prevent_deleted
def repeat(repeat: int | str | None) -> None

Set the repeat count.

class CadRotate(CadGeometryElement)

CadRotate represents a rotation of a CAD geometry element.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

@property
@prevent_deleted
def entity_tags() -> list[int] | None

Get the entity tags of the rotate.

@entity_tags.setter
@prevent_deleted
def entity_tags(entity_tags: list[int] | None) -> None

Set the entity tags of the rotate.

@property
@prevent_deleted
def cad_names() -> list[str] | None

Get the CAD names of the rotate.

@cad_names.setter
@prevent_deleted
def cad_names(cad_names: list[str] | None) -> None

Set the CAD names of the rotate.

@property
@prevent_deleted
def cad_paths() -> list[CadPath] | None

Get the CAD paths of the rotate.

@cad_paths.setter
@prevent_deleted
def cad_paths(cad_paths: list[CadPath] | None) -> None

Set the CAD paths of the rotate.

@property
@prevent_deleted
def axis() -> tuple[float | str, float | str, float | str]

Get the rotation axis vector.

@axis.setter
@prevent_deleted
def axis(axis: tuple[float | str, float | str, float | str]) -> None

Set the rotation axis vector.

@property
@prevent_deleted
def center() -> tuple[float | str, float | str, float | str]

Get the center point for rotation.

@center.setter
@prevent_deleted
def center(center: tuple[float | str, float | str, float | str]) -> None

Set the center point for rotation.

@property
@prevent_deleted
def angle() -> float | str

Get the rotation angle.

@angle.setter
@prevent_deleted
def angle(angle: float | str) -> None

Set the rotation angle.

@property
@prevent_deleted
def copy_object() -> bool

Get the copy_object flag.

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

Set the copy_object flag.

@property
@prevent_deleted
def repeat() -> int | str | None

Get the repeat count.

@repeat.setter
@prevent_deleted
def repeat(repeat: int | str | None) -> None

Set the repeat count.

class CadGrid(CadGeometryElement)

CadGrid represents a grid pattern of CAD geometry elements.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

@property
@prevent_deleted
def entity_tags() -> list[int] | None

Get the entity tags of the grid.

@entity_tags.setter
@prevent_deleted
def entity_tags(entity_tags: list[int] | None) -> None

Set the entity tags of the grid.

@property
@prevent_deleted
def cad_names() -> list[str] | None

Get the CAD names of the grid.

@cad_names.setter
@prevent_deleted
def cad_names(cad_names: list[str] | None) -> None

Set the CAD names of the grid.

@property
@prevent_deleted
def cad_paths() -> list[CadPath] | None

Get the CAD paths of the grid.

@cad_paths.setter
@prevent_deleted
def cad_paths(cad_paths: list[CadPath] | None) -> None

Set the CAD paths of the grid.

@property
@prevent_deleted
def translation() -> tuple[float | str, float | str, float | str]

Get the translation vector for grid spacing.

@translation.setter
@prevent_deleted
def translation(
translation: tuple[float | str, float | str, float | str]) -> None

Set the translation vector for grid spacing.

@property
@prevent_deleted
def size() -> tuple[int | str, int | str, int | str]

Get the grid size as a tuple of 3 positive integers (x, y, z).

@size.setter
@prevent_deleted
def size(size: tuple[int | str, int | str, int | str]) -> None

Set the grid size as a tuple of 3 positive integers (x, y, z).

class CadRemove(CadGeometryElement)

CadRemove represents a removal of CAD geometry elements.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

@property
@prevent_deleted
def entity_tags() -> list[int] | None

Get the entity tags of the remove.

@entity_tags.setter
@prevent_deleted
def entity_tags(entity_tags: list[int] | None) -> None

Set the entity tags of the remove.

@property
@prevent_deleted
def cad_names() -> list[str] | None

Get the CAD names of the remove.

@cad_names.setter
@prevent_deleted
def cad_names(cad_names: list[str] | None) -> None

Set the CAD names of the remove.

@property
@prevent_deleted
def cad_paths() -> list[CadPath] | None

Get the CAD paths of the remove.

@cad_paths.setter
@prevent_deleted
def cad_paths(cad_paths: list[CadPath] | None) -> None

Set the CAD paths of the remove.

class CadUnion(CadGeometryElement)

CadUnion represents a union of two or more CAD geometry elements.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

@property
@prevent_deleted
def entity_tags() -> list[int] | None

Get the entity tags of the union.

@entity_tags.setter
@prevent_deleted
def entity_tags(entity_tags: list[int] | None) -> None

Set the entity tags of the union.

@property
@prevent_deleted
def cad_names() -> list[str] | None

Get the CAD names of the union.

@cad_names.setter
@prevent_deleted
def cad_names(cad_names: list[str] | None) -> None

Set the CAD names of the union.

@property
@prevent_deleted
def cad_paths() -> list[CadPath] | None

Get the CAD paths of the union.

@cad_paths.setter
@prevent_deleted
def cad_paths(cad_paths: list[CadPath] | None) -> None

Set the CAD paths of the union.

class CadDifference(_CadBinaryBooleanOperation)

CadDifference represents a difference of two or more CAD geometry elements.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

class CadIntersection(_CadBinaryBooleanOperation)

CadIntersectionOperation represents an intersection of two or more CAD geometry elements.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

class CadFragments(_CadBinaryBooleanOperation)

CadFragments represents a fragments operation of two or more CAD geometry elements.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

class CadFragmentAll(CadGeometryElement)

CadFragmentAll represents a fragment all operation that fragments all CAD geometry elements.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

Utility functions for converting between Python types and CAD geometry API types.

This module provides conversion functions for creating and extracting values from raw API CAD geometry objects.

def to_str_list(value: str | list[str] | None) -> list[str] | None

Python runtime allows for a single string to be passed as a list of strings. This function converts a single string to a list of strings.

def extract_entities_from_elements(
elements: list[rawapi.CadEntity]
) -> tuple[list[int], list[str], list[CadPath]]

Extract entity_tags, cad_names from rawapi CadEntity elements.

def validate_cad_path(cad_path: CadPath) -> None

Validate a CAD path.

def validate_entity_set(entity_tags: list[int] | None,
cad_names: list[str] | None,
cad_paths: list[CadPath] | None, set_name: str,
operation_name: str) -> None

Validate that at least one entity set is provided and non-empty.

def create_cad_entities_from_lists(
entity_tags: list[int] | None, cad_names: list[str] | None,
cad_paths: list[CadPath] | None) -> list[rawapi.CadEntity]

Create CadEntity list from entity_tags, cad_names, cad_paths.

def create_boolean(value: bool | str | None) -> rawapi.CadBoolean | None

Create a CadBoolean from a boolean or string expression.

def create_scalar(value: float | str) -> rawapi.CadScalar

Create a CadScalar from a numeric value or expression string.

def create_angular_unit(unit: str | None) -> rawapi.CadAngularUnit | None

Create a CadAngularUnit from a string. Allowed values are: degree, radian.

def create_distance_unit(unit: str | None) -> rawapi.CadDistanceUnit | None

Create a CadDistanceUnit from a string. Allowed values are: m, meter, mm, millimeter, um, micrometer, nm, nanometer, yard, foot, inch.

def create_distance(value: float | str | tuple[float | str, str],
default_unit: str | None = None) -> rawapi.CadDistance

Create a CadDistance from a value with optional unit.

def create_angle(value: float | str,
default_unit: str | None = "degree") -> rawapi.CadAngle

Create a CadAngle from a value with optional unit.

def create_vector(
coords: tuple[float | str, float | str,
float | str]) -> rawapi.CadVector

Create a CadVector from a tuple of coordinates.

def create_vector_2d(
coords: tuple[float | str, float | str]) -> rawapi.CadVector

Create a CadVector from a 2D tuple of coordinates (z will be 0).

def create_euler_angles(
angles: tuple[float | str, float | str,
float | str]) -> rawapi.CadEulerAngles

Create CadEulerAngles from a tuple of angles in degrees.

def from_boolean(boolean: rawapi.CadBoolean | None) -> bool | str | None

Convert a CadBoolean to a boolean or string expression.

def from_scalar(scalar: rawapi.CadScalar) -> float | str

Convert a CadScalar to a float or string.

Returns:

The numeric value if set, or the expression string if set.

Raises:

  • ValueError - If neither value nor expression is set.
def from_distance(distance: rawapi.CadDistance) -> float | str

Convert a CadDistance to a value or expression.

Note: Unit information is not preserved in the conversion.

Returns:

The numeric value if set, or the expression string if set.

Raises:

  • ValueError - If the distance value is not set.
def from_angle(angle: rawapi.CadAngle) -> float | str

Convert a CadAngle to a float or string.

Returns:

The numeric value if set, or the expression string if set.

Raises:

  • ValueError - If the angle value is not set.
def from_vector(
vector: rawapi.CadVector
) -> tuple[float | str, float | str, float | str]

Convert a CadVector to a tuple of coordinates.

Returns:

Tuple of (x, y, z) where each is float or str.

Raises:

  • ValueError - If any component is not set.
def from_vector_2d(
vector: rawapi.CadVector) -> tuple[float | str, float | str]

Convert a CadVector to a tuple of 2D coordinates.

def from_euler_angles(
angles: rawapi.CadEulerAngles | None
) -> tuple[float | str, float | str, float | str] | None

Convert CadEulerAngles to a tuple of angles.

Returns:

Tuple of (x, y, z) angles, or None if input is None.

Raises:

  • ValueError - If angles is not None but any component is not set.
class Geometry(JobMixin)

Geometry for a project.

@classmethod
@deprecated("Use geometry pipeline version V2 for new projects")
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.

@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.

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

Delete the geometry from the project.

@property
@prevent_deleted
def id() -> str

Get the ID of the geometry element.

@property
@prevent_deleted
def name() -> str

Get the name of the geometry element.

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

Get the time the geometry file was uploaded.

@deprecated("Use geometry pipeline version V2 for new projects")
@prevent_deleted
def start() -> None

Start processing the imported geometry file.

@deprecated("Use geometry pipeline version V2 for new projects")
@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.
@prevent_deleted
def abort() -> None

Abort the processing of the geometry file.

@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.

@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.

@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.

@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.
@prevent_deleted
def delete() -> None

Delete the geometry from the project.

class CadPoint()

CadPoint is a class for representing a CAD point.

@classmethod
def from_region(cls, region: Region) -> Self

Create a CadPoint from a Region. Region must contain exactly one point entity tag.

class CadBox(CadGeometryElement)

Box represents a rectangular box geometry.

@property
@prevent_deleted
def position() -> tuple[float | str, float | str, float | str]

Get the position of the box.

@position.setter
@prevent_deleted
def position(position: tuple[float | str, float | str, float | str]) -> None

Set the position of the box.

@property
@prevent_deleted
def size() -> tuple[float | str, float | str, float | str]

Get the size of the box.

@size.setter
@prevent_deleted
def size(size: tuple[float | str, float | str, float | str]) -> None

Set the size of the box.

@property
@prevent_deleted
def rotation() -> tuple[float | str, float | str, float | str] | None

Get the rotation of the box.

@rotation.setter
@prevent_deleted
def rotation(
rotation: tuple[float | str, float | str, float | str] | None) -> None

Set the rotation of the box.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

class CadCylinder(CadGeometryElement)

Cylinder represents a cylindrical geometry.

@property
@prevent_deleted
def position() -> tuple[float | str, float | str, float | str]

Get the position of the cylinder.

@position.setter
@prevent_deleted
def position(position: tuple[float | str, float | str, float | str]) -> None

Set the position of the cylinder.

@property
@prevent_deleted
def axis() -> tuple[float | str, float | str, float | str]

Get the axis of the cylinder.

@axis.setter
@prevent_deleted
def axis(axis: tuple[float | str, float | str, float | str]) -> None

Set the axis of the cylinder.

@property
@prevent_deleted
def radius() -> float | str

Get the radius of the cylinder.

@radius.setter
@prevent_deleted
def radius(radius: float | str) -> None

Set the radius of the cylinder.

@property
@prevent_deleted
def angle() -> float | str | None

Get the angle of the cylinder.

@angle.setter
@prevent_deleted
def angle(angle: float | str | None) -> None

Set the angle of the cylinder.

@property
@prevent_deleted
def rotation() -> tuple[float | str, float | str, float | str] | None

Get the rotation of the cylinder.

@rotation.setter
@prevent_deleted
def rotation(
rotation: tuple[float | str, float | str, float | str] | None) -> None

Set the rotation of the cylinder.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

class CadSphere(CadGeometryElement)

Sphere represents a spherical geometry.

@property
@prevent_deleted
def position() -> tuple[float | str, float | str, float | str]

Get the position of the sphere.

@position.setter
@prevent_deleted
def position(position: tuple[float | str, float | str, float | str]) -> None

Set the position of the sphere.

@property
@prevent_deleted
def radius() -> float | str

Get the radius of the sphere.

@radius.setter
@prevent_deleted
def radius(radius: float | str) -> None

Set the radius of the sphere.

@property
@prevent_deleted
def angle1() -> float | str | None

Get the first angle of the sphere.

@angle1.setter
@prevent_deleted
def angle1(angle1: float | str | None) -> None

Set the first angle of the sphere.

@property
@prevent_deleted
def angle2() -> float | str | None

Get the second angle of the sphere.

@angle2.setter
@prevent_deleted
def angle2(angle2: float | str | None) -> None

Set the second angle of the sphere.

@property
@prevent_deleted
def angle3() -> float | str | None

Get the third angle of the sphere.

@angle3.setter
@prevent_deleted
def angle3(angle3: float | str | None) -> None

Set the third angle of the sphere.

@property
@prevent_deleted
def rotation() -> tuple[float | str, float | str, float | str] | None

Get the rotation of the sphere.

@rotation.setter
@prevent_deleted
def rotation(
rotation: tuple[float | str, float | str, float | str] | None) -> None

Set the rotation of the sphere.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

class CadCone(CadGeometryElement)

Cone represents a conical geometry.

@property
@prevent_deleted
def position() -> tuple[float | str, float | str, float | str]

Get the position of the cone.

@position.setter
@prevent_deleted
def position(position: tuple[float | str, float | str, float | str]) -> None

Set the position of the cone.

@property
@prevent_deleted
def axis() -> tuple[float | str, float | str, float | str]

Get the axis of the cone.

@axis.setter
@prevent_deleted
def axis(axis: tuple[float | str, float | str, float | str]) -> None

Set the axis of the cone.

@property
@prevent_deleted
def radius1() -> float | str

Get the base radius of the cone.

@radius1.setter
@prevent_deleted
def radius1(radius1: float | str) -> None

Set the base radius of the cone.

@property
@prevent_deleted
def radius2() -> float | str

Get the top radius of the cone.

@radius2.setter
@prevent_deleted
def radius2(radius2: float | str) -> None

Set the top radius of the cone.

@property
@prevent_deleted
def angle() -> float | str | None

Get the angle of the cone.

@angle.setter
@prevent_deleted
def angle(angle: float | str | None) -> None

Set the angle of the cone.

@property
@prevent_deleted
def rotation() -> tuple[float | str, float | str, float | str] | None

Get the rotation of the cone.

@rotation.setter
@prevent_deleted
def rotation(
rotation: tuple[float | str, float | str, float | str] | None) -> None

Set the rotation of the cone.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

class CadTorus(CadGeometryElement)

Torus represents a toroidal geometry.

@property
@prevent_deleted
def position() -> tuple[float | str, float | str, float | str]

Get the position of the torus.

@position.setter
@prevent_deleted
def position(position: tuple[float | str, float | str, float | str]) -> None

Set the position of the torus.

@property
@prevent_deleted
def radius1() -> float | str

Get the outer radius of the torus.

@radius1.setter
@prevent_deleted
def radius1(radius1: float | str) -> None

Set the outer radius of the torus.

@property
@prevent_deleted
def radius2() -> float | str

Get the width of the torus ring.

@radius2.setter
@prevent_deleted
def radius2(radius2: float | str) -> None

Set the width of the torus ring.

@property
@prevent_deleted
def angle() -> float | str | None

Get the angle of the torus.

@angle.setter
@prevent_deleted
def angle(angle: float | str | None) -> None

Set the angle of the torus.

@property
@prevent_deleted
def rotation() -> tuple[float | str, float | str, float | str] | None

Get the rotation of the torus.

@rotation.setter
@prevent_deleted
def rotation(
rotation: tuple[float | str, float | str, float | str] | None) -> None

Set the rotation of the torus.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

class CadSurfaceRectangle(CadGeometryElement)

CadSurfaceRectangle represents a surface rectangle geometry.

@property
@prevent_deleted
def size() -> tuple[float | str, float | str]

Get the size of the surface rectangle.

@size.setter
@prevent_deleted
def size(size: tuple[float | str, float | str]) -> None

Set the size of the surface rectangle.

@property
@prevent_deleted
def offset() -> tuple[float | str, float | str, float | str]

Get the offset of the surface rectangle.

@offset.setter
@prevent_deleted
def offset(offset: tuple[float | str, float | str, float | str]) -> None

Set the offset of the surface rectangle.

@property
@prevent_deleted
def origin_point() -> CadPoint

Get the origin point CAD entity.

@origin_point.setter
@prevent_deleted
def origin_point(origin_point: CadPoint) -> None

Set the origin point CAD entity.

@property
@prevent_deleted
def main_axis_point() -> CadPoint

Get the main axis point CAD entity.

@main_axis_point.setter
@prevent_deleted
def main_axis_point(main_axis_point: CadPoint) -> None

Set the main axis point CAD entity.

@property
@prevent_deleted
def secondary_axis_point() -> CadPoint

Get the secondary axis point CAD entity.

@secondary_axis_point.setter
@prevent_deleted
def secondary_axis_point(secondary_axis_point: CadPoint) -> None

Set the secondary axis point CAD entity.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

class CadDisk(CadGeometryElement)

Disk represents a circular disk geometry.

@property
@prevent_deleted
def position() -> tuple[float | str, float | str]

Get the position of the disk.

@position.setter
@prevent_deleted
def position(position: tuple[float | str, float | str]) -> None

Set the position of the disk.

@property
@prevent_deleted
def radius() -> float | str

Get the radius of the disk.

@radius.setter
@prevent_deleted
def radius(radius: float | str) -> None

Set the radius of the disk.

@property
@prevent_deleted
def rotation() -> tuple[float | str, float | str, float | str] | None

Get the rotation of the disk.

@rotation.setter
@prevent_deleted
def rotation(
rotation: tuple[float | str, float | str, float | str] | None) -> None

Set the rotation of the disk.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

class CadRectangle(CadGeometryElement)

Rectangle represents a rectangular geometry.

@property
@prevent_deleted
def position() -> tuple[float | str, float | str]

Get the position of the rectangle.

@position.setter
@prevent_deleted
def position(position: tuple[float | str, float | str]) -> None

Set the position of the rectangle.

@property
@prevent_deleted
def size() -> tuple[float | str, float | str]

Get the size of the rectangle.

@size.setter
@prevent_deleted
def size(size: tuple[float | str, float | str]) -> None

Set the size of the rectangle.

@property
@prevent_deleted
def rotation() -> tuple[float | str, float | str, float | str] | None

Get the rotation of the rectangle.

@rotation.setter
@prevent_deleted
def rotation(
rotation: tuple[float | str, float | str, float | str] | None) -> None

Set the rotation of the rectangle.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

class CadGlob(Enum)

Wildcard patterns for CAD path matching.

Matches a single level in the CAD hierarchy.

Matches zero or more levels in the CAD hierarchy.

A path to select CAD entities in a hierarchical structure.

A CAD path is a list of segments, where each segment can be:

  • A string: Name of a geometry element at that level
  • A tuple of (key, value): Attribute filter matching entities with the given attribute
  • A CadGlob enum: Wildcard pattern for matching multiple entities

CAD paths are used in geometry operations (union, difference, intersection, translate, rotate, grid, remove, etc.) to select which entities to operate on.

class CadFileImport(CadGeometryElement)
@property
@prevent_deleted
def cleanup() -> bool

Get the cleanup setting.

class CadStepFile(CadFileImport)

CadStepFile represents a STEP file geometry import.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

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

Get the time the geometry file was uploaded.

class CadIgesFile(CadFileImport)

CadIgesFile represents an IGES file geometry import.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

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

Get the time the geometry file was uploaded.

class CadSatFile(CadFileImport)

CadSatFile represents a SAT (ACIS) file geometry import.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

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

Get the time the geometry file was uploaded.

class CadBrepFile(CadFileImport)

CadBrepFile represents a BREP (OpenCASCADE) file geometry import.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

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

Get the time the geometry file was uploaded.

class CadGds2File(CadFileImport)

CadGds2File represents a GDS2 file geometry import.

@property
@prevent_deleted
def type() -> CadGeometryType

Get the type of the geometry element.

@property
@prevent_deleted
def layers() -> List[CadGdsLayer]

Get the GDS2 import configuration.

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

Get the time the geometry file was uploaded.

class GeometryBuilder(JobMixin)

Geometry builder for a project. Use with projects that have the GeometryPipelineVersion.V2

def add(geometry: List[CadElement] | CadElement) -> Self

Creates new geometry elements in the project.

Arguments:

  • geometry - A list of CAD geometry elements or a single CAD geometry element.

Returns:

The GeometryBuilder object.

def add_box(name: str,
position: tuple[float | str, float | str, float | str],
size: tuple[float | str, float | str, float | str],
rotation: tuple[float | str, float | str, float | str]
| None = None,
enabled: str | bool | None = None) -> Self

Adds a box to the project.

Arguments:

  • name - Name for the geometry element.
  • position - The position of the box center as (x, y, z).
  • size - The size of the box as (width, height, depth).
  • rotation - Optional rotation as Euler angles (x, y, z) in degrees.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_cone(name: str,
position: tuple[float | str, float | str, float | str],
axis: tuple[float | str, float | str, float | str],
radius1: float | str,
radius2: float | str,
angle: float | str | None = None,
rotation: tuple[float | str, float | str, float | str]
| None = None,
enabled: str | bool | None = None) -> Self

Adds a cone to the project.

Arguments:

  • name - Name for the geometry element.
  • position - The position of the cone center as (x, y, z).
  • axis - The axis direction vector as (x, y, z).
  • radius1 - The base radius of the cone.
  • radius2 - The top radius of the cone (0 for pointy cone).
  • angle - Optional angle for partial cones (in degrees by default).
  • rotation - Optional rotation as Euler angles (x, y, z) in degrees.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_cylinder(name: str,
position: tuple[float | str, float | str, float | str],
axis: tuple[float | str, float | str, float | str],
radius: float | str,
angle: float | str | None = None,
rotation: tuple[float | str, float | str, float | str]
| None = None,
enabled: str | bool | None = None) -> Self

Adds a cylinder to the project.

Arguments:

  • name - Name for the geometry element.
  • position - The position of the cylinder center as (x, y, z).
  • axis - The axis direction vector as (x, y, z).
  • radius - The radius of the cylinder.
  • angle - Optional angle for partial cylinders (in degrees by default).
  • rotation - Optional rotation as Euler angles (x, y, z) in degrees.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_disk(name: str,
position: tuple[float | str, float | str],
radius: float | str,
rotation: tuple[float | str, float | str, float | str]
| None = None,
enabled: str | bool | None = None) -> Self

Adds a disk to the project.

Arguments:

  • name - Name for the geometry element.
  • position - The position of the disk center as (x, y).
  • radius - The radius of the disk.
  • rotation - Optional rotation as Euler angles (x, y, z) in degrees.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_rectangle(name: str,
position: tuple[float | str, float | str],
size: tuple[float | str, float | str],
rotation: tuple[float | str, float | str, float | str]
| None = None,
enabled: str | bool | None = None) -> Self

Adds a rectangle to the project.

Arguments:

  • name - Name for the geometry element.
  • position - The position of the rectangle center as (x, y).
  • size - The size of the rectangle as (width, height).
  • rotation - Optional rotation as Euler angles (x, y, z) in degrees.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_sphere(name: str,
position: tuple[float | str, float | str, float | str],
radius: float | str,
angle1: float | str | None = None,
angle2: float | str | None = None,
angle3: float | str | None = None,
rotation: tuple[float | str, float | str, float | str]
| None = None,
enabled: str | bool | None = None) -> Self

Adds a sphere to the project.

Arguments:

  • name - Name for the geometry element.
  • position - The position of the sphere center as (x, y, z).
  • radius - The radius of the sphere.
  • angle1 - Optional first angle for partial spheres (in degrees by default).
  • angle2 - Optional second angle for partial spheres (in degrees by default).
  • angle3 - Optional third angle for partial spheres (in degrees by default).
  • rotation - Optional rotation as Euler angles (x, y, z) in degrees.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_surface_rectangle(name: str,
size: tuple[float | str, float | str],
offset: tuple[float | str, float | str, float | str],
origin_point: CadPoint,
main_axis_point: CadPoint,
secondary_axis_point: CadPoint,
enabled: str | bool | None = None) -> Self

Adds a surface rectangle to the project.

Arguments:

  • name - Name for the geometry element.
  • size - The size of the rectangle as (x, y).
  • offset - The offset from the origin point as (x, y, z).
  • origin_point - CAD entity reference for the origin point.
  • main_axis_point - CAD entity reference for the main axis point.
  • secondary_axis_point - CAD entity reference for the secondary axis point.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_torus(name: str,
position: tuple[float | str, float | str, float | str],
radius1: float | str,
radius2: float | str,
angle: float | str | None = None,
rotation: tuple[float | str, float | str, float | str]
| None = None,
enabled: str | bool | None = None) -> Self

Adds a torus to the project.

Arguments:

  • name - Name for the geometry element.
  • position - The position of the torus center as (x, y, z).
  • radius1 - The outer radius of the torus.
  • radius2 - The width of the torus ring.
  • angle - Optional angle for partial toruses (in degrees by default).
  • rotation - Optional rotation as Euler angles (x, y, z) in degrees.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_difference(name: str,
entity_tags_1: list[int] | None = None,
cad_names_1: list[str] | None = None,
cad_paths_1: list[CadPath] | None = None,
entity_tags_2: list[int] | None = None,
cad_names_2: list[str] | None = None,
cad_paths_2: list[CadPath] | None = None,
delete_tool: bool = True,
enabled: str | bool | None = None) -> Self

Adds a difference operation to the project.

Arguments:

  • name - Name for the geometry element.
  • entity_tags_1 - The list of entity tags for the first set.
  • cad_names_1 - The list of CAD names for the first set.
  • cad_paths_1 - The list of CAD paths for the first set.
  • entity_tags_2 - The list of entity tags for the second set.
  • cad_names_2 - The list of CAD names for the second set.
  • cad_paths_2 - The list of CAD paths for the second set.
  • delete_tool - Boolean flag to delete the tool entities after the operation. Default is True.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_fragment_all(name: str, enabled: str | bool | None = None) -> Self

Adds a fragment all operation to the project.

Arguments:

  • name - Name for the geometry element.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_fragments(name: str,
entity_tags_1: list[int] | None = None,
cad_names_1: list[str] | None = None,
cad_paths_1: list[CadPath] | None = None,
entity_tags_2: list[int] | None = None,
cad_names_2: list[str] | None = None,
cad_paths_2: list[CadPath] | None = None,
delete_tool: bool = True,
enabled: str | bool | None = None) -> Self

Adds a fragments operation to the project.

Arguments:

  • name - Name for the geometry element.
  • entity_tags_1 - The list of entity tags for the first set.
  • cad_names_1 - The list of CAD names for the first set.
  • cad_paths_1 - The list of CAD paths for the first set.
  • entity_tags_2 - The list of entity tags for the second set.
  • cad_names_2 - The list of CAD names for the second set.
  • cad_paths_2 - The list of CAD paths for the second set.
  • delete_tool - Boolean flag to delete the tool entities after the operation. Default is True.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_intersection(name: str,
entity_tags_1: list[int] | None = None,
cad_names_1: list[str] | None = None,
cad_paths_1: list[CadPath] | None = None,
entity_tags_2: list[int] | None = None,
cad_names_2: list[str] | None = None,
cad_paths_2: list[CadPath] | None = None,
delete_tool: bool = True,
enabled: str | bool | None = None) -> Self

Adds an intersection operation to the project.

Arguments:

  • name - Name for the geometry element.
  • entity_tags_1 - The list of entity tags for the first set.
  • cad_names_1 - The list of CAD names for the first set.
  • cad_paths_1 - The list of CAD paths for the first set.
  • entity_tags_2 - The list of entity tags for the second set.
  • cad_names_2 - The list of CAD names for the second set.
  • cad_paths_2 - The list of CAD paths for the second set.
  • delete_tool - Boolean flag to delete the tool entities after the operation. Default is True.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_union(name: str,
entity_tags: list[int] | None = None,
cad_names: list[str] | None = None,
cad_paths: list[CadPath] | None = None,
enabled: str | bool | None = None) -> Self

Adds a union operation to the project.

Arguments:

  • name - Name for the geometry element.
  • entity_tags - The list of entity tags to union.
  • cad_names - The list of CAD names to union.
  • cad_paths - The list of CAD paths to union.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_grid(name: str,
translation: tuple[float | str, float | str, float | str],
size: tuple[int | str, int | str, int | str],
entity_tags: list[int] | None = None,
cad_names: list[str] | None = None,
cad_paths: list[CadPath] | None = None,
enabled: str | bool | None = None) -> Self

Adds a grid pattern to the project.

Arguments:

  • name - Name for the geometry element.
  • translation - The translation vector for grid spacing.
  • size - The grid size as a tuple of 3 positive integers (x, y, z).
  • entity_tags - The list of entity tags to create grid from.
  • cad_names - The list of CAD names to create grid from.
  • cad_paths - The list of CAD paths to create grid from.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_remove(name: str,
entity_tags: list[int] | None = None,
cad_names: list[str] | None = None,
cad_paths: list[CadPath] | None = None,
enabled: str | bool | None = None) -> Self

Adds a remove operation to the project.

Arguments:

  • name - Name for the geometry element.
  • entity_tags - The list of entity tags to remove.
  • cad_names - The list of CAD names to remove.
  • cad_paths - The list of CAD paths to remove.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_rotate(name: str,
axis: tuple[float | str, float | str, float | str],
center: tuple[float | str, float | str, float | str],
angle: float | str,
entity_tags: list[int] | None = None,
cad_names: list[str] | None = None,
cad_paths: list[CadPath] | None = None,
copy_object: bool = False,
repeat: int | str | None = None,
enabled: str | bool | None = None) -> Self

Adds a rotation operation to the project.

Arguments:

  • name - Name for the geometry element.
  • axis - The rotation axis vector.
  • center - The center point for rotation.
  • angle - The rotation angle.
  • entity_tags - The list of entity tags to rotate.
  • cad_names - The list of CAD names to rotate.
  • cad_paths - The list of CAD paths to rotate.
  • copy_object - Copy the object instead of rotating. Default is False.
  • repeat - Number of times to repeat the rotation. Default is None.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_translate(name: str,
translation: tuple[float | str, float | str, float | str],
entity_tags: list[int] | None = None,
cad_names: list[str] | None = None,
cad_paths: list[CadPath] | None = None,
copy_object: bool = False,
repeat: int | str | None = None,
enabled: str | bool | None = None) -> Self

Adds a translate operation to the project.

Arguments:

  • name - Name for the geometry element.
  • translation - The translation vector.
  • entity_tags - The list of entity tags to translate.
  • cad_names - The list of CAD names to translate.
  • cad_paths - The list of CAD paths to translate.
  • copy_object - Copy the object instead of translating. Default is False.
  • repeat - Number of times to repeat the translation. Default is None.
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_brep_file(filepath: str,
name: str | None = None,
cleanup: bool = True,
enabled: str | bool | None = None) -> Self

Adds a BREP file import to the project.

Arguments:

  • filepath - Path to a local BREP file. The file will be uploaded automatically.
  • name - Optional name for the geometry element.
  • cleanup - Whether to clean up the imported file (default: True).
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_gds2_file(filepath: str,
layers: (List[CadGdsLayer]
| List[Tuple[int, str | int | float,
str | int | float]]),
name: str | None = None,
cleanup: bool = True,
enabled: str | bool | None = None) -> Self

Adds a GDS2 file import to the project.

Arguments:

  • filepath - Path to a local GDS2 file. The file will be uploaded automatically.
  • layers - List of CadGdsLayers or tuples of (layer_id, absolute_z0, thickness).
  • name - Optional name for the geometry element.
  • cleanup - Whether to clean up the imported file (default: True).
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_iges_file(filepath: str,
name: str | None = None,
cleanup: bool = True,
enabled: str | bool | None = None) -> Self

Adds an IGES file import to the project.

Arguments:

  • filepath - Path to a local IGES file. The file will be uploaded automatically.
  • name - Optional name for the geometry element.
  • cleanup - Whether to clean up the imported file (default: True).
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_sat_file(filepath: str,
name: str | None = None,
cleanup: bool = True,
enabled: str | bool | None = None) -> Self

Adds a SAT file import to the project.

Arguments:

  • filepath - Path to a local SAT file. The file will be uploaded automatically.
  • name - Optional name for the geometry element.
  • cleanup - Whether to clean up the imported file (default: True).
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def add_step_file(filepath: str,
name: str | None = None,
cleanup: bool = True,
enabled: str | bool | None = None) -> Self

Adds a STEP file import to the project.

Arguments:

  • filepath - Path to a local STEP file. The file will be uploaded automatically.
  • name - Optional name for the geometry element.
  • cleanup - Whether to clean up the imported file (default: True).
  • enabled - Optional enabled state of the geometry element. Can be a boolean or a string expression. By default, the geometry element is enabled.

Returns:

The GeometryBuilder object.

def build(print_logs: bool = False,
refresh_delay_s: float = 1,
raise_on_error: bool = False) -> Self

Processes the geometry elements in the project 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.
  • raise_on_error - If True, raise an error if the building of the geometry fails. If False, you can use get_status() to check the status of the geometry processing job.

Returns:

The GeometryBuilder object.

def create_element(geometry: CadElement) -> CadElement

Creates new geometry elements in the project.

Arguments:

  • geometry - A list of CAD geometry elements or a single CAD geometry element.

Returns:

A list of created CAD geometry elements or a single created CAD geometry element.

def create_elements(geometries: List[CadElement]) -> List[CadElement]

Creates new geometry elements in the project.

Arguments:

  • geometry - A list of CAD geometry elements or a single CAD geometry element.

Returns:

A list of created CAD geometry elements or a single created CAD geometry element.

def get_elements() -> List[CadElement]

Gets the list of CAD geometry elements in the project.

Returns:

A list of CAD geometry elements.

def start(last_element_id: str | None = None) -> None

Starts processing the geometry elements in the project.

Arguments:

  • last_element_id - Optional last geometry element id to process in the project. If not provided, all geometry elements in the project will be processed.
def run(print_logs: bool = False,
refresh_delay_s: float = 1,
last_element_id: str | None = None) -> None

Processes the geometry elements in the project and returns when the processing is complete. Use get_status() to check the status of the processing after running.

Arguments:

  • print_logs - If True, print logs to the console.
  • refresh_delay_s - Optional delay in seconds between checking the status of the job.
  • last_element_id - Optional last geometry element id to process in the project. If not provided, all geometry elements in the project will be processed.
def abort() -> None

Aborts the processing of the geometry.

def get_status() -> str | None

Get the status of the processing of the geometry elements in the project.

Returns:

The status of the processing of the geometry elements in the project.

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

Check if the processing of the geometry elements in the project 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.

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

Refresh the status of the processing of the geometry elements in the project.

Arguments:

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

Returns:

The status of the processing of the geometry file.

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

Get the logs of the processing of the geometry elements in the project.

Arguments:

  • limit - Optional maximum number of logs to return.

Returns:

A list of log messages.

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

Print the new log lines of the processing of the geometry elements in the project.

Arguments:

  • file - Optional file to print the logs to.
  • limit - Optional maximum number of logs to print.
def delete(geometry: CadElement | None = None) -> None

Deletes a geometry element in the project, or all geometry elements if no geometry element is provided.

Arguments:

  • geometry - Optional geometry element to delete. If not provided, all geometry elements in the project will be deleted.

Variable-length integer encoding (varint) implementation.

Uses 7-bit groups with continuation bits, and zig-zag encoding for signed integers.

def encode_one(value: int) -> bytes

Encode a single unsigned integer using variable-length encoding.

Uses 7 bits for data and 1 bit (MSB) as continuation flag for bytes 1-8. The 9th byte (if needed) uses all 8 bits.

def encode_one_signed(value: int) -> bytes

Encode a single signed integer using zig-zag encoding followed by varint encoding.

Zig-zag encoding maps negative numbers to positive ones: 0 -> 0, -1 -> 1, 1 -> 2, -2 -> 3, 2 -> 4, …

def encode(values: List[int]) -> bytes

Encode multiple unsigned integers using variable-length encoding.

def encode_signed(values: List[int]) -> bytes

Encode multiple signed integers using zig-zag encoding followed by varint encoding.

Zig-zag encoding maps negative numbers to positive ones: 0 -> 0, -1 -> 1, 1 -> 2, -2 -> 3, 2 -> 4, …

def decode(buffer: bytes | bytearray | memoryview) -> List[int]

Decode all variable-length encoded unsigned integers from the buffer.

Returns a list of decoded values. Raises ValueError if the buffer is invalid.

def decode_signed(buffer: bytes | bytearray | memoryview) -> List[int]

Decode all zig-zag encoded signed integers from the buffer.

Returns a list of decoded values.

def decode_one(buffer: bytes | bytearray | memoryview) -> Tuple[int, int]

Decode a single variable-length encoded unsigned integer from the buffer.

Returns a tuple of (decoded_value, bytes_consumed). Raises ValueError if the buffer is invalid.

def decode_one_signed(
buffer: bytes | bytearray | memoryview) -> Tuple[int, int]

Decode a single zig-zag encoded signed integer from the buffer.

Returns a tuple of (decoded_value, bytes_consumed).

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.

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

Get a shared expression by its ID.

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

Get all shared expressions in a project.

@property
@prevent_deleted
def id() -> str

Get the ID of the shared expression.

@property
@prevent_deleted
def name() -> str

Get the name of the shared expression.

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

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

@property
@prevent_deleted
def description() -> str

Get the description of the shared expression.

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

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

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

Get the type of the shared expression.

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

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

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

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

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

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

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

Get the arguments of the shared expression.

@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.

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

Get the expression string.

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

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

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

Get the values of the shared expression.

@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.

@prevent_deleted
def delete() -> None

Delete the shared expression.

@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.

class Variable(SharedExpression)

A variable expression in the project. Variables are SharedExpressions with type EXPRESSION.

@classmethod
def create(cls,
name: str,
expression: str | float | int,
description: str = "",
project_id: str | None = None) -> Self

Create a variable in the project.

Arguments:

  • name - The name of the variable.
  • expression - The expression of the variable.
  • description - The description of the variable.
  • project_id - The ID of the project.

Returns:

The created variable.

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

Get all variables in a project.

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

Get a variable by its name. Returns None if no variable matches the given name.

Arguments:

  • name - The name of the variable.
  • project_id - The ID of the project.

Returns:

The variable that matches the given name.

class Function(SharedExpression)

A function expression in the project. Functions are SharedExpressions with type FUNCTION.

@classmethod
def create(cls,
name: str,
args: List[str],
expression: str,
description: str = "",
project_id: str | None = None) -> Self

Create a function in the project.

Arguments:

  • name - The name of the function.
  • args - The arguments of the function.
  • expression - The expression of the function.
  • description - The description of the function.
  • project_id - The ID of the project.

Returns:

The created function.

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

Get all functions in a project.

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

Get a function by its name. Returns None if no function matches the given name.

Arguments:

  • name - The name of the function.
  • project_id - The ID of the project.

Returns:

The function that matches the given name.

class InterpolatedFunction(SharedExpression)

An interpolated function expression in the project. Interpolated functions are SharedExpressions with type INTERPOLATED_FUNCTION.

@classmethod
def create(cls,
name: str,
args: List[Tuple[str, List[float]]],
values: List[float],
description: str = "",
project_id: str | None = None) -> Self

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.
  • description - The description of the interpolated function.
  • project_id - The ID of the project.

Returns:

The created interpolated function.

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

Get all interpolated functions in a project.

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

Get an interpolated function by its name. Returns None if no interpolated function matches the given name.

Arguments:

  • name - The name of the interpolated function.
  • project_id - The ID of the project.

Returns:

The interpolated function that matches the given name.

class JobMixin()

Mixin class that provides common job-related methods for classes that manage a Job instance.

Classes using this mixin should have a _job attribute of type Job | None. Subclasses can override _get_job() to customize job retrieval logic.

def abort() -> None

Abort the processing of the job.

def get_status() -> str | None

Get the status of the processing of the job.

Returns:

The status of the processing, or Job.NOT_STARTED if no job exists.

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

Check if the processing of the job is running.

Arguments:

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

Returns:

True if the processing is running, False otherwise.

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

Refresh the status of the processing of the job.

Arguments:

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

Returns:

The status of the processing, or Job.NOT_STARTED if no job exists.

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

Get the logs of the processing of the job.

Arguments:

  • limit - Optional maximum number of logs to return.

Returns:

A list of log messages, or an empty list if no job exists.

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

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

Arguments:

  • file - Optional file to print the logs to.
  • limit - Optional maximum number of logs to print.
class ProjectType(Enum)

Enum for the type of project.

class GeometryPipelineVersion(Enum)

Enum for the version of the geometry pipeline. For new projects, use V2 (default). V1 is deprecated.

class Project()

A project in the AllSolve.

@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.
@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.

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

Get all projects.

Returns:

A list of projects that the authentication has access to.

@classmethod
def get_all_by_name(cls, name: str) -> List[Self]

Get all projects that match the given name.

Arguments:

  • name - The name of the project to search for.

Returns:

A list of projects that match the given name.

@classmethod
def get_by_name(cls, name: str) -> Self | None

Get project that matches the given name. Returns None if no project matches the given name. Raises ValueError if multiple projects match the given name.

Arguments:

  • name - The name of the project to search for.

Returns:

The project that matches the given name.

@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.V2,
dimension: int = 3,
geometry_no_implicit_fragment: bool = False) -> 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 V2.
  • dimension - Optional dimension of the project. Default is 3.
  • geometry_no_implicit_fragment - Optional boolean whether to disable the automatic final Fragment All operation. Default is False. By default, the final Fragment All operation splits intersecting geometric entities into non-intersecting, disjoint parts. Setting parameter to True prevents automatic splitting, preserving the original geometric entities as-is.

Returns:

The created project.

@property
@prevent_deleted
def id() -> str

Get the ID of the project.

@property
@prevent_deleted
def name() -> str

Get the name of the project.

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

Set the name of the project.

@property
@prevent_deleted
def description() -> str

Get the description of the project.

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

Set the description of the project.

@property
@prevent_deleted
def readonly() -> bool

Get whether the project is read-only.

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

Get the labels of the project.

@property
@prevent_deleted
def script_only() -> bool

Get whether the project is script-only.

@property
@prevent_deleted
def geometry_pipeline_version() -> GeometryPipelineVersion

Get the geometry pipeline version of the project.

@property
@prevent_deleted
def dimension() -> int

Get the dimension of the project.

@property
@prevent_deleted
def geometry_no_implicit_fragment() -> bool

Get whether the project geometry has NO implicit Fragment all operation.

@prevent_deleted
def geometry_builder() -> GeometryBuilder

Get the geometry builder for the project. Use with GeometryPipelineVersion.V2

@prevent_deleted
@deprecated("Use geometry pipeline version V2 for new projects")
def get_geometry() -> List[Geometry]

Get geometry elements in the project. Currently only one geometry element per project is supported. Use with deprecated geometry pipeline version V1.

Returns:

A list of geometry elements in the project.

@prevent_deleted
def import_step(filepath: str,
name: str | None = None) -> Geometry | GeometryBuilder

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

Arguments:

  • filepath - path to a file in the local system
  • name - Optional name for the geometry element

Returns:

The GeometryBuilder if GeometryPipelineVersion.V2, or the created geometry for deprecated GeometryPipelineVersion.V1,

@prevent_deleted
def import_iges(filepath: str,
name: str | None = None) -> Geometry | GeometryBuilder

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

Arguments:

  • filepath - path to a file in the local system
  • name - Optional name for the geometry element

Returns:

The GeometryBuilder if GeometryPipelineVersion.V2, or the created geometry for deprecated GeometryPipelineVersion.V1,

@prevent_deleted
def import_brep(filepath: str,
name: str | None = None) -> Geometry | GeometryBuilder

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

Arguments:

  • filepath - path to a file in the local system
  • name - Optional name for the geometry element

Returns:

The GeometryBuilder if GeometryPipelineVersion.V2, or the created geometry for deprecated GeometryPipelineVersion.V1,

@prevent_deleted
def import_sat(filepath: str,
name: str | None = None) -> Geometry | GeometryBuilder

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

Arguments:

  • filepath - path to a file in the local system
  • name - Optional name for the geometry element

Returns:

The GeometryBuilder if GeometryPipelineVersion.V2, or the created geometry for deprecated GeometryPipelineVersion.V1,

@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.

@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.

@prevent_deleted
def import_gds2(filepath: str,
config: GDS2ImportConfig | None = None,
layers: (List[CadGdsLayer] | List[Tuple[int, str | int | float,
str | int | float]])
| None = None,
name: str | None = None) -> Geometry | GeometryBuilder

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

Arguments:

  • filepath - path to a file in the local system
  • config - Optional configuration for the GDS import. Use only for deprecated GeometryPipelineVersion.V1.
  • layers - Optional layers for the GDS import. Use only for GeometryPipelineVersion.V2.
  • name - Optional name for the geometry element

Returns:

The GeometryBuilder if GeometryPipelineVersion.V2, or the created geometry for deprecated GeometryPipelineVersion.V1,

@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.

Raises:

  • FileExistsError - If a file with the same name already exists and is fully uploaded.
@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.

Raises:

  • FileExistsError - If a file with the same name already exists and is fully uploaded.
@prevent_deleted
def get_files() -> List[rawapi.InputFile]

Get all files in the project.

Returns:

A list of files in the project.

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

Get all meshes in the project.

Returns:

A list of meshes in the project.

@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.

@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.

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

Get all simulations in the project.

Returns:

A list of simulations in the project.

@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.

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

Get all regions in the project.

Returns:

A list of regions in the project.

@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.

@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.

@prevent_deleted
def create_region_rule(
name: str,
entity_type: rawapi.EntityType,
attribute_path: rawapi.AttributePath | list[tuple[str, str]]
| 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. Can be a list of tuples (key, value).
  • Example - [(“LayerName”, “Polysilicon”)]
  • 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.

@prevent_deleted
def create_variable(name: str,
expression: str | float | int,
description: str = "") -> Variable

Create a variable in the project.

Arguments:

  • name - The name of the variable.
  • expression - The expression of the variable.
  • description - The description of the variable.

Returns:

The created variable.

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

Create a function in the project.

Arguments:

  • name - The name of the function.
  • args - The arguments of the function.
  • expression - The expression of the function.
  • description - The description of the function.

Returns:

The created function.

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

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.
  • description - The description of the interpolated function.

Returns:

The created interpolated function.

@prevent_deleted
def get_variables() -> List[Variable]

Get all variables in the project.

@prevent_deleted
def get_functions() -> List[Function]

Get all functions in the project.

@prevent_deleted
def get_interpolated_functions() -> List[InterpolatedFunction]

Get all interpolated functions in the project.

@prevent_deleted
def create_variable_overrides(
name: str,
overrides: List[Tuple[Variable | str,
str | float | int | List[str | float | int]]],
sweep_type: rawapi.SweepType | None = None) -> 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. The variable can be a Variable object or a string with the name of the variable. The second element is the new value for the variable. The value can be a string, float, int, or list of strings, floats, or ints.
  • sweep_type - The type of the sweep. Only valid for sweep overrides. If not provided, it will be set to SPECIFIC_VALUES.

Returns:

The created variable overrides.

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

Get all variable overrides in the project.

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

Get all materials in the project.

Returns:

A list of materials in the project.

@prevent_deleted
def create_material(
name: str,
description: str = "",
color: str = "#535050FF",
abbreviation: str | None = None,
target_region: Region | None = None,
coefficient_of_thermal_expansion: str | float | None = None,
coefficient_of_thermal_expansion_anisotropic: List[float | str]
| None = None,
density: str | float | None = None,
dynamic_viscosity: str | float | None = None,
dynamic_viscosity_anisotropic: List[List[float | str]] | None = None,
elasticity_matrix_youngs_modulus_poissons_ratio: (
MaterialProperty.ElasticityMatrixYoungsModulusPoissonsRatio
| None) = None,
elasticity_matrix_pressure_shear_velocity: (
MaterialProperty.ElasticityMatrixPressureShearVelocity
| None) = None,
elasticity_matrix: MaterialProperty.ElasticityMatrix | None = None,
electric_conductivity: str | float | None = None,
electric_conductivity_anisotropic: List[List[float | str]]
| None = None,
electric_permittivity: str | float | None = None,
electric_permittivity_anisotropic: List[List[float | str]]
| None = None,
heat_capacity: str | float | None = None,
magnetic_permeability: str | float | None = None,
magnetic_permeability_anisotropic: List[List[float | str]]
| None = None,
mass_damping_coefficient: str | float | None = None,
piezoelectric_coupling: List[List[float | str]] | None = None,
prony_series: MaterialProperty.PronySeries | None = None,
speed_of_sound: str | float | None = None,
stiffness_damping_coefficient: str | float | None = None,
thermal_conductivity: str | float | None = None,
thermal_conductivity_anisotropic: List[List[float | str]]
| None = None,
orientation: str | Tuple[float | int, float | int, float | int]
| None = None,
enabled: str | None = None) -> Material

Create a material in the project.

Arguments:

  • name - The name of the material.
  • description - Optional description of the material.
  • color - The color of the material. Format: “#RRGGBB”
  • abbreviation - Optional abbreviation of the material.
  • target_region - The target Region of the material.
  • coefficient_of_thermal_expansion - Optional coefficient of thermal expansion. Can be a float or string expression.
  • coefficient_of_thermal_expansion_anisotropic - Optional anisotropic coefficient of thermal expansion. A list of 3 floats or strings.
  • density - Optional density of the material. Can be a float or string expression.
  • dynamic_viscosity - Optional dynamic viscosity. Can be a float or string expression. Mutually exclusive with dynamic_viscosity_anisotropic.
  • dynamic_viscosity_anisotropic - Optional anisotropic dynamic viscosity. A 3x3 matrix as a list of lists of floats or strings. Mutually exclusive with dynamic_viscosity.
  • elasticity_matrix_youngs_modulus_poissons_ratio - Optional elasticity matrix defined by Young’s modulus and Poisson’s ratio. Mutually exclusive with elasticity_matrix and elasticity_matrix_pressure_shear_velocity.
  • elasticity_matrix_pressure_shear_velocity - Optional elasticity matrix defined by pressure and shear wave velocities. Mutually exclusive with elasticity_matrix and elasticity_matrix_youngs_modulus_poissons_ratio.
  • elasticity_matrix - Optional elasticity matrix. A MaterialProperty.ElasticityMatrix object. Mutually exclusive with elasticity_matrix_youngs_modulus_poissons_ratio and elasticity_matrix_pressure_shear_velocity.
  • electric_conductivity - Optional electric conductivity. Can be a float or string expression. Mutually exclusive with electric_conductivity_anisotropic.
  • electric_conductivity_anisotropic - Optional anisotropic electric conductivity. A 3x3 matrix as a list of lists of floats or strings. Mutually exclusive with electric_conductivity.
  • electric_permittivity - Optional electric permittivity. Can be a float or string expression. Mutually exclusive with electric_permittivity_anisotropic.
  • electric_permittivity_anisotropic - Optional anisotropic electric permittivity. A 3x3 matrix as a list of lists of floats or strings. Mutually exclusive with electric_permittivity.
  • heat_capacity - Optional heat capacity. Can be a float or string expression.
  • magnetic_permeability - Optional magnetic permeability. Can be a float or string expression. Mutually exclusive with magnetic_permeability_anisotropic.
  • magnetic_permeability_anisotropic - Optional anisotropic magnetic permeability. A 3x3 matrix as a list of lists of floats or strings. Mutually exclusive with magnetic_permeability.
  • mass_damping_coefficient - Optional mass damping coefficient. Can be a float or string expression.
  • piezoelectric_coupling - Optional piezoelectric coupling matrix. A 6x3 matrix as a list of lists of floats or strings.
  • prony_series - Optional Prony series for viscoelastic material properties. A MaterialProperty.PronySeries object.
  • speed_of_sound - Optional speed of sound. Can be a float or string expression.
  • stiffness_damping_coefficient - Optional stiffness damping coefficient. Can be a float or string expression.
  • thermal_conductivity - Optional thermal conductivity. Can be a float or string expression. Mutually exclusive with thermal_conductivity_anisotropic.
  • thermal_conductivity_anisotropic - Optional anisotropic thermal conductivity. A 3x3 matrix as a list of lists of floats or strings. Mutually exclusive with thermal_conductivity.
  • orientation - Optional orientation of the material. Can be a tuple of 3 floats or a string like “[90; 0; 0]”
  • enabled - Optional enabled expression of the material. Can be a string expression like “eq(my_variable, 1)”
  • project_id - The ID of the project.

Returns:

The created material.

@prevent_deleted
def save() -> None

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

@prevent_deleted
def delete() -> None

Delete the project.

@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.

@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.

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.

@classmethod
def create(cls,
name: str,
overrides: List[Tuple[Variable | str,
str | float | int | List[str | float | int]]],
override_type: rawapi.SharedExpressionOverrideType = rawapi.
SharedExpressionOverrideType.SWEEP,
sweep_type: rawapi.SweepType | None = None,
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. The variable can be a Variable object or a string with the name of the variable. The second element is the new value for the variable. The value can be a string, float, int, or list of strings, floats, or ints.
  • override_type - The type of the VariableOverrides. Normal or Sweep.
  • project_id - The ID of the project.

Returns:

The created VariableOverrides.

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

Get a VariableOverrides by its ID.

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

Get all VariableOverrides in a project.

@property
@prevent_deleted
def id() -> str

Get the ID of the VariableOverrides.

@property
@prevent_deleted
def name() -> str

Get the name of the VariableOverrides.

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

Set the name of the VariableOverrides.

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

Get the type of the VariableOverrides.

@property
@prevent_deleted
def sweep_type() -> rawapi.SweepType | None

Get the sweep type of the VariableOverrides. Only valid for sweep overrides.

@sweep_type.setter
@prevent_deleted
def sweep_type(sweep_type: rawapi.SweepType | None) -> None

Set the sweep type of the VariableOverrides. Only valid for sweep overrides.

@property
@prevent_deleted
def overrides() -> List[Tuple[Variable, 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.setter
@prevent_deleted
def overrides(
overrides: List[Tuple[Variable | str,
str | float | int | List[str | float | int]]]
) -> None

Set the overrides of the VariableOverrides.

@prevent_deleted
def delete() -> None

Delete the VariableOverrides.