Mechanical Design |
Assembly Design |
Creating a Fix Constraint in an AssemblySet an absolute position to an assembly component |
Use Case |
AbstractThis article discusses the CAACreateCstInAssembly use case. This use case explains how to create an assembly fix constraint in a CATProduct document. |
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]
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:
A fix constraint is a geometrical relation created on one component only.
Fixing a component means preventing this component from moving from its
parent component during the update operation.
Note that it means fixing its position according to the geometrical origin
of the assembly.
The constrained component must be child component of the active component.
[Top]
Two components can be seen on the picture, here two mechanical parts:
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]
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:
e:>CAAAuiCreateCstInAssy InputDirectory\Fix.CATProduct |
$ CAAAuiCreateCstInAssy InputDirectory/Fix.CATProduct |
where:
InputDirectory |
The directory into which Fix.CATProduct is stored |
[Top]
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]
There are three main steps in CAAAuiCreateCstInAssy:
We will now comment each of those sections by looking the code.
[Top]
A CATProduct document is loaded in session. This is described in the Product Structure use cases [1].
[Top]
::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]
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]
This use case has demonstrated the way to constraint the components of an assembly, create a connector and a constraint.
[Top]
[1] | Browsing a Product Structure |
[2] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [Jan 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.