Working with User Features (UDFs):
Getting Started

User Features are used to encapsulate a geometric or technological
construct. In some cases, depending on the selected input, and especially in an
automation context, the User Feature may be in error, with no possibility
to determine what's wrong with it.
This section gives information concerning the following topics:
Designing a robust User Feature : Some Hints
- First of all, it is recommended to make a prototype of your User Feature
in a Power Copy. The latter is much more flexible. After defining the Power
Copy, it can be modified, whereas the first definition of the User Feature is
the last one because it cannot be modified. This way your design can be made
in several steps and you don't
have to start again from scratch. At instantiation, it is also easier to
handle possible troubles (update
.)
thanks to the visibility provided by the Power Copy features.
- If the User Feature embeds a sketch, this sketch has to be iso-constrained.
Thus, when instantiating the User Feature and making changes in its new
context, you will avoid uncontrolled modifications of the sketch geometry
that you won't
be able to manage because the User Feature is a "black box". For the
same reason, make sure that your sketch is "attached",
and for that, always use the creation of sketch "With
absolute axis definition".
This way, you are sure that the sketch is at the right position.
- If the User Feature embeds contextual geometrical items like a draft or a
fillet, it has to be resolved. It means that the base of their constructions
has to be embedded too and must not be considered as an input of the User
Feature. For example a fillet on the edge of a pad depends on the geometry of
the sketch of the pad. If this sketch is in input of the User Feature
and changes from square to round, the fillet inside the User Feature will be
broken and the User Feature will be in error.
- Don't
embed datum or geometrical elements with external links to other documents
(Copy\Paste as result with link).
Don't
try to embed a Body into a User Feature, it is impossible. Because a Body is
a package which can be empty or can contain Knowledge features for example.
Whereas a User Feature is a geometrical feature. To make it compliant,
you have to transform the Body into a geometrical feature with a boolean
operation like Assemble, Remove, Intersect
.
After this, you can select the boolean operation when defining the User
Feature and the associated Body is automatically embedded. To know what
can be embedded, see Getting Familiar With
Templates.

Using Conditional Geometry
To evaluate the environment of the User Feature (its inputs) and to make
decisions, Knowledge Advisor provides 3 main functionalities:
- Some measures (distance, angle, area, length, center of gravity,
)
that can be used to evaluate the inputs. For more information, see
Measures.
|
 |
Some geometric parameters that can be
valuated by other geometries. For more information, see
Point
Constructors,
Line
Constructors,
Circle
Constructors,
Direction Constructors,
Wireframe Constructors,
Plane
Constructors, and
Surface
Constructors. |
- If / then / else keywords allow you to choose how to validate those
geometric parameters depending on the measure results.
|
 |

Catching Errors
Usually, if an update error is raised inside a rule, the rule execution is
stopped and the rule sends an evaluation error message.
The Do not catch evaluation errors option
which is available by right-clicking the relation in the specification
tree and selecting the Properties command enables you: |
- To create features in error
- To know (through an error message) if a feature is in error and
- To make changes (or not) in case of errors.
|
 |
This capability can be used to perform a
geometric computation (like intersection) and to decide what to do if
there is no result. |
For more information, see Knowledge Advisor User's Guide.

Providing Explanations For Errors
It is possible to associate a .CATNls file with a User Feature type to
translate the names of its inputs, published parameters, outputs and multiple
valued parameters in different languages.
This file can be used to override the update error message: in this message,
you can provide explanations about how to avoid update errors. For more
information, see
Creating and
Instantiating a NLS User Feature (UDF).
Controlling the Orientation of User Feature Inputs
Defining an Object Type Based on a User-Defined Feature
Creating a NLS User Feature
Instantiating a User Feature From a Macro