How to scale imported CAD model with units

When a CAD model is imported to the scene graph, the model is not scaled with the model units.
If you want to display the model with the specified unit, you can add a modeling matrix with scale to the model.

You can know the model units from the “Units” metadata of HPS::Exchange::CADModel.

	HPS::Exchange::ImportNotifier notifier = HPS::Exchange::File::Import("file path", HPS::Exchange::ImportOptionsKit());
	HPS::Exchange::CADModel cadmodel = notifier.GetCADModel();

	HPS::View myView = cadmodel.ActivateDefaultCapture();

	HPS::Metadata metadata = cadmodel.GetMetadata("Units");
	float scale = 1.0;
	if (metadata.Type() == HPS::Type::StringMetadata)
		HPS::StringMetadata sm(metadata);
		HPS::UTF8 value = sm.GetValue();
		if (value == "Inch") // Scale to millimetr
			scale = 25.4;     
	HPS::ComponentArray subcomponents = cadmodel.GetSubcomponents();
	HPS::KeyArray keys = subcomponents[0].GetKeys();
	HPS::SegmentKey modelsegment(keys[0]);

	HPS::MatrixKit mat;
	mat.Scale(scale, scale, scale);
catch (const HPS::IOException& ioe)
	// handle error