Home > User Guide > Display and User Input > Faceting
Step-by-Step Faceting
Rendering is one of the primary downstream operations that requires facets. Faceting is used by all active and static renderers. In both the active and static renderers, the entity facets are what are rendered.
In the case of the active renderers, each time an entity is added to the rendering context, the faceter automatically facets the entity.
In the case of a static renderer, the faceter does not automatically facet the entity. It expects that each entity in their list already has the appropriate INDEXED_MESH or LINKED_MESH . Therefore, at the beginning of an application, a call must be made to api_initialize_faceter. Later in the application, when the list of entities is available, a call is made to one of the facet APIs: api_facet_entities, api_facet_entity, api_facet_unfaceted_entities, or api_facet_unfaceted_entity.
The following lists the steps that an application could perform to facet and render a model using a static renderer.
- When an application uses faceting, it must first determine whether or not the facet data will be saved. If saving the data is required, the application derives its own mesh manager which handles saving the facet data.
- Because rendering is desired and this example does not save any data, create an instance of the INDEXED_MESH_MANAGER.
- Create or retrieve an ACIS model. This could be performed sooner or later in the process, but the model, obviously, must be available before attempting to facet its unfaceted entities.
- The mesh manager may be specified when faceting is initialized using the function api_initialize_faceter. It may also be set after initialization with the function api_set_mesh_manager. This is how the faceter is informed of which mesh manager is being used. For this example, call the api_set_mesh_manager function with a pointer to the mesh manager (for example, INDEXED_MESH_MANAGER).
- After faceting is initialized and a mesh manager specified, the application must specify some refinements. Environment default refinements are set using the function api_set_default_refinement, while individual refinements are set using the function api_set_entity_refinement.
Note: Refinements attached to a face take precedence over the refinements attached to their owning body.
- The application can send an entity or a list of entities to be faceted, using either function api_facet_entity or api_facet_entities, respectively. Each entity may be a body, a lump, a shell, or a face. Alternatively, one can choose to facet only those faces that have changed since they were last faceted, using the functions api_facet_unfaceted_entity or api_facet_unfaceted_entities. This is called incremental faceting. In this example, call the api_facet_unfaceted_entities function with a pointer to the entity list. The entity list comes from the ACIS model that was retrieved or created.
- At the end of an application or rendering section, the faceter should be turned off with a call to api_terminate_faceter.
The following figure shows the data flow during a faceting session:
- A REFINEMENT is created and attached to an ACIS entity using the attribute ATTRIB_EYE_REF_VT.
- The entity with or without the attached refinement is passed to the faceter. In case no refinements are attached to the entity default refinements are used for faceting.
- The application creates an instance of the MESH_MANAGER.
- The mesh manager creates a mesh for each face of the entity.
- If the mesh manager is an application defined class, the application can store mesh information into one of its data structures.
- The face entities and their meshes are coupled using ATTRIB_EYE_ATTACHED_MESH.
- The mesh manager instance goes away after faceting the face entities.
- The generated mesh is available to downstream operations, such as rendering.
- If the associated entities are deleted or the application terminates, the mesh goes away.
- The entities and their refinements can be saved and stored in an ACIS save file.
Figure. Data Flow among the Application, Faceter, and ACIS Modeler
Related topics:
Refinements
Mesh Managers
The Faceting Algorithm
Discarding or Keeping Facet Data
Faceting Functions and Classes
Faceting Using Scheme[Top]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All rights reserved.