Attributes   

<<< Attribute Definitions Chapters Introduction to Rendering and Faceting >>>

Contents

[back to top]


47.1 Introduction

Attributes are used to supplement the Parasolid data structure by attaching additional data to Parasolid entities. An attribute has properties, specified in an attribute definition, which define

The following types of information can be stored in fields (the corresponding field type is shown in brackets):

[back to top]


47.2 Attributes

An attribute is created by specifying the attribute definition and the entity to which it is attached. The attribute can only be attached to entities of the classes specified in its attribute definition. At this stage the attribute fields are empty.

Each field of the attribute can then be set and enquired, and each field can hold any number of items of data of the appropriate type (except string fields, which can only hold a single string):

 

    Performance issue: If data is to be attached to most entities in a session, user fields may be more efficient and appropriate than attributes.

Refer to the "User fields" section in Chapter 58, "Session Support", for a comparison of attributes and user fields.

[back to top]

47.2.1 Attribute processing

Creating an empty attribute

PK_ATTRIB_create_empty is used to create a new attribute. This is attached to the specified entity (as given by PK_ATTRIB_ask_owner) and has the given attribute definition (PK_ATTRIB_ask_attdef), but does not contain any data.

Adding to and retrieving data from attribute fields

A number of functions are available to write an array of data into an attribute field of a given type, and to retrieve that data. The functions that you need to use depend on whether the attribute uses named or numbered (i.e. non-named) fields.

The following functions let you write into or read from a numbered field. These functions can also be used on named fields, provided you know the order in which the fields are defined in the attribute definition.

 

Write into a field Read a whole field Read the n'th entity in a field

PK_ATTRIB_set_axes

PK_ATTRIB_ask_axes

PK_ATTRIB_ask_nth_axis

PK_ATTRIB_set_doubles

PK_ATTRIB_ask_doubles

PK_ATTRIB_ask_nth_double

PK_ATTRIB_set_ints

PK_ATTRIB_ask_ints

PK_ATTRIB_ask_nth_int

PK_ATTRIB_set_string

PK_ATTRIB_ask_string

(not applicable)

PK_ATTRIB_set_ustring

PK_ATTRIB_ask_ustring

(not applicable)

PK_ATTRIB_set_vectors

PK_ATTRIB_ask_vectors

PK_ATTRIB_ask_nth_vector

PK_ATTRIB_set_pointers

PK_ATTRIB_ask_pointers

PK_ATTRIB_ask_nth_pointer

The following functions let you write into or read from a named field. You should not use these functions on non-named fields.

 

Write into a named field Read a whole named field

PK_ATTRIB_set_named_axes

PK_ATTRIB_ask_named_axes

PK_ATTRIB_set_named_doubles

PK_ATTRIB_ask_named_doubles

PK_ATTRIB_set_named_ints

PK_ATTRIB_ask_named_ints

PK_ATTRIB_set_named_string

PK_ATTRIB_ask_named_string

PK_ATTRIB_set_named_ustring

PK_ATTRIB_ask_named_ustring

PK_ATTRIB_set_named_vectors

PK_ATTRIB_ask_named_vectors

PK_ATTRIB_set_named_pointers

PK_ATTRIB_ask_named_pointers

For more information on creating attribute definitions with named fields, see Section 46.2.1, "Using named fields".

Enquiries about attributes

 

Function Description

PK_ENTITY_ask_attribs

Retrieve all attributes on an entity

PK_ENTITY_ask_first_attrib

Retrieve a single attribute

PK_ENTITY_delete_attribs

Delete the attributes from an entity

 

Function Description

PK_PART_ask_all_attribs

Get all attributes anywhere in the part

PK_PART_ask_attribs_filter

Return all attributes on part with given definition and contents

PK_PART_ask_attrib_owners

Return owning entities of attributes in part with given definition and contents

PK_TOPOL_ask_entities_by_attdef

Return the entities of a body with or without a particular attribute

[back to top]


47.3 The effect of modeling operations on attributes

Attributes can be moved between entities, modified, or deleted, as a result of modeling operations. The effects of these operations on an attribute first depend on whether the attribute definition has any normal callback functions registered.

[back to top]

47.3.1 Processing an attribute with a registered callback function

A callback is invoked if:

In the case of normal callbacks, the callback function is invoked instead of the normal Parasolid attribute processing.

In the case of read-only callbacks, the callback function is invoked and Parasolid attributes are processed as normal.

Attribute callback functions are described in the "Callback functions" section in Chapter 46, "Attribute Definitions".

[back to top]

47.3.2 Processing an attribute without a registered callback function

If a callback function is not invoked, the normal Parasolid attribute processing is applied. The remainder of this chapter deals with this process, which depends on:

[back to top]


47.4 Events and how they affect attributes

You can think of high level modeling operations (booleans, local operations, blending, etc.) as a succession of primitive modeling operations, or events, applied to individual entities. The behavior of an attribute under a modeling operation is the composite of the elementary effects of those events that are applied to the entity to which it is attached.

The following section describes the events and what effects they may have on an attribute attached to a topological entity to which the operation is applied. The effects vary according to the class of the attribute's definition, and whether attribute callbacks have been registered.

 

Note: These effects are not applied to attributes attached to geometrical entities.

Callback functions and classes

The detailed effects explained in this section are the result of the normal Parasolid attribute processing. However, some events may cause a callback function to be invoked instead.

When normal callbacks are registered for an attribute definition, these callback functions override the existing behavior of an attribute, which is currently defined by the class of the attribute.

When read-only callbacks are registered for an attribute definition, then normal attribute processing takes place, and the read-only callback is invoked as well.

If callbacks are only registered for some of the events, then the behavior of attributes during events that do not have callbacks registered continues to be defined by the attribute's class.

Tracking the default behavior of attributes

To determine how attributes that are involved in modeling operations are affected by these operations, proceed as follows:

Chapter 57, "Bulletin Board", explains how to log and output the events which have been applied to entities.

[back to top]

47.4.1 Transformations

An entity may be transformed, in which case all the entities that the model regards as part of it (the surface of a face, the edges of a body etc.) are likewise transformed. The effects of a transformation depend on its decomposition into these four primitive transformation types:

Each type of transformation may independently be applied to, have no effect on, or cause deletion of, an attribute attached to the entity transformed.

 

Note: If the transformation of an entity has any effect on it other than simply moving it (for example, if the surface of a face in a solid body is transformed and the edges and vertices have to be recalculated) then the change event is applied instead of the transformation event.

When a transformation is applied to an attribute, it affects each field in a manner which depends on the field type; only the four geometric field types (vector, direction, coordinate and axis) are affected, and each of these transform differently. To determine the effect of a complex transformation it is necessary to decompose it into a combination of primitive transformations and look at their individual effects on the various field types, which are as follows:

[back to top]

47.4.2 Split

A topological entity or a group may be copied, or be split into two or more entities of the same class. When an entity is split, each attribute on it is either deleted or propagated to both the resulting entities.

 

Note: This does not occur in blending as a new face is created, in preference to splitting adjacent faces, therefore there is no propagation.

Examples:

  1. A face may be split by a Boolean, scribing, or a local operation.
  2. A sheet or solid body created from a face of another body receives copies of any attributes on that face.
  3. Attributes attached to the target body involved in an Boolean subtraction or section operation are subject to the primitive operation split; however, attributes attached to tool bodies, and the bodies themselves, are deleted.
  4. Alternatively, splitting an entity may invoke a callback function for attributes attached to it.

    [back to top]

    47.4.3 Merge

    Two topological entities of the same class may be merged to form one. During a merge operation, an attribute with the same definition on each of the two entities may be deleted, or it may be kept if the attributes are equal, or they may all be kept. The effect depends on whether the class of attribute allows multiple copies, as follows:

    Examples:

    1. Two faces may be merged by removing a redundant edge between them, or two edges by removing a redundant vertex.
    2. When a body is involved in an Boolean unite or intersection operation the effect on attributes attached to the body is the primitive operation merge, possibly in combination with change.
    3. Alternatively, merging an entity may invoke a callback function for attributes attached to it.

      [back to top]

      47.4.4 Transfer

      An entity may be transferred from one part to another, into a part or out of a part. For example, shells, faces, loops, etc., may be transferred between bodies during a Boolean. Note that when geometry is transferred out of a part but not into another it ceases being a legitimate owner of attributes and so loses all its attributes. Other than this, transferring an entity may cause attributes attached to it to be deleted or left as they are.

      Example:

      An operation such as a Boolean may have no effect on a face or edge except to transfer it from one part to another.

      [back to top]

      47.4.5 Creation/deletion

      Entities may be created and deleted, either directly by a call to Parasolid requesting creation or deletion of the entity, or indirectly. For example, when a Boolean is performed many entities may be created or deleted. A newly created entity (i.e. not split from an existing entity) has no attributes. Deletion of an entity deletes any attributes attached to it.

      Examples:

      1. When an entity is deleted in a merge operation, such as an edge removed by merging two faces, any attributes attached to it are also deleted.
      2. Blending an edge deletes the edge and all attributes attached to it.
      3. Alternatively, copying or deleting an entity may invoke a callback function for attributes attached to it.

        [back to top]

        47.4.6 Change

        An entity may be changed in some other way. The change event is, in effect, any change not expressible in terms of the other events. It either causes the attributes on the changed entity to be deleted or it has no effect on them.

        Examples:

        1. Any topological changes to entities in a body (caused by blending, local operations etc.) produce the change event on attributes attached to the body itself, and on attributes attached to any adjoining entities modified by the operation (e.g. faces which shared a vertex with a blended edge).
        2. Any change to the geometry of an entity (face, edge or vertex) produces the change event on attributes attached to that entity, and to adjoining entities which are affected (for example, replacing the surface of a face or curve of an edge).
        3. When a body is reflected, the reflection induces a change of handedness (what was on the left is now on the right) on all topological relationships between entities in the body, therefore all topological entities in the body experience, in addition to the transformation event (reflection), a change event.
        4. [back to top]

          47.4.7 Transmit

          Transmitting an entity may invoke a callback function for attributes attached to it.

          [back to top]

          47.4.8 Receive

          Receiving an entity may invoke a callback function for attributes attached to it.

          [back to top]

          47.4.9 Other changes to topology

          Face sense

          It should be noted that a change of face sense does not by itself induce an event - the attributes attached to a face are not affected if simply the face sense is reversed. However, the attributes are likely to be affected by the operation that caused the reversal.

          Example:

          Subtracting a cylindrical body from a block creates a cylindrical hole in the block with the sense of the cylindrical face reversed (in which case, attributes attached to the cylindrical face are affected as described in the section "Combining events" below)

          [back to top]


          47.5 Classes and the effect of modeling operations on attributes

          The following table shows a summary of the normal processing which Parasolid applies to an attribute, when normal callbacks are switched off. If switched on, normal callbacks replace this behavior. For a description of each of the attribute definition classes listed below, see Section 46.2.4, "Classes of attributes".

           

          Class Event Effect on Attributes
          1

          Reflection, Rotation, Translation, Scaling, Transfer, Change

          No effect

          Split

          Propagate

          Merge

          Keep if equal

          2

          Rotation, Translation

          No effect

          Reflection, Scaling, Split, Merge, Transfer, Change

          Deleted

          3

          All

          Deleted

          4

          Reflection, Rotation, Translation, Scaling

          Applied

          Split

          Propagated

          Merge

          Keep if equal

          Transfer, Change

          No effect

          5

          Rotation, Translation, Scaling

          Applied

          Reflection, Split, Merge, Transfer, Change

          Deleted

          6

          Reflection, Rotation, Translation, Scaling, Transfer, Change

          No effect

          Split

          Propagate

          Merge

          All retained

          7

          Reflection, Rotation, Translation, Scaling

          Applied

          Split

          Propagated

          Merge

          All retained

          Transfer, Change

          No effect

          [back to top]

          47.5.1 Combining events

          Many high-level modeling operations result in multiple events being applied to entities affected by an operation. The effect on attributes attached to these entities is a combination of the effects of each event.

          For example, if the following operations have any effect on a face or an edge, they do so as a combination of the split, transfer and change events:

          • sectioning a body where the face or edge is affected
          • Boolean operations (intersect, unite and subtract bodies) where the face or edge is affected
          • scribing a line onto a face where the edge is affected

          These operations result in the deletion of attributes of class 2, 3 or 5 on the face or edge, while attributes of class 1, 4, 6 and 7 are preserved, and propagated to any new faces or edges split off from the original.

          [back to top]

          47.5.2 Modeling operations and attributes attached to geometry

          Attributes can be attached to geometric entities (points, curves and surfaces) which are themselves attached to topology (even if only as construction geometry). However, this is only permitted for attributes of class 1, 4, 6 and 7. Such attributes are only affected by deletion of the attribute or the geometry owning it, or by overwriting with a new attribute of the same definition. No other modeling operations affect an attribute attached to a geometric entity.

          Geometric entities, i.e. points, curves and surfaces, can only own attributes if they themselves are owned by a part, i.e. if they are either construction geometry for that particular part or if they are the geometry of some corresponding topological entity, e.g. vertex, edge or face respectively. Thus it is not possible to attach attributes to orphan geometry and if geometry with attributes attached to it is transferred out of a part but not into another, it loses its attributes.

          [back to top]

          47.5.3 Modeling operations and attributes attached to groups

          The effect of modeling operations on attributes attached to a group depends on the classes of the entities in the group. There is a simple algorithm that can be used to determine the effect of a given modeling operation on an attribute attached to a group:

          • imagine that a copy of the attribute is attached to each entity in the group
          • use the rules above to determine the effect of the operation on each of these copies of the attribute
          • if all the copies survive and end up with the same value, then the original survives and has this value; otherwise it is deleted

           

          [back to top]

          <<< Attribute Definitions Chapters Introduction to Rendering and Faceting >>>