Exercise– Creating a User-Defined Feature (UDF) with Knowledge Fusion Rules For this tutorial, we will use Knowledge Fusion rules to drive a UDF. We will also use Knowledge Fusion to customize a UDF menu. Step 1Create UDF part file. 1. Create a new part file, using File—>New, and name it udf_rule.prt. 2. Choose MB3—>Orient View—>Trimetric in the graphics window, setting the trimetric view the object being developed. 3. Choose Application—>Modeling. Step 2Create a spline for reference surface 4. Choose Insert—>Curve—>Spline—>Through Points. 5. Leave the default values for the spline creation and select OK 6. Select Point constructor and enter in the following points: Point1 X = 8 Y = -2 Z = 14 Point2 X = 8 Y = 1 Z = 11 Point3 X = 8 Y = 3 Z = 7 Point4 X = 8 Y = 0 Z = 0 Step 3Create reference surface. 7. Choose Insert—> Form Feature—>Extrude 8. Pick the spline for the section string 9. Select Direction and Distance 10. Accept the default direction 11. Enter in –10 for the Start Distance and 10 for the End Distance and choose OK to create the surface. Step 4Name the Face. Knowledge Fusion can reference native Unigraphics geometry by name. By naming the face, we will be able to reference this face in Knowledge Fusion without having to adopt it in. 12. Choose Format—>Attribute—>Name—>Assign 13. Select Type—>Face in the class selection menu 14. Select the face and choose OK 15. Enter in front for the name 16. Select OK for the Max. Value a. To view the name, Select Preferences—>Visualization—>Names/Borders b. Turn on View of Definition Step 5Create Knowledge Fusion Rules 17. Display the Knowledge Fusion Navigator · Choose View—> Knowledge Fusion Navigator 18. Create the following Knowledge Fusion attributes under root using Add Attribute in the Knowledge Fusion Navigator: Table 1 – Input and Men Parameters | | | | | | | | | | | | | | | | | | | | | | | | | | | | | {RotationAngle,ProjectionVector,Origin,FaceName} |
NOTE: Make all of the attributes listed in Table 2 uncached. This is needed to ensure that the plane updates when the surface geometry is modified. To make an attribute uncached, select the uncached toggle at the bottom of the Add Attribute menu. Table 2 - Rules | | | | | UG_refObjectByName(facename:, {ug_face}, ""); | | | ug_face_askPointParametersAtPoint(first(FaceSelection,Origin:,projection_vector,projectionvector; | | | ug_face_askPointOnFace(first(FaceSelection,LocatorOnSurface; | | | ug_face_askNormal(first(FaceSelection,LocatorOnSurface; | | | RotateVector(vector(-1,0,0); RotationAngle:; FaceNormal; | | | RotateVector(x:; -90; FaceNormal; |
NOTE: To create a menu item, a string attribute with the name of the attribute followed by “_label” is needed. This attribute will set the name label shown in the UDF menu. The “input_parameters” list attribute defines the UI objects (fields) that will be displayed in the menu. For example, to create the menu shown in Figure 1, the following attributes are needed (Do not create the following attributes in your exercise, they are just an example): Table 3 – Menu Example 。。。 |