# Clipping a model via scripting

**URL:** <https://discourse.slicer.org/t/clipping-a-model-via-scripting/43963>\
**Category:** Support\
**Tags:** python\
**Created:** [August 4, 2025, 10:19pm UTC](https://discourse.slicer.org/t/clipping-a-model-via-scripting/43963 "2025-08-04T22:19:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chz31](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chz31/32/77363_2.png) [@chz31](https://discourse.slicer.org/u/chz31)\
**Post date:** [August 4, 2025, 10:19pm UTC](https://discourse.slicer.org/t/clipping-a-model-via-scripting/43963/1 "2025-08-04T22:19:56Z")

</div>

Hi all,

I am trying to clipping a model via scripting:

```auto
if not clipModelsNode:
    clipModelsNode = slicer.mrmlScene.AddNewNodeByClass(
        'vtkMRMLClipModelsNode', 'ClipModels')

# Get model node to clip
modelNode = slicer.util.getNode('left_orbit_fx')

# Enable clipping on the model's display node
modelDisplayNode = modelNode.GetDisplayNode()
modelDisplayNode.SetClipping(True)

modelDisplayNode.SetSliceDisplayMode(
    modelDisplayNode.SliceDisplayIntersection)

clipModelsNode.SetRedSliceClipState(1) # Positive side of red plane
clipModelsNode.SetYellowSliceClipState(0) # Off
clipModelsNode.SetGreenSliceClipState(0) # Off

```

However, only after I manually selected the global clip model ‘ClipModels’ in the Models module UI for the model node, I could use the above script to turn on and off the clipping effect

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/0/d0281aa721037a3a8c369b4cfc04179ac24f732a.png)

I feel I probably missed a step to add the model node to the clipping node but I could not find how to do that. Can I have some advice on this issue?

Thanks!
