NX二次开发UF_MODL_create_rpo_constraints 函数介绍

127 阅读3分钟

UF_MODL_create_rpo_constraints

Defined in: uf_modl_ugopenint.h 
int UF_MODL_create_rpo_constraints(tag_t feature_obj_id, tag_t horz_dir_obj_id, tag_t vert_dir_obj_id, tag_t obj_id_target [ ] , int target_qualifier [ ] , tag_t obj_id_tool [ ] , int tool_qualifier [ ] , char * constraint_value [ ] , char * constraint_array [ ] , int num_of_constrnts )

overview 概述

Creates relative positioning constraints.

This function is for internal Open API mode only. Parameters target_qualifier[] and tool_qualifier[] allow settings for specifying which end point of an edge to use. Use UF_MODL_ask_edge_verts to determine the order of the end points.

For features that are automatically booleaned into the target, this function should only be called from within a rpo routine as specified by UF_MODL_register_rpo_routine.

There are three constraint types that are present interactively that do not appear in the constraint_array[ ]: Point Onto Point, Point Onto Line, and Line Onto Line.

Point Onto Point - Can require one or two constraint types depending on what you constrain. For example, to constrain a circular pad onto a circular cylinder, use PARA_DIST_PARMS and set the constraint value to "0.0". However, if you wish to constrain rectangular features you may need to use HORZ_DIST_PARMS and VERT_DIST_PARMS and set both constraint values to "0.0".

Point Onto Line - Use PERP_DIST_PARMS and set the constraint value to "0.0".

Line Onto Line - Use PARA_EDGE_PARMS and set the constraint value to "0.0"

When a target or tool edge is an arc, the position must be qualified as either the arc center or the closest tangency point on the arc. When the edge is not an arc, the position must be qualified as either the first or last endpoint of the edge.

Some features can be positioned using the centerline of the feature. You may use the centerline of a feature by passing in a NULL_TAG as the tool edge. The centerline must be qualified as either the horizontal or vertical centerline, using the first or last endpoint. The following features allow the centerline to be used as a tool edge: Slot, Groove, Rectangular Pad, Rectangular Pocket. The Groove feature has only a vertical centerline.


创建相对定位约束。此函数仅用于内部开放 API 模式。参数 target _ 修饰符[]和 tool _ 修饰符[]允许设置用于指定要使用的边缘的哪个端点。使用 UF _ MODL _ ask _ edge _ verts 确定端点的顺序。对于自动导入到目标中的特性,只能从 UF _ MODL _ register _ rpo 例程指定的 rpo 例程中调用该函数。交互式存在的约束类型有三种,它们没有出现在約束 _ array []中: Point Onto Point、 Point Onto Line 和 Line Onto Line。点到点-可能需要一个或两个约束类型取决于您的约束。例如,若要将圆形衬垫约束到圆柱体上,请使用 PARA _ DIST _ PARMS 并将约束值设置为“0.0”。但是,如果您希望约束矩形特性,可能需要使用 HORZ _ DIST _ PARMS 和 VERT _ DIST _ PARMS,并将两个约束值都设置为“0.0”。使用 PERP _ DIST _ PARMS 并将约束值设置为“0.0”。直线到直线-使用 PARA _ EDGE _ PARMS 并将约束值设置为“0.0”当目标或工具边缘为圆弧时,该位置必须限定为圆弧中心或圆弧上最接近的切点。当边缘不是圆弧时,位置必须限定为边缘的第一个端点或最后一个端点。一些特性可以使用特性的中心线定位。您可以通过传入一个 NULL _ TAG 作为工具边缘来使用特性的中心线。使用第一个或最后一个端点,中心线必须限定为水平或垂直中心线。以下特性允许将中心线用作工具边缘: 槽,槽,矩形垫,矩形口袋。Groove 特性只有一个垂直的中心线。

UFUN例子

获取源码例子请搜索 里海NX二次开发3000例专栏

parameters 参数

tag_tfeature_obj_idInputFeature to be constrained
要约束的特征
tag_thorz_dir_obj_idInputHorizontal direction.
水平方向。
tag_tvert_dir_obj_idInputVertical direction (if horz_dir_obj_id == 0).
垂直方向(如果 horz _ dir _ obj _ id = = 0)。
tag_tobj_id_target [ ]InputArray of target edges.
目标边缘数组。
inttarget_qualifier [ ]InputArray of flags used to qualify the position on each target edge. Valid flags are: UF_MODL_ARC_CENTER UF_MODL_ARC_TANGENT UF_MODL_ENDPOINT_1 UF_MODL_ENDPOINT_2
用于限定每个目标边缘上的位置的标志数组。有效标志是: UF _ MODL _ ARC _ CENTER UF _ MODL _ ARC _ TANGENT UF _ MODL _ ENDPOINT _ 1 UF _ MODL _ ENDPOINT _ 2
tag_tobj_id_tool [ ]InputArray of tool edges (NULL_TAG for centerline).
刀具边缘数组(中心线为 NULL _ TAG)。
inttool_qualifier [ ]InputArray of flags used to qualify the position on each tool edge. Valid flags are: UF_MODL_ARC_CENTER UF_MODL_ARC_TANGENT UF_MODL_ENDPOINT_1 UF_MODL_ENDPOINT_2 UF_MODL_HORZ_CENTERLINE_PNT_1 UF_MODL_HORZ_CENTERLINE_PNT_2 UF_MODL_VERT_CENTERLINE_PNT_1 UF_MODL_VERT_CENTERLINE_PNT_2
用于限定每个工具边缘上的位置的标志数组。有效标志是: UF _ MODL _ ARC _ CENTER UF _ MODL _ ARC _ TANGENT UF _ MODL _ ENDPOINT _ 1UF _ MODL _ ENDPOINT _ 2UF _ MODL _ HORZ _ CENTERLINE _ PNT _ 1UF _ MODL _ HORZ _ CENTERLINE _ PNT _ 2UF _ MODL _ CENTERLINE _ PNT _ 1UF _ MODL _ VERT _ CENTERLINE _ PNT _ 2
char *constraint_value [ ]InputArray of constraint values.
约束值数组。
char *constraint_array [ ]InputArray of constraint type: "ANGL_EDGE_PARMS", "HORZ_DIST_PARMS", "VERT_DIST_PARMS", "PARA_DIST_PARMS", "PARA_EDGE_PARMS" , "PERP_DIST_PARMS"
约束类型的数组: “ ANGL _ EDGE _ PARMS”、“ HORZ _ DIST _ PARMS”、“ VERT _ DIST _ PARMS”、“ PARA _ DIST _ PARMS”、“ PARA _ EDGE _ PARMS”、“ PERP _ DIST _ PARMS”
intnum_of_constrntsInputNumber of constraints.
约束数量。