How-to: Display CAD model in multiple views

To display a model in multiple views, you can create multiple HPS::View and attach the imported model to each view.

View Hierarchy — HOOPS Visualize HPS Documentation 2022.0.0 documentation
Exchange Integration — HOOPS Visualize HPS Documentation 2022.0.0 documentation

Instructions

Sample code for mfc_sandbox.

void CHPSView::OnUserCode()
{
	// TODO: Add your command handler code here
	try
	{
		HPS::Exchange::ImportNotifier notifier = HPS::Exchange::File::Import("C:\\HOOPS_Exchange_Publish\\samples\\data\\catiaV5\\CV5_Aquo_Bottle\\_Aquo Bottle.CATProduct", HPS::Exchange::ImportOptionsKit());
		notifier.Wait();
		HPS::CADModel cadModel = notifier.GetCADModel();

		HPS::Model model = cadModel.GetModel();

		HPS::CaptureArray captures = cadModel.GetAllCaptures();
		View viewLeft = cadModel.ActivateDefaultCapture(); // Activate default capture
		View viewRight = captures[0].Activate();  // Activate capture in CADModel

		HPS::Layout layout = GetCanvas().GetAttachedLayout();
		layout.GetAttachedView().Delete();

		layout.AttachViewFront(viewLeft, HPS::Rectangle(-1, 0, -1, 1)); // left view
		layout.AttachViewFront(viewRight, HPS::Rectangle(0, 1, -1, 1)); // right view

		viewLeft.GetOperatorControl().Push(new HPS::OrbitOperator());
		viewRight.GetOperatorControl().Push(new HPS::PanOperator());

		viewLeft.FitWorld();
		viewRight.FitWorld();
	}
	catch (const HPS::IOException& ioe)
	{
		// handle error
	}

	GetCanvas().Update();

}
  1. Add sample code and set up HOOPS Exchange integration in mfc_sandbox
  2. Build and execute User Code
  3. You can see a model in the multiple views with different capture.