青华模具培训学校

 找回密码
 注册

QQ登录

只需一步,快速开始

青华模具培训学院
查看: 1498|回复: 0

[原创] Exercises

[复制链接]
发表于 2012-5-5 15:53 | 显示全部楼层 |阅读模式
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 1
Create 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 2
Create 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 3
Create 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 4
Name 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 5
Create 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
Name
Type
Formula
RotationAngle
Number
0
ProjectionVector
Vector
vector(0,-1,0)
Origin
Point
point(4,7,7)
FaceName
string
"front"
RotationAngle_label
String
"Angle"
ProjectionVector_label
String
"Vector"
Origin_label
String
"Origin"
FaceName_label
String
"Face Name"
input_parameters
List
{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
Name
Type
Formula
FaceSelection
list
UG_refObjectByName(facename:, {ug_face}, "");
LocatorOnSurface
list
ug_face_askPointParametersAtPoint(first(FaceSelection,Origin:,projection_vector,projectionvector;
PointOnFace
Point
ug_face_askPointOnFace(first(FaceSelection,LocatorOnSurface;
FaceNormal
Vector
ug_face_askNormal(first(FaceSelection,LocatorOnSurface;
x
Vector
RotateVector(vector(-1,0,0); RotationAngle:; FaceNormal;
y
Vector
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
Name
Type
Formula
Name
Name
MyName
Name_label
String
“Name:”
Input_parameters
List
{Name}
QQ截图20120505155831.png
QQ截图20120505155845.png
。。。
exercise_udf_rules.pdf (166.21 KB, 下载次数: 6)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|关于我们|sitemap|小黑屋|Archiver|手机版|UG网-UG技术论坛-青华数控模具培训学校 ( 粤ICP备15108561号 )

GMT+8, 2024-11-26 07:35 , Processed in 0.161539 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表