How-To: create and display a Parasolid body using HPS Sprocket Parasolid

Simple instruction to set-up MFC Sandbox to use HPS Sprocket Parasolid.

Instructions:

Project properties:

  • Go to C/C++ → Preprocessor

  • Preprocessor definition

  • Add USING_PARASOLID;

  • Go to Linker → Input

  • Additional dependencies

  • Add path to pskernel.lib

  • Copy pskernel.dll in HOOPS Visualize bin directory

Code:

#include "parasolid_kernel.h"
void CHPSView::OnUserCode2()
{
	auto psmodel = HPS::Parasolid::Factory::CreateCADModel();
	HPS::Parasolid::FacetTessellationKit tesskit;
	tesskit.GetDefault();

	PK_BODY_t solid_body = PK_ENTITY_null;
	PK_BODY_create_solid_block(0.05, 0.05, 0.05, nullptr, &solid_body);

	// add solid block to root entity
	HPS::Parasolid::Component myNewComponent = psmodel.AddEntity(solid_body, HPS::Parasolid::FacetTessellationKit::GetDefault(),
	HPS::Parasolid::LineTessellationKit::GetDefault());

	GetCanvas().GetAttachedLayout().AttachViewFront(psmodel.ActivateDefaultCapture());
	GetCanvas().GetFrontView().SetRenderingMode(HPS::Rendering::Mode::GouraudWithLines);
	GetCanvas().UpdateWithNotifier().Wait();
}

Result: