Controlling the Orientation of User Feature Inputs  

The instantiation of a User Feature can provide an inconsistent result according to the orientation of the geometry of its inputs. This topic is designed to help those of you who want to manage the orientation of their User Feature inputs.

Controlling the Inputs Manually

When instantiating a User Feature manually, you can toggle the green direction arrow in the geometry to get the correct orientation. See example below.
  1. Open the PktManagingPlanes.CATPart file.

  2. From the Standard menu, select Insert > Instantiate from Document....

  3. In the File Selection window, select the PktPlaneUDF.CATPart file and click Open.

  4. The Insert Object dialog box is displayed. Select:

    • Plane.1=zx plane
    • Point.1=Point.1
    • Plane.2=xy plane
  5. Reverse the direction of the zx plane and xy plane and click OK when done. The User Feature is instantiated.

  6. Double-click UDF.1 in the specification tree. The Definition box of the User Feature is displayed. Note that even if the selected inputs are both planes, in the first case (Plane.1), the display shows the zx plane as selected, and in the second case (Plane.2), the display shows a new element (Inverse.1) which was created and inserted at instantiation. Click Cancel to exit the dialog box.

  7. Open the PktPlaneUDF.CATPart file and double-click the User Feature:

    • The input corresponding to Plane.1 is pointed by a Sketch: The orientation of Plane.1 is performed inside the Sketch feature. That is why the input is still the zx plane.
    • The input corresponding to Plane.2 is pointed by a surface feature (Extremum.1): To manage the orientation of surface features, an Inverse feature is created. That is why the input references Inverse.1.
  8. Go back to the PktManagingPlanes.CATPart file and double-click the UDF1.1.

  1. Select Plane.1 in the Definition box.

    Note that the orientation of the zx plane is not identical to the one you selected at instantiation. It is a default orientation for the input. If you click the corresponding arrow, you can modify this orientation to get the desired one.
   
  1. Select Plane.2 in the Definition box.

    Note that the orientation is the default one for the Inverse.1 feature. If you click the corresponding arrow, you can modify the orientation of the User Feature input. You will see then that the Inverse feature disappears or reappears depending on the direction of the arrow.

 

Controlling the Inputs Automatically

To avoid bad orientations when automating the instantiation of a User Feature (UDF) from Visual Basic or Business Process Knowledge Template, integrate control User Features that change the orientation of the geometry in the design of your User Features depending on your needs and on the rules you set.
In the example below, you want to create a multisection based on a UDF taking 2 lines in input. This UDF would be corrected whatever the orientation of the lines.

In the test case described below, you want to instantiate 2 multisections planes into a CATPart. This part contains 3 lines: 2 of them have the same orientation, the other one does not.

STEP 1: Creating the control UDF

PktCurveOrientation.CATPart. In this model, you have created a spline built on Point.1, Point.2, and Point.3. Point.4 and Point.5 are the spline ends (ratio 0 and 1). You can select the orientation of the line by valuating the StartPointNearReferenceSurface parameter. This parameter is driven by a rule (Rule.1). Point.6 is valuated by Point.4 and Point.5 through the parameter, the rule and the positioning of the points to the plane. Point.6 is the result of the UDF. The rule enables you to valuate Point.6 using the point that is the closest to the plane. The formula enables you to deduce Point.7 from Point.6.

You create the control UDF (Line) that will be instantiated. The following items are inserted into this UDF:

  • Line.1
  • Point.3, Point.4, Point.6, and Point.7.
  • Formula.1
  • Rule.1
  • StartPointNearReferenceSurface
Note that:
  • The StartPointNearReferenceSurface parameter is published
  • Point.6 and Point.7 are added to the Outputs of the User Feature

 

The inputs of the UDF will be a fill and a spline.

STEP 2: Instantiating the control User Feature and creating the multisections surface

PktRobustMultiSection.CATPart

The control User Feature created in the  PktCurveOrientation.CATPart file is going to be instantiated into this Part. In this file, both lines have an opposite direction.

This Part is made up of the following items:

  • Line.1 and Line.2
  • Plane.2 which is the plane used to orientate lines.

When instantiating the User Feature, the inputs selected in the geometry are Line.1 and Plane.2.

After instantiating the User Feature, you want to create a multisections surface. For this surface to be correctly created, both lines must have the same orientation.

In the graphic above, both lines have the same direction because one of them is constrained by the robust line. The surface can be created. The graphic above shows what would happen without robust UDF: The robust line is not instantiated and both lines have an opposite direction. The surface cannot therefore be created.

STEP 3: Creating a UDF based on the multisections surface

After creating the multisections surface, you create a User Feature that will embed the following items:
  • Multisections surface.1
  • Control_UDF
  • Plane.1
  • Point.1
  • Rule.1

STEP 4: Testing the Control UDF

PktMultiSectionTarget.CATPart: You instantiate the User Feature that you created. The control UDF controls the orientation of the line thanks to the embedded rule that drives the StartPointNearReferenceSurface parameter.

In the graphic above, both lines have the same direction because one of them is constrained by the User Feature. The surface can be instantiated twice. The graphic above shows what would happen without robust User Feature: the User Feature is not instantiated and both
lines have an opposite direction. The surface can be instantiated once because Line.2 and Line.1 have the same direction. But it cannot be instantiated another time because Line.1 and Line.3 don't have the same direction.