NX二次开发UF_MODL_replace_features 函数介绍

129 阅读4分钟

UF_MODL_replace_features

Defined in: uf_modl.h 
int UF_MODL_replace_features(tag_t * original_features, int n_original_features, tag_t * replacement_features, int n_replm_features, logical return_map, logical use_copy_of_replacement, UF_MODL_replace_features_t * * parent_map, int * n_parent_map )

overview 概述

This function replaces the features in original_features[] by the features in replacement_features[] or the copies of features in replacement_features[] if original_features[] are features on bodies, curve features and datum features. The children of the original_features[] will be reparented to the replacement_features[] or copies.

The original features will be deleted.

original_features[] can contain: features on the same body, curve features, datum plane and datum axis features.

replacement_features[] must contain: features on other bodies (if original_features[] contains features on a body), other curve features (if original_features[] contains curve features) and other datum plane and other datum axis features (if original_features[] contains datum plane or datum axis features).

Note that original_features[] and replacement_features[] must contain features that are in the same part file. Also, for features on a body, the parents of each of the features in replacement_features[] must be either another feature in the replacement_features[] or must be a feature which is before the earliest feature in the original_features[].

parent_map[] maps entities created by the original_features[] to the corresponding entities on the replacement_features[]. In addition to the original_features[] and replacement_features[] you will have to provide a map of edges and faces on the original_features[] to the corresponding edges and faces of the replacement_features[].

You will specify the map as a array of objects of type UF_MODL_replace_features_t described below. The children of the original_features[] will be reparented to copies of the corresponding entities on the replacement_features[] that are specified in the parent_map[].

Calling this function with return_map as true does not perform the replacement but returns a parent_map[] each of whose original_entity elements are edges and faces created by original_features[]. Only those edges and faces that are parents of downstream features are returned in the parent_map[]. The replacement_entity elements of all the structures in the parent_map[] are 0. You will have to assign the appropriate replacement_entity for each of the structures returned in the parent_map[] before calling this function with return_map as false to perform the actual replace.


这个函数将原始特征[]中的特征替换为替换特征[]中的特征或替换特征[]中的特征副本,如果原始特征[]是主体上的特征、曲线特征和基准特征。原始特性[]的子元素将被重新父代为替换 _ 特性[]或复制。原来的功能将被删除。原始特征[]可以包含: 同体特征、曲线特征、基准面特征和基准轴特征。置换特征[]必须包含: 其他主体上的特征(如果原始特征[]包含主体上的特征) ,其他曲线特征(如果原始特征[]包含曲线特征)和其他基准面和其他基准轴特征(如果原始特征[]包含基准面或基准轴特征)。需要注意的是,原始特性[]和替换特性[]必须包含位于同一个部件文件中的特性。此外,对于主体上的特性,每个特性的父特性必须是置换特性[]中的另一个特性,或者必须是原始特性[]中最早的特性之前的特性。Father _ map []将由原始 _ properties []创建的实体映射到替换 _ properties []上的对应实体。除原始特征[]和替换特征[]之外,您还必须提供原始特征[]上的边和面的映射到替换特征[]的相应边和面。您将把映射指定为下面描述的 UF _ MODL _ place _ Features _ t 类型的对象数组。原始 _ properties []的子节点将被重新父节点化为父 _ map []中指定的、对应的实体的替换 _ properties []上的副本。将 return _ map 调用为 true 并不执行替换操作,而是返回一个 father _ map [] ,其中的每个原始实体元素都是 source _ properties []创建的边和面。只有那些作为下游特性父代的边和面才会在 father _ map []中返回。Rent _ map []中所有结构的 place _ tity 元素都是0。在使用 return _ map 作为 false 调用这个函数之前,必须为 father _ map []中返回的每个结构分配适当的 place _ tity,以执行实际的替换。

UFUN例子

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

parameters 参数

tag_t *original_featuresInputArray of features to replace
要替换的特性数组
intn_original_featuresInputnumber of original_features
原始特性的数量
tag_t *replacement_featuresInputArray of replacement features
替换特性数组
intn_replm_featuresInputnumber of replacement_features
替换特性的数量
logicalreturn_mapInputreturn_map = true - return in parent_map[] the edges and faces created by the original_features[] which have to be mapped to the corresponding edges and faces on the replacement_features[] return_map = false - perform the replace
Return _ map = true-return in father _ map []返回由原始特征[]创建的边和面,这些边和面必须映射到替换特征[]上相应的边和面,return _ map = false-执行替换
logicaluse_copy_of_replacementInputuse_copy_of_replacement = false - Use the replacement features directly to replace the original features use_copy_of_replacement = true - Copy the replacement features and use the copy of the replacement feature to replace the original features
Use _ Copy _ of _ place = false-直接使用替换特性来替换原始特性 Use _ Copy _ of _ place = true-复制替换特性并使用替换特性的副本来替换原始特性
UF_MODL_replace_features_t * *parent_mapInput / OutputMap of edges and faces created by the original_features[] to corresponding edges and faces on the replacement_features[]
原始特征[]所创建的边和面到置换特征[]上相应的边和面的映射
int *n_parent_mapInput / Outputnumber of elements in (parent_map)[]
(father _ map)[]中的元素数