2.1.23.1. Settings for an Expression Output

The formulation of an expression output requires a basic understanding of The ACP Python Scripting User Interface.

The Parameter Properties dialog displays a Source field that accepts Python code. Various information stored in the ACP database can be accessed. It is possible to enter a script and perform most of the operations available within ACP's Shell View.

The script's result can be returned by assigning a value to the global return_value variable.

Example 2.6: Simple Expression Output

An example of a simple expression output is shown here. In it, the maximum inverse reserve factor is retrieved from the active contour plot.


Example 2.7: Complex Expression Output of Maximum Thickness in the Kiteboard Model

# Get active model
model = db.active_model

# Create new selection of all elements attached to a specific ply
modeling_ply = model.modeling_groups['Core'].plies['mp_4']
model.select_elements(selection='sel0',op='new',attached_to=[modeling_ply])

# Get total thickness of the first entity of selection sel0
thicknesses = list(model.mesh_query(name='thickness',position='centroid',selection='sel0',    entities=[modeling_ply])[0])

# Get maximum thickness
max_thickness = max(thicknesses)

# Pass the found maximum thickness as the script's result.
return_value = max_thickness