Mechanical Design

Assembly Design

Creating a Fix Constraint in an Assembly

Set an absolute position to an assembly component
Use Case

Abstract

This article discusses the CAACreateCstInAssembly use case. This use case explains how to create an assembly fix constraint in a CATProduct document.


What You Will Learn With This Use Case

This use case is intended to help you make your first steps in programming with CATIA Assembly Design.
Its main intent is to create geometrical relations between products. More specifically, you will learn how to:

Before getting to the use case itself, it is important to get an understanding of some of the Product Structure concepts that are at the heart of the Assembly Design.

[Top]

The CAAAuiCreateCstInAssy Use Case

CAAAuiCreateCstInAssy is a use case of the CAAAssemblyUI.edu framework that illustrates CATAssemblyInterfaces framework capabilities.

Before discussing the use case, some main concepts have to be introduced:

[Top]

What Does CAAAuiCreateCstInAssy Do

Click the image to reset it

This is a typical CATIA V5 work session with the Assembly Design application. A product is currently being edited.
Click the following links to display the image relative to. Click the image to reset it.

Two components can be seen on the picture, here two mechanical parts:

  1. Jack_Frame
  2. Jack_Branch_3

These components are the child components of the root product Fix which is also the active component. The active component Fix is a selected component currently being edited and it is blue framed in the specification tree.

Constraints can be applied between the child components of the active component Fix.
Constraints appear in the specification tree at the same level as the child components and they are displayed in the geometry.

These concepts are the counterpart, on the programming side, of what the end users sees and manipulates on the screen. So we will start with the end user view in order to infer what the program manipulates inside.

[Top]

How to Launch CAAAuiCreateCstInAssy

To launch CAAAuiCreateCstInAssy, you will need to set up the build time environment, then compile CAAAuiCreateCstInAssy along with its prerequisites, set up the run time environment, and then execute the use case [2].

Launch the use case as follows:

where:

InputDirectory The directory into which Fix.CATProduct is stored

[Top]

Where to Find the CAAAuiCreateCstInAssy Code

The CAAAuiCreateCstInAssy use case is located in the CAAAuiCreateCstInAssy.m module of the CAAAssemblyUI.edu framework:

Windows InstallRootDirectory\CAAAssemblyUI.edu\CAAAuiCreateCstInAssy.m\
Unix InstallRootDirectory/CAAAssemblyUI.edu/CAAAuiCreateCstInAssy.m/

where InstallRootDirectory is the directory where the CAA CD-ROM is installed.

[Top]

Step-by-Step

There are three main steps in CAAAuiCreateCstInAssy:

  1. Loading a Product Document in Session
  2. Creating a Connector
  3. Creating a Constraint

We will now comment each of those sections by looking the code.

[Top]

Loading a Product Document in Session

A CATProduct document is loaded in session. This is described in the Product Structure use cases [1].

[Top]

Creating a Connector

::GetProductConnector(pGeometry,
                      pInstanceComponent,
                      pActiveComponent,
                      0,
                      pConnector,
                      iCreation);

The GetProductConnector global function is used to create a connector on a component instance.

pGeometry The geometry you want to reference, this geometry must be linkable to ensure its stability during sessions.
pInstanceComponent The component instance containing the geometry above.
pActiveComponent The active component, it allows user to define the reference component document which content the constraints to be created.
0 The searching mode: creates connector if not found
pConnector The resulting feature
iCreation 0: the connector already exists and has been found,
1: the connector has been created.

[Top]

Creating a Constraint

rc = ::CreateConstraint(catCstTypeReference,
                        ConnectorList,
                        NULL,
                        pActiveComponent,
                        pCst);

The CreateConstraint global function is used to create a constraint on/or between component instances.

catCstTypeReference The constraint's type you want to create: fix constraint.
ConnectorList The list which contains the connectors involved in the constraint.
NULL The constraint's value. For angle or offset constraints only.
pActiveComponent The active component.
pCst The resulting feature.

[Top]


In Short

This use case has demonstrated the way to constraint the components of an assembly, create a connector and a constraint.


[Top]

References

[1] Browsing a Product Structure
[2] Building and Launching a CAA V5 Use Case
[Top]

History

Version: 1 [Jan 2000] Document created
[Top]

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