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

HOOPS supports a variety of approaches to avoid specific portions of your model from interacting with HPS Cutting Sections (3DFCutting Planes).

HPS MFC Sandbox


Local Cutting Sections

  • In this approach, the scope of the cutting section is local
  • 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

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;

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.SetBasis(Vector(0.25, 0.25, 1), Vector(1, 0, 0));

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

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

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