1.0 Overview

2.0 PMI Integration


1.0 Overview

InterOp is a CAD data translation framework from Spatial Corp. It is designed for use as the data translation foundation for end-user applications. The object-oriented interface translates between popular standard and proprietary CAD data formats. This interface can be used to read/write a CAD file directly into/from an ACIS or Parasolid-enabled application.

For developers who have an ACIS or Parasolid based application, HOOPS facilitates the integration with InterOp. This is in the form of a reference application called the Part Viewer. There is a user's guide for the ACIS Part Viewer as well as for the Parasolid Part Viewer. The HOOPS/InterOp integration builds on the basic reference implementation allowing developers to easily added InterOp capabilities like importing commonly used CAD file formats. The code for ACIS/InterOp Part Viewer reference implementation can be found in the <hoops>/demo/mfc/acispartviewer directory while the Parasolid/InterOp code can be found in the <hoops>/demo/mfc/parasolidpartviewer directory.

1.1 Building And Compiling

Before building or running the HOOPS/InterOp Part Viewer, you must obtain a license for InterOp as well as have the proper libraries installed. For installation and build instructions for InterOp, please see the documentation in the InterOp area of the HOOPS Developer Zone.

For ACIS developers, navigate to the <hoops>/demo/mfc/acispartviewer directory and open the acispartviewer_interop_vc<MS Visual Studio Version>.vcproj.

For Parasolid developers, navigate to the <hoops>/demo/mfc/parasolidpartviewer directory and open the parasolidpartviewer_interop_vc<MS Visual Studio Version>.vcproj.

1.2 Integrating with ACIS or Parasolid

HOOPS requires a bridge when interfacing with ACIS or Parasolid APIs. One example is the HOOPS/ACIS bridge, ha_bridge, which is found in a standard ACIS installation. Parasolid has a corresponding hp_bridge. Spatial maintains the ACIS bridge, ha_bridge, and supplies this in their ACIS packages. Tech Soft 3d maintains the Parasolid bridge, hp_bridge, and supplies this in a standard HOOPS installation.

By default, the bridges are shipped compiled against a specific version of HOOPS. Customers building their own applications are required to rebuild the appropriate bridge against the version of HOOPS they have installed.

Since HOOPS provides pre-build partviewers that contain all the DLLs required to run the sample application, rebuilding either of the bridges may cause these applications to fail. A workaround is to copy the Partviewer dlls to a new directory, or to use a separate pre-built InterOp Partviewer that has its own self-contained directory structure. Please contact support for details.

Additional information for the ha_bridge is available on Spatial's HOOPS/ACIS Bridge website while information on the hp_bridge is available under HOOPS/Parasolid documentation .


2.0 HOOPS/InterOp Part Viewer

The HOOPS/InterOp Part Viewer has been implemented with ACIS and Parasolid. Both implementations allow InterOp to import supported CAD file formats into the modeler kernel. Then visulization information is populated into the HOOPS database and displayed. For file formats that have PMI information, HOOPS asks InterOp to import this information into the modeler kernel.

2.1 Displaying PMI

When PMI information is imported from a file via InterOp, HOOPS will display this information in the scene. This process starts when the update method of HSolidView, a child class of HBaseView, is called. The HSolidView::Update method calls HPMIUtility::Update() as seen in the code snippet below:

void HSolidView::Update () {
#ifdef INTEROP
	((HSolidModel *)GetModel())->GetInterOpFileIOHandler()->Update();
	m_pmi->Update();
#endif // INTEROP
	HBaseView::Update();
}

In the HPMIUtility::Update() method, an entity list is created via InterOp's PMI interface. Finally, the HPMIUtility::DisplayPMI is called. This method inserts PMI information into the HOOPS database and associates it with the correct entities in the HOOPS scene.

Supported PMI Data

A wide variety of PMI data is supported in HOOPS. They include the following:

Note that to properly display PMI information including GD&T symbols, your must use a font that has GD&T symbols. The HOOPS installation ships with ts3d font which has GD&T symbols. You can freely redistribute this font. To use this font in your application, specify the font location in the font directory as described in the font section of HOOPS/3dGS Programming Guide. You can find a list of available GD&T symbols in the Inserting GD&T symbols section of the HOOPS/3dGS Programming Guide.

Figure 2.1a An example of PMI information displayed and highlighted with its associated entity.

2.2 PMI And Selection

Once PMI information is displayed in the HOOPS scene, end users might want to select and highlight this information along with the associated entity. To allow for the highlighting of entities connected to PMI Information, there is a new class called MultiSelectManager. Defined in HSUtility.h, it keeps track of which entities (body, faces, edges, vertices) are associated with a given PMI entry. This can be a one to one or one to many association. During model import and the traversal of the PMI related attributes, MultiSelectManager is populated in the function HPMIUtility::AddToMultiSelect(). In the code snippet below, we see how the MultiSelectManager is obtained from the current model:

void HPMIUtility::AddToMultiSelect(ENTITY *iEnt, HC_KEY key, MultiSelectItem *msi)
{
	...
	// The following two lines get the MultiSelectManager object associated 
	// with the current model
	
	HSolidModel *model      = (HSolidModel *)m_pHView->GetModel();
	MultiSelectManager *msm = model->GetMultiSelectManager();
	...
}

Then HPMIUtility::AddToMultiSelect retrieves the HOOPS keys for a given modeller entity. There can be more than one. However, it is only necessary to store one key and later retrieve all the keys associated to an entity highlighted. The following code sample shows how this can be implemented for ACIS.

int count = HA_Compute_Geometry_Keys((ENTITY *)iEnt, 255, keys, "faces");

//  A new MultiSelectItem is created for the current PMI entity, referenced by 
// its top-level key

msi = msm->CreateMultiSelectItem(key);

//The entity key (pointing to HOOPS geometry) is associated to the PMI Entity
msi->AddAssociatedKey(keys[0]);

During selection, the MultiSelect code is activated if the user has not selected a part of the model itself. In that case, the MultiSelectManager checks if the current key is a valid PMI entity and highlights its associated geometry. This is done by further calls to HSelectionSet::Select. This is implemented in HSAcisSelectionSet.cpp/h; a snippet of the code is show below.

//The following two lines get the MultiSelectManager object associated with the current model
HSolidModel *model = (HSolidModel *)m_pView->GetModel();
MultiSelectManager *msm = model->GetMultiSelectManager();

//this code highlights all entities if the key that is passed in is part of a PMI 
//entity. A key that is a child of the key originally stored will still be valid.
key = msm->MultiSelect(key, m_pView);

//The key returned will point to the actual top-level PMI segment and can then be used 
//to highlight the PMI itself
HSelectionSet::Select(key, num_include_keys, include_keys, emit_message);