Project#

class ansys.speos.core.project.Project(speos, path='')#

A project describes all Speos features.

This includes optical properties, sources, sensors, simulations that user can fill in. Project provides functions to create new feature, find a feature. It can be created from empty or loaded from a specific file.

Parameters:
speosansys.speos.core.speos.Speos

Speos session (connected to gRPC server).

pathstr

The project will be loaded from this speos file. By default, "", means create from empty.

Attributes:
scene_linkansys.speos.core.kernel.scene.SceneLink

Link object for the scene in database.

Parameters:

Overview#

create_optical_property

Create a new Optical Property feature.

create_source

Create a new Source feature.

create_simulation

Create a new Simulation feature.

create_sensor

Create a new Sensor feature.

create_root_part

Create the project root part feature.

create_ground_plane

Create ground plane feature.

find

Find feature(s) by name (possibility to use regex) and by feature type.

delete

Delete project: erase scene data.

get

Get dictionary corresponding to the project - read only.

find_key

Get values corresponding to the key in project dictionary - read only.

preview

Preview cad bodies inside the project’s scene.

root_part

Property of root part of the project.

optical_properties

Property of optical properties inside the project.

sources

Property of project’s sources inside.

sensors

Property of project’s sensors inside.

simulations

Property of project’s simulations inside.

client

Speos instance client.

scene_link

Link object for the scene in database.

__str__

Return the string representation of the project’s scene.

Import detail#

from ansys.speos.core.project import Project

Property detail#

property Project.root_part: ansys.speos.core.part.Part | None#

Property of root part of the project.

Returns:
Union[part.Part, None]

Project’s root part if exists, otherwise None.

property Project.optical_properties: List[ansys.speos.core.opt_prop.OptProp]#

Property of optical properties inside the project.

Returns:
List[ansys.speos.core.opt_prop.OptProp]

List of optical properties features.

property Project.sources: List[ansys.speos.core.source.SourceSurface | ansys.speos.core.source.SourceLuminaire | ansys.speos.core.source.SourceRayFile | ansys.speos.core.source.SourceAmbientNaturalLight | ansys.speos.core.source.SourceAmbientEnvironment]#

Property of project’s sources inside.

Returns:
List[Union[ansys.speos.core.source.SourceSurface, ansys.speos.core.source.SourceLuminaire, ansys.speos.core.source.SourceRayFile, ansys.speos.core.source.SourceAmbientNaturalLight, ansys.speos.core.source.SourceAmbientEnvironment]]

List of source features.

property Project.sensors: List[ansys.speos.core.sensor.Sensor3DIrradiance | ansys.speos.core.sensor.SensorCamera | ansys.speos.core.sensor.SensorIrradiance | ansys.speos.core.sensor.SensorRadiance | ansys.speos.core.sensor.SensorXMPIntensity]#

Property of project’s sensors inside.

Returns:
List[Union[ansys.speos.core.sensor.Sensor3DIrradiance, ansys.speos.core.sensor.SensorCamera, ansys.speos.core.sensor.SensorIrradiance, ansys.speos.core.sensor.SensorRadiance, ansys.speos.core.sensor.SensorXMPIntensity]]

List of sensor features.

property Project.simulations: List[ansys.speos.core.simulation.SimulationDirect | ansys.speos.core.simulation.SimulationInteractive | ansys.speos.core.simulation.SimulationInverse | ansys.speos.core.simulation.SimulationVirtualBSDF]#

Property of project’s simulations inside.

Returns:
List[Union[ansys.speos.core.simulation.SimulationDirect, ansys.speos.core.simulation.SimulationInteractive, ansys.speos.core.simulation.SimulationInverse, ansys.speos.core.simulation.SimulationVirtualBSDF]]

List of simulation features.

Attribute detail#

Project.client#

Speos instance client.

Link object for the scene in database.

Method detail#

Project.create_optical_property(name, description='', metadata=None)#

Create a new Optical Property feature.

Parameters:
namestr

Name of the feature.

descriptionstr

Description of the feature. By default, "".

metadataOptional[Mapping[str, str]]

Metadata of the feature. By default, {}.

Returns:
ansys.speos.core.opt_prop.OptProp

OptProp feature.

Project.create_source(name, description='', feature_type=SourceSurface, metadata=None, parameters=None)#

Create a new Source feature.

Parameters:
namestr

Name of the feature.

descriptionstr

Description of the feature. By default, "".

feature_type: type

Source type to be created. By default, ansys.speos.core.source.SourceSurface. Allowed types: Union[ansys.speos.core.source.SourceSurface, ansys.speos.core.source.SourceRayFile, ansys.speos.core.source.SourceLuminaire, ansys.speos.core.source.SourceAmbientNaturalLight, ansys.speos.core.source.SourceAmbientEnvironment].

metadataOptional[Mapping[str, str]]

Metadata of the feature. By default, {}.

parametersOptional[Union[ ansys.speos.core.generic.parameters.LuminaireSourceParameters, ansys.speos.core.generic.parameters.SurfaceSourceParameters, ansys.speos.core.generic.parameters.RayFileSourceParameters, ansys.speos.core.generic.parameters.AmbientNaturalLightParameters, ansys.speos.core.generic.parameters.AmbientEnvironmentParameters]]

Allows to provide parameters to overwrite default parameters.

Returns:
Union[ansys.speos.core.source.SourceSurface, ansys.speos.core.source.SourceRayFile, ansys.speos.core.source.SourceLuminaire, ansys.speos.core.source.SourceAmbientNaturalLight, ansys.speos.core.source.SourceAmbientEnvironment]

Source class instance.

Project.create_simulation(name, description='', feature_type=SimulationDirect, metadata=None, parameters=None)#

Create a new Simulation feature.

Parameters:
namestr

Name of the feature.

descriptionstr

Description of the feature. By default, "".

feature_type: type

Simulation type to be created. By default, ansys.speos.core.simulation.SimulationDirect. Allowed types: Union[ansys.speos.core.simulation.SimulationDirect, ansys.speos.core.simulation.SimulationInteractive, ansys.speos.core.simulation.SimulationInverse].

metadataOptional[Mapping[str, str]]

Metadata of the feature. By default, {}.

Returns:
Union[ansys.speos.core.simulation.SimulationDirect, ansys.speos.core.simulation.SimulationInteractive, ansys.speos.core.simulation.SimulationInverse, ansys.speos.core.simulation.SimulationVirtualBSDF]

Simulation class instance

Project.create_sensor(name, description='', feature_type=SensorIrradiance, metadata=None, parameters=None)#

Create a new Sensor feature.

Parameters:
namestr

Name of the feature.

descriptionstr

Description of the feature. By default, "".

feature_type: type

Sensor type to be created. By default, ansys.speos.core.sensor.SensorIrradiance. Allowed types: Union[ansys.speos.core.sensor.SensorCamera, ansys.speos.core.sensor.SensorRadiance, ansys.speos.core.sensor.SensorIrradiance, ansys.speos.core.sensor.Sensor3DIrradiance, ansys.speos.core.sensor.SensorXMPIntensity].

metadataOptional[Mapping[str, str]]

Metadata of the feature. By default, {}.

parametersOptional[Union[ ansys.speos.core.generic.parameters.IrradianceSensorParameters, ansys.speos.core.generic.parameters.RadianceSensorParameters, ansys.speos.core.generic.parameters.CameraSensorParameters, ansys.speos.core.generic.parameters.Irradiance3DSensorParameters, ansys.speos.core.generic.parameters.IntensityXMPSensorParameters]]

Allows to provide parameters to overwrite default parameters

Returns:
Union[ansys.speos.core.sensor.SensorCamera, ansys.speos.core.sensor.SensorRadiance, ansys.speos.core.sensor.SensorIrradiance, ansys.speos.core.sensor.Sensor3DIrradiance, ansys.speos.core.sensor.SensorXMPIntensity]

Sensor class instance.

Project.create_root_part(description='', metadata=None)#

Create the project root part feature.

If a root part is already created in the project, it is returned.

Parameters:
descriptionstr

Description of the feature. By default, "".

metadataOptional[Mapping[str, str]]

Metadata of the feature. By default, {}.

Returns:
ansys.speos.core.part.Part

Part feature.

Project.create_ground_plane()#

Create ground plane feature.

Only one ground plane per project. Only usable when there is at least one Ambient Environment Source in the project.

Returns:
ansys.speos.core.ground_plane.GroundPlane

Ground plane feature.

Project.find(name, name_regex=False, feature_type=None)#

Find feature(s) by name (possibility to use regex) and by feature type.

Parameters:
namestr

Name of the feature.

name_regexbool

Allows to use regex for name parameter. By default, False, means that regex is not used for name parameter.

feature_typetype

Type of the wanted features. Mandatory to fill for geometry features. By default, None, means that all features will be considered (except geometry features).

Returns:
List[Union[ansys.speos.core.opt_prop.OptProp, ansys.speos.core.source.SourceSurface, ansys.speos.core.source.SourceRayFile, ansys.speos.core.source.SourceLuminaire, ansys.speos.core.source.SourceAmbientEnvironment, ansys.speos.core.source.SourceAmbientNaturalLight, ansys.speos.core.sensor.SensorCamera, ansys.speos.core.sensor.SensorRadiance, ansys.speos.core.sensor.SensorIrradiance, ansys.speos.core.sensor.Sensor3DIrradiance, ansys.speos.core.sensor.SensorXMPIntensity, ansys.speos.core.simulation.SimulationVirtualBSDF, ansys.speos.core.simulation.SimulationDirect, ansys.speos.core.simulation.SimulationInteractive, ansys.speos.core.simulation.SimulationInverse, ansys.speos.core.part.Part, ansys.speos.core.body.Body, ansys.speos.core.face.Face, ansys.speos.core.part.Part.SubPart, ansys.speos.core.ground_plane.GroundPlane]]

Found features.

Examples

>>> # From name only
>>> find(name="Camera.1")
>>> # Specify feature type
>>> find(name="Camera.1", feature_type=ansys.speos.core.sensor.SensorCamera)
>>> # Using regex
>>> find(
>>>     name="Camera.*",
>>>     name_regex=True,
>>>     feature_type=ansys.speos.core.sensor.SensorCamera,
>>> )
Here some examples when looking for a geometry feature:
(always precise feature_type)
>>> # Root part
>>> find(name="", feature_type=ansys.speos.core.part.Part)
>>> # Body in root part
>>> find(name="BodyName", feature_type=ansys.speos.core.body.Body)
>>> # Face from body in root part
>>> find(name="BodyName/FaceName", feature_type=ansys.speos.core.face.Face)
>>> # Sub part in root part
>>> find(name="SubPartName", feature_type=ansys.speos.core.part.Part.SubPart)
>>> # Face in a body from sub part in root part :
>>> find(name="SubPartName/BodyName/FaceName", feature_type=ansys.speos.core.face.Face)
>>> # Regex can be use at each level separated by "/"
>>> find(name="Body.*/Face.*", name_regex=True, feature_type=ansys.speos.core.face.Face)
>>> # All faces of a specific body
>>> find(name="BodyName/.*", name_regex=True, feature_type=ansys.speos.core.face.Face)
>>> # All geometry features at first level (whatever their type: body, face, sub part)
>>> find(name=".*", name_regex=True, feature_type=ansys.speos.core.part.Part)
Project.delete()#

Delete project: erase scene data.

Delete all features contained in the project.

Returns:
ansys.speos.core.project.Project

Project feature.

Project.get()#

Get dictionary corresponding to the project - read only.

Project.find_key(key)#

Get values corresponding to the key in project dictionary - read only.

Parameters:
keystr

Key to search in the project dictionary.

Returns:
List[tuple[str, dict]]

List of matching objects containing for each its x_path and its value.

Project.__str__()#

Return the string representation of the project’s scene.

Project.preview(viz_args=None, screenshot=None)#

Preview cad bodies inside the project’s scene.

Parameters:
viz_argsdict

contains arguments in dict format passed to add mesh function e.g. - {‘style’: ‘wireframe’}, - {‘style’: ‘surface’, ‘color’:’white’}, - {‘opacity’: 0.7, ‘color’:’white’, ‘show_edges’: False}.

screenshotstr or Path or None

Path to save a screenshot of the plotter. If defined Plotter will only create the screenshot