Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Sample code of extracting cutting plane geometry for mfc_sandbox.
https://docs.techsoft3d.com/hps/latest/prog_guide/0212_cutting_sections.html?highlight=cutting%20sections#extracting-cutting-plane-geometry

\uD83D\uDCD8 Instructions

...

Open \samples\data\turbine.hsf

Run the user code below

Code Block
void CHPSView::OnUserCode()
{
	HPS::SegmentKey mySegmentKey = GetCanvas().GetFrontView().GetSegmentKey();

	// enable visibility of cut geometry
	mySegmentKey.GetVisibilityControl().SetCutGeometry(true);

	// set the cutting depth for cutting section
	mySegmentKey.GetCuttingSectionAttributeControl()
		.SetCappingLevel(HPS::CuttingSection::CappingLevel::Segment)
		.SetCuttingLevel(HPS::CuttingSection::CuttingLevel::Global);

	// insert cutting section
	HPS::CuttingSectionKey cutterKey = mySegmentKey.InsertCuttingSection(HPS::Plane(HPS::Vector(1, 0, 0)));

	// Call update
	GetCanvas().GetFrontView().UpdateWithNotifier().Wait();

	// set gather depth
	HPS::CutGeometryGatheringOptionsKit opt;
	opt.SetLevel(CuttingSection::GatheringLevel::Segment);

	// build path
	HPS::SprocketPath sprocket_path(GetCanvas(), GetCanvas().GetAttachedLayout(), GetCanvas().GetFrontView(), GetCanvas().GetFrontView().GetAttachedModel());

	// put cut geometry into subsegment called "caps"
	sprocket_path.GetKeyPath().GatherCutGeometry(mySegmentKey.Subsegment("caps"), opt);

	// delete model to leave just the caps in place (optional)
	GetCanvas().GetFrontView().GetAttachedModel().Delete();

	GetCanvas().Update();
}

...

...

For the sample code and instructions, check out our forum post.

...