When to use CreateReference

Many CATIA automation functions or methods require parameters of the Reference type. The reference object is designed to unify the use of both exposed in automation objects and non-exposed objects, such as b-rep elements. A reference is made if a method is used as an input parameter. A Reference represents the Reference class, which is created with the CreateReferenceFrom methods of the part object class. The reference is then passed to an object to enable associativity with the referenced object.

For example, you could use the following method to create a new sketch:

Func Add (reference iPLane) As sketch

In the above example using sketch, the new sketch in CATIA might be created on a plane (plane object) or on a planar solid face (planarface object). Because these are two very different objects one option might be to have two functions to create a new sketch – one using plane object as parameter and another using planarface object as a parameter

Instead, the CATIA programmers set one function to create a new sketch that uses a unified parameter of the reference types and then to use methods to convert objects of various types to the Reference type.

To create a new sketch on xy plane:



What CreateReference to Use?

There are four ways to derive a reference:

  1. For geometry: CreateReferenceFromGeometry
  2. For objects: CreateReferenceFromObject
  3. For names: CreateReferenceFromName (string iobjectname) As Reference
  4. For Brep: CreateReferenceFromBRepName (string ilabel, any object icontext) as reference



CreateReferenceFromGeometry derives a reference from a geometry object such as a wireframe, surface, or solid. Example:



CreateReferenceFromObject is used when you have a single object pointing to another object. As an example, here’s how you would create references for objects used as inputs for a join operation:


As you can see, the Fill and the Extrude surfaces used as input for the Join are converted into references. This operation is required in order to use the objects as input for the Join. In fact, all objects used as input in IDL method interfaces are to be converted as references and passed in creation methods.



CreateReferenceFromName creates a reference to an object. This is seldom used unless you need a reference that points to nothing (if you need a reference but it won’t be determined until later).




A BREP is a boundary representation object such as a point, edge, vertex, or face of a geometric element.  If a reference to part of geometry (or brep) is needed:




The name of the object referenced by a reference can be determined with the Display Name property: Reference.DisplayName. It returns the name of the referenced object. The name of the referenced object is either the name displayed in the specification tree for a GeometricElement object or a character string defining the reference for a boundary object.  For example, the following returns in StrName the displayable name of reference FirstRef:

StrName = FirstRef.DisplayName

Hopefully this has cleared up some of the confusion about when to use CreateReference. As always, if you have any questions please post them on the forum.

Add a Comment

Your email address will not be published. Required fields are marked *