NX二次开发UF_VIEW_cycle_objects 函数介绍

235 阅读4分钟

UF_VIEW_cycle_objects

Defined in: uf_view.h 
int UF_VIEW_cycle_objects(tag_t view, UF_VIEW_cycle_objects_t type, tag_t * object )

overview 概述

Cycle objects within a view.

If view is NULL_TAG, the work view is used.

A cycle type of UF_VIEW_VISIBLE_OBJECTS returns all objects which are visible in the view; when using a cycle type of UF_VIEW_VISIBLE_OBJECTS, objects which are outside of the view bounds are not returned. However, non-rectangular boundaries of drafting member views are not considered by UF_VIEW_cycle_objects. UF_VIEW_cycle_objects only works on the rectangular boundary of the view - as though the breakline/detail boundary was removed. If the desire is to obtain visible objects within a drafting member view with non-rectangular borders and with respect to the non-rectangular border itself, please refer to UF_VIEW_ask_visible_objects.

You must not delete, or un-erase objects, or add or remove view modifications during a cycle as the resulting changes will cause the outcome of the cycle to be unpredictable.

Do not attempt to delete objects when cycling the database in a loop. Problems can occur when trying to read the next object when the current object has been deleted. To delete objects, save an array with the objects in it, and then when you have completed cycling, use UF_OBJ_delete_array_of_objects to delete the saved array of objects.

Warning: This function will return curves that are used to display a solid silhouette in a drawing member view. Use UF_DRAW_ask_group_of_curve on any curve returned to determine if the curve belongs to a UF_solid_silhouette_type group.

Warning: This function can return objects which are visible within the specified view but which are on layers other than the user-accessible layers of 1 - 256 inclusive.

Warning: When run in external mode, this function will return solids as visible which are occluded by other solids in the specified view. For a drafting member view, extracted edges may be used to force occlusion to be considered.

Warning: For drafting member views with extracted edges on (Exact, Smart Lightweight, or Exact (Pre-NX 8.5) with Extracted Edges toggle on) this function will not return solid faces and edges because they are not visible. Also be aware that this function does not return extracted curves for exact and smart lightweight view types. If you require the extracted curves for these views, then please use UF_VIEW_ask_visible_objects instead.


在视图中循环对象。如果视图为 NULL _ TAG,则使用工作视图。UF _ VIEW _ VISIBLE _ ObjecCTS 的循环类型返回视图中可见的所有对象; 当使用 UF _ VIEW _ VISIBLE _ ObjecCTS 的循环类型时,不返回视图边界之外的对象。然而,UF _ VIEW _ Cycle _ 对象并不考虑起草成员视图的非矩形边界。UF _ VIEW _ cle _ object 只能在视图的矩形边界上工作——就好像断线/细节边界被移除了一样。如果希望在一个带有非矩形边框的起草成员视图中获得可见对象,并且相对于非矩形边框本身,请参考 UF _ VIEW _ ask _ visible _ Objects。在一个周期内,不能删除或取消擦除对象,也不能添加或删除视图修改,因为由此产生的更改将导致周期的结果变得不可预测。在循环中循环数据库时,不要试图删除对象。当当前对象已被删除时,尝试读取下一个对象时可能会出现问题。若要删除对象,请保存一个包含对象的数组,然后在完成循环之后,使用 UF _ OBJ _ delete _ array _ of _ object 删除保存的对象数组。警告: 此函数将返回用于在绘图成员视图中显示实心轮廓的曲线。在返回的任何曲线上使用 UF _ DRAW _ ask _ group _ of _ Curve 来确定曲线是否属于 UF _ Solid _ profile _ type 组。警告: 此函数可以返回指定视图中可见的对象,但这些对象位于用户可访问的层(包括1-256层)之外的其他层上。警告: 在外部模式下运行时,此函数将返回可见的实体,这些实体被指定视图中的其他实体所遮挡。对于起草成员视图,提取的边可用于强制考虑遮挡。警告: 对于起草提取边缘的成员视图(精确,智能轻量级,或精确(Pre-NX 8.5)与提取边缘切换) ,这个函数不会返回实面和边缘,因为他们是不可见的。还要注意,这个函数不会返回精确且智能的轻量级视图类型的提取曲线。如果您需要为这些视图提取曲线,那么请使用 UF _ VIEW _ ask _ visible _ object 代替。

UFUN例子

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

parameters 参数

tag_tviewInputThe view to cycle in - if NULL_TAG, the work view is used
循环使用的视图-如果为 NULL _ TAG,则使用工作视图
UF_VIEW_cycle_objects_ttypeInputObject Selection - one of: UF_VIEW_VISIBLE_OBJECTS UF_VIEW_DEPENDENT_OBJECTS UF_VIEW_ERASED_OBJECTS UF_VIEW_MODIFIED_OBJECTS
对象选择-对象之一: UF _ VIEW _ VIEW _ DEPENDENT _ ObjecCTS UF _ VIEW _ ERASED _ ObjecCTS UF _ VIEW _ MODED _ Objects
tag_t *objectInput / OutputOn input, the last object found by this routine. Pass in a NULL_TAG to start the cycle. On output, is set to the next object. A NULL_TAG is returned when the cycle is complete.
在输入时,此例程找到的最后一个对象。传入一个 NULL _ TAG 来开始循环。在输出时,设置为下一个对象。循环完成时返回 NULL _ TAG。