Run a Pipeline
The following example will execute Simplygon on the current selection using a previously saved Pipeline.
INFO
The export does support preservation of quads (to be used by the quad reducer). To enable quad export; call sgsdk_SetQuadMode before executing Simplygon. The Simplygon UI sets the QuadMode-flag automatically whenever there is a QuadReductionPipeline involved, but for scripting this has to be done manually.
MaxScript
-- load an asset
loadMaxFile "D:/Assets/SomeAsset.max"
-- select everything in scene
select $*
-- load previously saved pipeline
reductionPipeline = sgsdk_LoadPipeline "D:/Pipelines/reductionPipeline.json"
-- Uncomment the line below to enable QuadMode
-- sgsdk_SetQuadMode true
-- execute pipeline on selection,
-- returns result to Max once completed
sgsdk_RunPipelineOnSelection reductionPipeline
-- clear all pipelines that resides in memory
sgsdk_ClearPipelines()
python
from pymxs import runtime as rt
# load an asset
rt.loadMaxFile('D:/Assets/SomeAsset.max')
# select objects
rt.select(rt.objects)
# load previously saved pipeline
reductionPipeline = rt.sgsdk_LoadPipeline('D:/Pipelines/reductionPipeline.json')
# Uncomment the line below to enable QuadMode
# rt.sgsdk_SetQuadMode(True)
# execute pipeline on selection,
# returns result to Max once completed
rt.sgsdk_RunPipelineOnSelection(reductionPipeline)
# clear all pipelines that resides in memory
rt.sgsdk_ClearPipelines()
Next steps
Get to know how to work with Pipelines: