Skip to main content

Common methods

Common methods are cross-functional standard functions.

Create

Create creates a new feature.

newMaterial = SpeosSim.Material.Create()

Find

Find looks for a custom object by its name and directly gets the corresponding object in the active component.

existingMaterial = SpeosSim.Material.Find("Plastic")

Print

Setting and getting values can be easily done, mainly though the set and print functions. Most values of parameters are numeric, strings or booleans.

print gets the value of a specific parameter: print irradianceSensor.YResolution Setting values is done by assigning a value, string or boolean to a Speos object.

#Example of irradiance sensor definition
irradianceSensor = SpeosSim.SensorIrradiance.Create()
print irradianceSensor.XStart
print irradianceSensor.XEnd
print irradianceSensor.XResolution
irradianceSensor.XIsMirrored = True
irradianceSensor.XEnd = 15
irradianceSensor.XResolution = 500
print irradianceSensor.YStart
print irradianceSensor.YEnd
print irradianceSensor.YResolution
irradianceSensor.YIsMirrored = True
irradianceSensor.YEnd = 15
irradianceSensor.YResolution = 500
print irradianceSensor.XMPTemplateFile
irradianceSensor.XMPTemplateFile = ".\\SPEOS input file\\xmpTemplate.xml"

Clone

Clone copies the object.

copiedMaterial = existingMaterial.Clone()

Delete

Delete deletes the oject.

copiedMaterial.Delete()

Name

Name gets or modifies the name of the feature.

plasticMaterial.Name = "Plastic"

Visible

Visible gets or modifies the visibility of the feature.

existingSource.Visible = False

Subject

Subject returns the underlying CustomObject.

Selection.Create(existingMaterial.Subject)

StatusInfo

StatusInfo returns the warnings or error messages associated to the feature. If there are no errors, the returned string is empty.

print inverseSimulation.StatusInfo

PublishAllParameterstoWorkbench

PublishAllParameterstoWorkbench exposes the attributes of Speos elements so that Ansys Workbench can access and drive them.

existingSource.PublishAllParametersToWorkbench(True)

Compute

Compute is used to trigger the generation of any object.

inverseSimulation.Compute()

Note: Computation is not automatic on features during the script process as Compute events are executed at the end of the "Script" Command. So if you want your features to be up to date, you need to call explicitly the Compute() method on objects that are usually supposed to update automatically in the interactive session.