3D PLM Enterprise Architecture

3D Visualization

Graphical Properties

How to use or implement the CATIVisProperties Interface
Technical Article

Abstract

The first objective of this article is to understand what are the graphical properties. The second is to explain how they are integrated in the visualization process. Three interfaces are important: CATIVisProperties, CATIVisu and CATIProperty. The first enables to associate with a feature a set of graphical properties, the second uses the CATIVisProperties interface to update the graphic attributes of the graphic representations, and the last stores the data. CATIVisProperties is the main interface of this system.


Principe of the Graphical Properties

Before to go into all the details, a little example to set the subject. Suppose a cube feature [Fig.1 ] which is composed of two types of geometry: faces (6) and edges (12). On this feature, for the set of faces and for the set of edges, graphical properties are put. For faces, it is possible to set a color, a degree of opacity and for the lines, a color, a type and a thickness. 

Fig.1: Graphical Properties on the Cube Feature

The principe of the graphical properties lies on the fact that an element (a feature) contains one or several sub-types. A sub-type is sorted by type of geometry: point, line, surfacic etc.... and for each sub-type a set of graphical properties is associated. To integrate them in the visualization process, there is three main interfaces: CATIVisProperties, CATIProperty et CATIVisu

Fig.2: Relationship Between the Three Interfaces

On this shema, you can see that:

You can notice that if the componant is not a feature, it can't have graphical properties because the CATIProperty is to use AsIs.

The Graphical Properties are Graphical Attributes

The graphical properties are visual properties, it means that the properties can be directly use by the visualization processus. These attributs, classified by storage way, are the following:

  1. The graphic attribute, the CATGraphicAttributeSet
  2. The "Using Graphic Attributes" [1] article enables to familiarize you with this class. 

  3. The Graphic Primitive, a CATGraphicPrimitive
  4. The marker of the point is set at the CAT3DMarkeGP or CAT2DMarkerGP construction class.

  5. Other:
  6. The number of the layer .

To specify the type of the graphical properties, there is the CATVisPropertyType enum.

At these values, an another one which doesn't represent a property but a set of properties: CATVPAllProperties.  

The data for the graphical properties (the color, the flag) will be write (read) on a CATVisPropertiesValues. It's detailed in the "Using CATIVisProperties" section.

The Types of Geometry

The information stored on the CATIVisProperties is the type (s) of geometry supported by the feature.

CATIA V5 supplies some types of geometry, those in relationship with the dimension of the sub-type are:

an another is for the assembling models:

At these five values, there is a last CATVPGlobalType. This type regroups together the graphical properties independant of the sub-types: the visibility state, the selectionnability state, the lowint color flag and the number of the layer. Actually in fact, it is not possible to set the points of a wire on a layer, and set its curves on an other layer. It is the globally the element which is on a layer. 

These six types, CATVPPoint, CATVPLine  ,CATVPEdge ,CATVPMesh, CATVPAsm  and CATVPGlobalType are CATVisGeomType

The Graphical Properties by Geometry Type

To associate graphical properties for a type of geometry, there is the CATVisPropertiesValues class. On an instance of this class, you set the color, the type of point and so on.

On the CATIProperty interface, a copy of this instance is stored. So, a priori, you can set any graphical properties for any type of geometry. But at last, only the graphic properties  interpretable by the process visualization are important. It means that you can set a degree of opacity for your lineic feature, but the visualization process could not translate that. The next section describes that.

Integration of the Graphical Properties in the Visualization Process

Generalites

In the visualization process, there are two cases to distinguish, even though they join together at the end. The total and the partial revisualization of the model. But at first, it is important to give the methods of the CATExtIVisu adapter class of the CATIVisu interface in relationship with the properties:

  1. The total revisualization of the model
  2. After the construction of the graphic representation (CATRep class), realized by the BuildRep method, the SetGraphicAttribut method is called. The default implementation of this method, those of the CATExtIVisu adapter class, calls successively (*) the following methods: 

    1. Method not exposed to process the independent properties of the sub-elements : visibility, selectionability, layer and lowint (CATVPGlobalType)
    2. SetPointGraphicAttribute (CATVPPoint)
    3. SetLineGraphicAttribute  (CATVPLine)
    4. SetMeshGraphicAttribute (CATVPMesh)
    5. SetEdgeGraphicAttribute (CATVPEdge)
    6. SetAsmGraphicAttribute (CATVPAsm)

    (*) These methods are called only if the type of geometry,  set in bracket in the previous list, is defined by the feature. 

    The SetGraphicAttribut method calls these methods with CATVPAllProperties as second argument. It means that all the graphical properties are set on the graphic representation for the given type of geometry.  

  3. The partial revisualization of the model
  4. After a CATModifyVisProperties notification, a partial revisualization of the model is done. In fact only the graphical properties are changed. This notification contains the type of the geometry and its new graphical properties. The ModifyRep analyzes the input's notification, and calls one of the six methods concerned by the type of geometry. The difference between the total revisualization is the second argument of these methods: it is not necessary CATVPAllProperties, but can be one of the CATVisPropertyType enumeration as CATVPColor for example. 

In the two cases, the process converges towards the same methods. Their goal is to modify the graphic representation (and their associated graphic attributes) in taken account of the graphic properties set on the CATVisPropertiesValues instance, the third argument of these methods. It is important to know what do they do in their default implementation, because if the default behavior doesn't fit your need, you will do reimplement those concerned by the type of geometry defined by your feature. See "Implementing CATIVisProperties". 

Before to detail them, we have described the second and the third argument of these six methods, there is still the first. It is a CATRep pointer which comes from the visualization process. Indeed, it is the graphic representation created in your BuildRep extension. 

Default Behaviors of the SetxxxGraphicAttribute methods

In short the Standard Graphical Properties by Type of Geometry

This section describes in table form [Tab.1] for each type of geometry, the graphical properties taken account by the CATExtIVisu methods that we have detailed just above. 

Tab.1: The Graphic Properties for Each Type of Geometry 
The type of the Geometry Graphic Properties 
CATVPGlobalType
  • Show/no show state
  • Number of  layer
  • Pick/no pick state
  • Lowint color state
CATVPPoint
  • Color
  • Symbol of the marker
CATVPLine

as edge

CATVPEdge
  • Color
  • Thickness
  • Linetype 
CATVPMesh
  • Color 
  • Degree of opacity
CATVPAsm
  • Inheritance
  • Color 
  • Degree of opacity
  • Linetype 
  • Thickness

Automation

In implementing the CATIVisProperties interface on your feature, you benefit automatically of the CATIAVisPropertySet automation interface . 

The interactive Commands

The Properties Command

If your feature implements CATIVisProperties, when you launch the Properties Commands, the Graphic tab page appears. Its contents depends on the type of geometry defined by the feature. There are three possible cases:

  1. In the case where the type of  geometry is  CATVPPoint and/or CATVPLine and/or CATVPEdge and/or CATVPMesh (with or without CATVPGlobalType):
  2. Fig.3: The Properties Dialog Box - Case 1

    This is a sample with a feature which are the types CATVPGlobalType and CATVPPoint. This page contains two frames:

  3. In the case where the type of  geometry is CATVPAsm (with or without CATVPGlobalType):
  4. Fig.4: The Properties Dialog Box - Case 2

    This is an example where the feature defined the types CATVPAsm and CATVPGlobalType. This page contains two frames:

  5. In the case where the type of  geometry is only CATVPGlobalType
  6. Fig.5: The Properties Dialog Box - Case 3

Only the "Show Pick and Layers" appears.

The Graphic Properties Toolbar

The Graphic Properties toolbar, [Fig. 6] is the following:

Fig.6: The Graphic Properties Toolbar

When a feature is selected, the toolbar is updated in taken account of the feature's properties. If several features are selected, the behavior is the following:

You can notice that in this toolbar, there is only one combo for each type of property. Assume that your feature defined the CATVPPoint and the CATVPLine types. These two types have in common the color property. So a choice must be done to define the type concerned by the color property. It is the goal of the GetSubTypefromPath method of the CATIVisProperties interface. This point will be detailed in the Implementing CATIVisProperties" section.

The Hide/Show Command

The Hide/Show command enables to hide or show the selected features. But to benefit of this functionality on your feature, it must implement the CATISelectShow  interface. It uses the CATIVisProperties to modify the visibility state of the feature.

[Top]

Using CATIVisProperties

If this section detailed the usage of the CATIVisProperties interface, the "Modifying Object Graphical Properties" article [3] exposes a concrete use case. 

This interface contains five main methods:

  1. GetPropertiesAtt(CATVisPropertiesValues & oValues, CATVisPropertyType iPropType, CATVisGeomType iGeomType )
  2. SetPropertiesAtt(CATVisPropertiesValues & iValues, CATVisPropertyType iPropType, CATVisGeomType iGeomType )

    The first retrieves the properties from the CATIProperty interface and the second modifies them on the CATIProperty interface

    These two methods function on the same principle: the property values are on the CATVisPropertiesValues instance and  two keys

    Example: Lets change the color (CATVPColor for the property type)  of a line (CATVPLine for the geometry type) represented by the pLine pointer.

    ...
    CATIVisProperties * pIVisPropertiesOnLine = NULL;
    HRESULT rc = pLine ->QueryInterface(IID_CATIVisProperties, (void **) & pIVisPropertiesOnLine );
    if ( SUCCEEDED(rc) )
    {
       CATVisPropertiesValues MyPropertyOnLine ;
       MyPropertyOnPoint.SetColor(255,0,0);
       rc = pIVisPropertiesOnLine ->SetPropertiesAtt(MyPropertyOnLine, CATVPColor ,CATVPLine ); 
    }                                                                                                 
    ...

    At first, the CATVisPropertiesValues instance, MyPropertyOnLine, is valuated with the color thanks to the SetColor method. Next calling the SetPropertiesAtt method modifies on the CATIProperty interface only the color of the line geometry because the second argument is CATVPColor and the third is CATVPLine

  3. ResetPropertiesAtt(CATVisPropertyType iPropType, CATVisGeomType iGeomType )

    This methods enables to invalidate the property set on the CATIProperty. It means that at the next GetPropertiesAtt calls, the returned properties values will be the standard values. The returned code of the GetPropertiesAtt method, S_AUTOMATIC, precises that the returned properties values is the standard. To set new specific properties, a new SetPropertiesAtt will be necessary.

    Example: Always with the line, pointed by  pIVisPropertiesOnLine, the color of the CATVPLine geometry type is reseted. 

    ...
    HRESULT rc = pIVisPropertiesOnLine ->ResetPropertiesAtt(CATVPColor ,CATVPLine);
    if ( SUCCEEDED(rc) )
    {
       CATVisPropertiesValues MyPropertyOnLine ;
       rc = pIVisPropertiesOnLine ->GetPropertiesAtt(MyPropertyOnLine, CATVPColor ,CATVPLine ); 
       if ( S_AUTOMATIC == rc ) 
       {
          
       }else cout <<" error" << endl;
    }                                                                                                 
    ...

    In this example, you can see that after the ResetPropertiesAtt call, for the same key CATVPColor and CATVPLine, the GetPropertiesAtt method returns the S_AUTOMATIC value. It means that the color sets on the MyPropertyOnLine instance, is the standard color, so the same value as those returned by the GetStandardProperties method with the same keys

    Note: if any SetPropertiesAtt call has been  done on the feature, it has standard values.

  4. GetStandardProperties(CATVisPropertiesValues & oValues, CATVisPropertyType iPropType, CATVisGeomType iGeomType )

    This method retrieves the standard properties. These values are the values managed by the CATIVisProperties implementation [Tab. 2] and are not the standard of creation that you can manage with the "Standards..." command. 

    Tab.2: The standard values for each type of property 
    The type of the property The standard value
    Color white (255,255,255)
    Symbol  Cross
    Thickness of a line 1
    Type of a line Solid
    Degree of opacity 0
    Number of the layer 0

    Caution: The contents of this table can be different between two implementations of the CATIVisProperties interface. The DS features, implementing the GetStandardProperties methods, have perhaps another standard values. Here the standard values defined by the CATExtIVisProperties methods are exposed. 

  5. IsGeomTypeDefined(CATVisGeomType iGeomType)
  6. Tells if  a given type of geometry is recognized by the feature.

[Top]

Implementing CATIVisProperties 

If this section detailed the implementation of the CATIVisProperties interface, the "Implementing CATIVisProperties" article exposes a concrete use case. You will find this article in the Product Process Resouce (PPR) part of the CAA encyclopedie.

To implement this interface you use the CATExtVisProperties adapter class. There are two methods to overwrite:

[Top]


In Short

This article describes how the graphic properties are integrated in the visualization process. The principle is that a feature can have a set of graphic properties for each of its component's geometry. Each component is defined as a geometry type. Three interface are essentials:

[Top]


References

[1] Using Graphic Attributes
[2] Creating Levels of Details
[3] Modifying Object Graphical Properties
[Top]

History

Version: 1 [Jun 2002] Document created
[Top]

Copyright © 2002, Dassault Systèmes. All rights reserved.