# Simple reduction - Scripting
This example will create a simple reduction pipeline with a target Triangle Ratio
of 0.5 (50%), send the selected scene off to Simplygon for optimization and return the result back to Max once completed.
The first step is to create a minimalistic ReductionPipeline
, just a simple reduction on geometries while preserving original materials, nothing more, nothing less.
The sgsdk_RunPipelineOnSelection
function is one of the main functions that starts the optimization from Max, it takes a Pipeline settings-object or a settings-path as input which specifies what kind of optimization Simplygon will do, for example Reduction, Aggregation, Remeshing and Material Baking - for this example we will use a Reduction pipeline from the previous section.
The second part is to select the scene that is to be optimized (or parts of it) and start the optimization using the sgsdk_RunPipelineOnSelection
function. The optimized result will get imported automatically once the optimization has completed.
The third and last part is simply to clean up created and / or loaded Pipelines that resides in memory, they can of course be reused but it is easy to forget they were ever there.
# Next steps
Get to know how to use the Simplygon Max plug-in: