GRIP Introduction | Declarations and Functions List

声明和函数

本主题涵盖了GRIP,用于定义和操作用户定义的变量的声明和功能。GRIP功能也处理提取物体和对象的属性进行数学运算。

这些声明和函数在本节已经定义:

 

GRIP声明用于定义和初始化用户定义的变量。变量有三种数据类型之一:ENTITY,NUMBER或STRING。数据声明用于初始化或程序的其余部分执行之前预设变量的值。声明必须在GRIP程序先于任何其他行的代码。

 

The GRIP functions perform operations which are not normally found in interactive Unigraphics. Functions do not, by themselves, create any objects; however, they can be invaluable in performing mathematical calculations needed to model geometry. Most GRIP functions follow the following format:

Major word(variable(s))

Some functions use scalars. Scalars are numerical values used to position the application of a function on a curve or a surface. For example, the CPOSF function returns the coordinates of a point at a distance along a curve. The distance is defined as a scalar value of the total length of the curve. To place the coordinate calculation on the curve, the scalar value must be between 0 and 1. Any value beyond the range of 0 to 1 places the calculation on the extensions of the curve. The format of a function using scalars is generally as follows:

Major word(object,scalar(s))

When data is returned from a function, like the CPOSF function above, it should be assigned to a variable. That variable must have the proper data type and contain enough positions or dimensions to handle the information. For example, the variable which is assigned the coordinates calculated by the CPOSF function must be declared as a three position numerical array. The format of this assignment is generally as follows:

NUMBER/variable(3)
Variable=major word(object,scalar(s))

该CPOSF功能会计算一个点的坐标沿着一条行,并将它们分配到一个数组,如下所示:

ENTITY/LN1,PT1
NUMBER/NUM(3)
LN1=LINE/0,0,4,3
NUM=CPOSF(LN1,.5)
PT1=POINT/NUM
PRINT/NUM
HALT

The above program displays the following output to the listing device:

2.0000,1.5000,.0000

and draws the following line and point.

Line and Mid Point Using CPOSF


Copyright ©2015 胡君NX二次开发官网(www.UGapi.com) QQ:85585969 All Rights Reserved.