# How-To: Control which portions of a scene graph interact with cutting sections

**URL:** <https://forum.techsoft3d.com/t/how-to-control-which-portions-of-a-scene-graph-interact-with-cutting-sections/1384>\
**Category:** HOOPS Visualize Desktop\
**Tags:** code, learn, knowledge-base, how-to\
**Created:** [December 1, 2021, 5:00am UTC](https://forum.techsoft3d.com/t/how-to-control-which-portions-of-a-scene-graph-interact-with-cutting-sections/1384 "2021-12-01T05:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriel.peragine](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.techsoft3d.com/gabriel.peragine/32/1535_2.png) [@gabriel.peragine](https://forum.techsoft3d.com/u/gabriel.peragine)\
**Post date:** [December 1, 2021, 5:00am UTC](https://forum.techsoft3d.com/t/how-to-control-which-portions-of-a-scene-graph-interact-with-cutting-sections/1384/1 "2021-12-01T05:00:00Z")

</div>

HOOPS supports a variety of approaches to avoid specific portions of your model from interacting with [HPS Cutting Sections](https://docs.techsoft3d.com/hps/latest/prog_guide/0212_cutting_sections.html) ([3DFCutting Planes](https://docs.techsoft3d.com/3df/latest/prog_guide/3dgs/02_13_geometry_cutting_planes.html)).

![]()

 ![image-20210412-234345](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/1X/6017dcff0e829750e9d4900697e2b73c48bf1f31.png)

HPS MFC Sandbox

## Instructions

### Local Cutting Sections

- In this approach, the scope of the cutting section is local
  - HPS → [SetCuttingLevel](https://docs.techsoft3d.com/hps/latest/api_ref/cpp/class_h_p_s_1_1_cutting_section_attribute_control.html#_CPPv4N3HPS30CuttingSectionAttributeControl15SetCuttingLevelEN14CuttingSection12CuttingLevelE)
  - 3DF → [Set\_Rendering\_Options](https://docs.techsoft3d.com/3df/latest/api_ref/3dgs/HC_Set_Rendering_Options.html#hc__proto_8h_1Set_Rendering_Options_local_cutting_planes)

- The cutting section is applied to geometry in the segment and subsegments where it is defined
- The cutting section is ignored by other parts of the segment hierarchy

### Cutting Sections Visibility

- In this approach, the visibility is used to effectively turn off a cutting section for portions of the scene graph
  - HPS → [SetCuttingSections](https://docs.techsoft3d.com/hps/latest/api_ref/cpp/class_h_p_s_1_1_visibility_control.html#_CPPv4N3HPS17VisibilityControl18SetCuttingSectionsEb)
  - 3DF → [Set\_Visibility(“cutting planes = on/off”)](https://docs.techsoft3d.com/3df/latest/api_ref/3dgs/HC_Set_Visibility.html)

- As with other attributes, inheritance rules apply

Consider an example (shown in the scene above) where there are three different models (i.e. red, green and blue spheres). Setting the visibility of the cutting sections to false, prevents application of the cutting plane. The following sample code illustrates how this works;

```auto
void CHPSView::OnUserCode1()
{
	HPS::SegmentKey modelSegKey = GetCanvas().GetFrontView().GetAttachedModel().GetSegmentKey();
	modelSegKey.InsertCuttingSection(HPS::Plane(0, 0, 1, 0));

	HPS::SphereKit sphereKit;
	sphereKit.SetCenter(Point(-2, 0, 0));
	sphereKit.SetRadius(0.5f);
	sphereKit.SetBasis(Vector(0.25, 0.25, 1), Vector(1, 0, 0));

	HPS::SegmentKey modelASegKey = modelSegKey.Subsegment("model A");
	modelASegKey.InsertSphere(sphereKit);
	modelASegKey.GetMaterialMappingControl().SetFaceColor(RGBAColor(1, 0, 0));

	sphereKit.SetCenter(Point(0, 0, 0));
	HPS::SegmentKey modelBSegKey = modelSegKey.Subsegment("model B");
	modelBSegKey.InsertSphere(sphereKit);
	modelBSegKey.GetMaterialMappingControl().SetFaceColor(RGBAColor(0, 1, 0));
	// Avoid cutting section
	modelBSegKey.GetVisibilityControl().SetCuttingSections(false);

	sphereKit.SetCenter(Point(2, 0, 0));
	HPS::SegmentKey modelCSegKey = modelSegKey.Subsegment("model C");
	modelCSegKey.InsertSphere(sphereKit);
	modelCSegKey.GetMaterialMappingControl().SetFaceColor(RGBAColor(0, 0, 1));
}

```
