HOOPS/ACIS Bridge


Introduction

The HOOPS/ACIS Bridge encapsulates the work needed to connect ACIS modeler from Spatial to the HOOPS/3dGS. The bridge provides an API for controlling the manner in which ACIS' geometric tessellation is mapped to HOOPS primitives, and for finding exactly which HOOPS segment entity corresponds to which ACIS entity and vice versa. The HOOPS/ACIS Bridge is supplied as a dynamic linked library (dll) with an exposed API.

The following section gives technical details on how the integration between ACIS and the HOOPS/3dGS has been designed and includes a reference guide for the routines in the HOOPS/ACIS Bridge API.

The HOOPS/ACIS Reference Application is a MS Windows Application built with the components of the HOOPS 3D Application Framework, ACIS, and MFC GUI toolkit. It includes clear source for the application code and can be used as a prototyping tool or a base architecture for new applications.

Connecting ACIS to HOOPS/3dGS

Building a two-way connection between ACIS and the HOOPS/3dGS involves accessing the geometric data in ACIS and mapping it the appropriate set of geometric primitives in HOOPS. Furthermore, it involves providing a mechanism for finding out which ACIS entity corresponds to which HOOPS entity and vice versa. A class that implements IEntityConverter performs the conversion of ACIS ENTITYs to HOOPS segments. An example class (hoops_acis_entity_converter) is provided with the HOOPS/ACIS Bridge. If hoops_acis_entity_converter does not suit the application's needs, it can be replaced using HA_Set_Entity_Converter.

Synchronizing ACIS and HOOPS/3dGS

The HOOPS/ACIS Bridge routine HA_Render_Entities will initiate the flow of geometric information from ACIS to the HOOPS/3dGS. The HA_Render_Entities routine accepts a list of ACIS entities and then calls the registered IEntityConverter class to convert the ACIS ENTITYs to HOOPS segments.

HOOPS Segment Structure Generated

When ACIS Entities are rendered via the HA_Render_Entity routine, the HOOPS/ACIS Bridge uses the passed in segment pattern or the default segment pattern set using the "segment pattern" sent to HA_Set_Rendering_Options. The HOOPS/ACIS Bridge then opens the segment the pattern expands to and populates it with geometry corresponding to the rendered ACIS entities.

The HOOPS/ACIS Bridge API provides control over how the ACIS entities are mapped to HOOPS via the routine HA_Set_Rendering_Options. The actual segment structure generated under the open segment depends on which options are chosen. 

As the HOOPS/ACIS Bridge uses a segment pattern, the user has maximum flexibility over the structure of the top part of the HOOPS segment tree. For instance, an application working with assemblies of ACIS bodies will create the appropriate assembly structure in the HOOPS segment tree and then open the appropriate segment in the tree when rendering bodies for the individual parts of the assembly.

Mapping of ACIS Entities to HOOPS Geometry

To give the user maximum flexibility in their implementation, mappings are maintained between HOOPS and ACIS entities. This is so someone could, for example, pick on the HOOPS graphics on the screen and perform operations on the corresponding ACIS geometry. The HOOPS/MVO library includes several Operator classes, which make use of the entity mapping between ACIS and HOOPS to implement sophisticated application level features.

The HOOPS/ACIS Bridge maps the tessellation of all ACIS entities to HOOPS geometric primitives, inserting zero or more new HOOPS geometric primitives into the HOOPS database for each ACIS entity encountered.  While each ACIS entity uses a pointer for access, HOOPS entities have "keys" that are long integers and are passed to routines when accessing the entity. The HOOPS/ACIS Bridge routines HA_Compute_Entity_Pointer and HA_Compute_Geometry_Keys can be used for converting ACIS pointers to HOOPS keys and vice versa.

The HOOPS/ACIS Bridge maps the geometric tessellation of all ACIS entities to HOOPS, inserting a new HOOPS geometric primitive into the HOOPS database for each ACIS Entity. The following section gives details on how each of the ACIS Entities are mapped to HOOPS geometric primitives.

ACIS Faces and Bodies

In applications that provide highly interactive functionality such as model creation, view and markup, and dimensioning, the modeler operations have to create, delete, and modify ACIS faces frequently, and therefore the amount of data flowing from ACIS to HOOPS should be minimized. This is accomplished by mapping all the tessellated geometry associated with one ACIS Face to one HOOPS shell. An additional optimization step ensures the minimum number of vertices are used and the longest triangle strips possible are computed internally by HOOPS for optimal rendering.

Conversely, for applications only viewing ACIS models, all the tessellated geometry associated with all the ACIS Faces in one ACIS Body can be mapped to one HOOPS shell. This results in a reduction in the number of vertices for complex ACIS Bodies and can increase rendering through-put. It is anticipated this mode will be useful to applications focused primarily on viewing & querying model or assembly data, ie., the Virtual Prototyping and View/Markup sectors.

ACIS Edges/Wires

ACIS Edges/Wires map to HOOPS Polylines.

ACIS Vertices

ACIS Vertices map to HOOPS Marker Symbols. To display the vertices, you must set the marker visibility of model segment on.

Initialization

A typical application will need to perform the following:

Setting Rendering Options (HA_Set_Rendering_Options)

RenderVerticesMode [= on,off]

Controls whether or not to render ACIS Vertices and map them to HOOPS primitives.

RenderEdgesMode [= on,off]

Controls whether or not to tessellate the ACIS Edges and map them to HOOPS primitives.

RenderFacesMode [= on,off]

Controls whether or not to render ACIS Faces and map them to HOOPS primitives.

RenderTCoedges [= on,off]

Controls whether or not to render ACIS TCoedges and map them to HOOPS primitives.

RenderCoedges [= on,off]

Controls whether or not to render ACIS Coedges and map them to HOOPS primitives.

RenderAPOINTs [= on,off]

Controls whether or not to render ACIS APOINTs and map them to HOOPS primitives.

RenderWCSs [= on,off]

Controls whether or not to render ACIS WCSs and map them to HOOPS primitives.

RenderText [= on,off]

Controls whether or not to render ACIS Text and map them to HOOPS primitives.

segment pattern [string]

Specifies the global segment pattern. (See Segment Patterns below)

Converting ACIS Entities to HOOPS Segments

ENTITYs are converted to HOOPS segments using HA_Render_Entity or HA_Render_Entities.  These functions take either an ENTITY or an ENTITY_LIST and an optional segment pattern.

Segment Pattern

HA_Render_Entity/HA_Render_Entities takes an optional segment pattern parameter. The segment pattern specifies the segment that will contain the ENTITYENTITY's rendering data. The pattern can contain keywords that will be automatically expanded out by calling HA_Build_Segment_String with a given ENTITY and pattern. The current keywords are:

A global segment pattern can also be set by calling HA_Set_Rendering_Options with "segment pattern = some_segment_pattern". For example,

// Set the global segment pattern
HA_Set_Rendering_Options("segment pattern = ?Include Library/history/entity");

When HA_Build_Segment_String expands this out, all ENTITYs with the same history stream will be grouped together, with each ENTITY in its own segment since 'entity' will be replaced with the ENTITY's address.

char inbuffer[1024];
HA_Build_Segment_String(entity, inbuffer,"?Include Library/history/entity");
// inbuffer becomes "?Include Library/0x12345678/0x11112222" if entity->history() == 0x12345678
// and entity == 0x11112222

Writing a Custom Converter

The HOOPS/ACIS bridge comes with a default ENTITY converter. If the default converter is not sufficient for an application's needs, a custom converter can be registered with the bridge, which will be used instead of the default one. To implement a custom converter, derive from IentityConverter (ientityconverter.h) or hoops_acis_entity_converter and register it with the bridge.

For example, the scheme application has a scheme_entity_converter and it is registered as follows:

//Use the scheme entity converter.
IEntityConverter *cvrt=HA_Get_Entity_Converter()
if (cvrt)
ACIS_DELETE cvrt;cvrt=0;
HA_Set_Entity_Converter(ACIS_NEW scheme_entity_converter);

Note: The bridge will automatically delete the converter that is currently active on termination.

Mapping from ACIS Entity to HOOPS Segment

And two functions that allow going back and forth between HOOPS and ACIS-
HA_Compute_Geometry_Keys(ENTITY* entity, unsigned long count, HC_KEY* keys);
HA_Compute_Entity_Pointer(HC_KEY key, int acisClass);

Mapping from HOOPS Segment to ACIS Entity

And two functions that allow going back and forth between HOOPS and ACIS-
HA_Compute_Geometry_Keys(ENTITY* entity, unsigned long count, HC_KEY* keys);
HA_Compute_Entity_Pointer(HC_KEY key, int acisClass);

Deleting Rendering Data

HA_Delete_Entity_Geometry(ENTITY_LIST const&) deletes the rendering data for the list of ENTITYs.

History and Rollback

Inside api_initialize_hoops_acis_bridge, HA_History_Callbacks is registered with the history callback list. HA_History_Callbacks is derived from history_callbacks and receives the following notifications:

virtual void 
history_callbacks::After_Roll_Bulletin_Board ( 
BULLETIN_BOARD*,  // bulletin board 
logical discard  // discard 

Callback method, called after rolling a bulletin board. If discard is TRUE, the roll is due to error processing, and the BULLETIN_BOARD will be deleted along with all of its BULLETINs.

 virtual void 
 history_callbacks::After_Roll_State ( 
 DELTA_STATE*  // delta state 
 ); 

Callback method, called after rolling one state.

 virtual void 
 history_callbacks::After_Roll_States (); 

Callback method, called after rolling all states.

 virtual void 
 history_callbacks::Before_Roll_Bulletin_Board ( 
 BULLETIN_BOARD*,  // bulletin board 
 logical discard  // discard 
 ); 

Callback method, called before rolling a bulletin board. If discard is TRUE, the roll is due to error processing, and the BULLETIN_BOARD will be deleted along with all of its BULLETINs.

 virtual void 
 history_callbacks::Before_Roll_State ( 
 DELTA_STATE*  // delta state 
 ); 

Callback method, called before rolling one state.

 virtual void 
 history_callbacks::Before_Roll_States (); 

Callback method, called before rolling all states.

HA_History_Callbacks overrides these methods to handle the rollback mechanism to keep the HOOPS segment structure up-to-date.

Part Management (HA_Part)

HA_Part is a helper class that wraps PART for use with the HOOPS/ACIS bridge. It provides the following methods:

HA_EntityCallback (ha_part/ha_callback.h) provides Part management support for HOOPS/ACIS bridge applications that want to use the PART Management Component. HA_EntityCallback derives from entity_callback and listens for the following message:

Termination

api_terminate_hoops_acis_bridge calls ACIS termination functions for the components initialized in initialization.

[Top]