UF_UI_specify_screen_position
Defined in: uf_ui.h
int UF_UI_specify_screen_position(char * message, UF_UI_motion_fn_t motion_cb, void * motion_cb_data, double screen_pos [ 3 ] , tag_t * view_tag, int * response )
overview 概述
This function allows you to indicate a screen position by pressing MB1 in the graphics window. The screen position and the tag of the view it is in are returned.
An empty dialog is displayed with only the Back and Cancel buttons enabled.
The function UF_UI_set_cursor_view affects the screen_pos and view_tag that is returned and passed to the motion callback. This is particularly true with respect to the display of a drawing view. The two values for the new_cursor_view parameter of UF_UI_set_cursor_view affect the view_tag and screen_pos parameters of UF_UI_specify_screen_position as follows:
. If new_cursor_view is set to "Any View" and the cursor is in a drawing member view, then the return values for the view_tag and screen_pos are the tag of the member view and the position in Absolute Coordinates in that member view.
. If the new_cursor_view is set to "Work View", then regardless of whether the cursor is in a member view or not, the return values for the view_tag and screen_pos are the tag of the drawing and the position in drawing coordinates.
If Grid Snap is presently enabled, the screen position is automatically snapped. This also applies to the position passed to the motion callback.
This function accepts a motion callback which will be called in response to each detected movement (i.e. "motion") of the cursor within the graphics window. The callback will be passed the current position and view of the cursor, and the client data pointer. The typedef for motion callbacks is defined in uf_disp.h as follows:
typedef void (UF_UI_motion_fn_t)( double screen_pos[3], UF_UI_motion_cb_data_p_t motion_cb_data, void data );
All of the above parameters are input parameters to the callback function:
screen_pos is the current position of the crosshair, given in Work
Part Absolute Coordinates (as described above).
motion_cb_data is a pointer to a data structure; presently, only
the following field of this structure should be referenced:
motion_cb_data->view_tag is the tag of the view of the
current crosshair position.
Finally, the third parameter to the motion callback, data, is the client
data pointer initially passed to UF_UI_specify_screen_position along
with the callback.
In general, a motion callback will generate some graphical feedback based on the current cursor position, using Overlay Graphics primitives. Overlay Graphics primitives are defined using the UF_DISP_display_ogp_ functions. Overlay Graphics primitives generated from a motion callback will be displayed immediately following the invocation of the callback, and will be automatically erased just before the next invocation, and upon the completion of the call to UF_UI_specify_screen_position.
Please see the Overview of the section on Overlay Graphics primitive functions in the Display chapter for further information regarding their behavior and usage.
Keep in mind that your motion callback will be invoked in response to every detected movement of the cursor (in the graphics window). If you find that the display of the cursor appears to be "choppy", or that it doesn't seem to be "keeping up" with your movement of the mouse, it may be that you are attempting to do too many calculations and/or define too many primitives from your motion callback.
There must be a part loaded when this function is called.
这个功能允许您通过在图形窗口中按 MB1来指示屏幕位置。返回屏幕位置及其所在视图的标记。将显示一个空对话框,其中仅启用“返回”和“取消”按钮。函数 UF _ UI _ set _ cursor _ view 影响返回并传递给运动回调的 screen _ pos 和 view _ tag。在绘图视图的显示方面尤其如此。UF _ UI _ set _ cursor _ view 的 new _ cursor _ view 参数的两个值如下所示影响 UF _ UI 的 view _ tag 和 screen _ pos 参数:。如果 new _ cursor _ View 被设置为“ AnyView”,并且光标位于绘图成员视图中,那么 View _ tag 和 screen _ pos 的返回值是成员视图的标记以及该成员视图中绝对坐标的位置。?.如果 new _ cursor _ View 被设置为“ Work View”,那么无论游标是否在成员视图中,View _ tag 和 screen _ pos 的返回值都是绘图的标记和绘图坐标中的位置。如果目前启用了 GridSnap,则屏幕位置将自动快照。这也适用于传递给运动回调的位置。此函数接受一个运动回调,该回调将响应在图形窗口中检测到的光标的每个运动(即“运动”)而被调用。回调将传递游标的当前位置和视图以及客户端数据指针。用于运动回调的 typedef 在 UF _ disp.h 中定义如下: typedef void (UF _ UI _ motion _ fn _ t)(double screen _ pos [3] ,UF _ UI _ motion _ cb _ data _ p _ t motion _ cb _ data,void data) ; 所有上述参数都是回调函数的输入参数: screen _ pos 是工作部件绝对坐标中给出的十字线的当前位置(如上所述)。Motion _ cb _ data 是一个指向数据结构的指针; 目前,只需要引用该结构的以下字段: motion _ cb _ data-> view _ tag 是当前十字线位置视图的标记。最后,运动回调的第三个参数 data 是客户端数据指针,它最初连同回调一起传递给 UF _ UI _ specite_ screen _ position。通常,运动回调将使用 Overlay Graphics 原语基于当前光标位置生成一些图形反馈。Overlay Graphics 基元是使用 UF _ DISP _ display _ ogp _ 函数定义的。从运动回调生成的 Overlay Graphics 原语将在回调调用之后立即显示,并且将在下一次调用之前以及在对 UF _ UI _ special _ screen _ position 的调用完成之后自动擦除。请参阅“显示”章节中关于叠加图形原语函数的概述,以获得有关其行为和用法的进一步信息。请记住,您的动作回调将被调用来响应每一个检测到的光标移动(在图形窗口中)。如果你发现光标的显示出现了“断断续续”,或者它似乎没有“跟上”你的鼠标移动,这可能是你试图做太多的计算和/或定义太多的原语从你的运动回调。当调用这个函数时,必须有一个加载的部分。
UFUN例子
获取源码例子请搜索 里海NX二次开发3000例专栏
parameters 参数
| char * | message | Input | Cue line message (132 Character maximum), or NULL 提示行消息(最大132个字符) ,或者 NULL |
| UF_UI_motion_fn_t | motion_cb | Input | Motion callback function, or NULL 运动回调函数,或 NULL |
| void * | motion_cb_data | Input | Client data pointer, or NULL; will be passed to motion_cb 客户端数据指针或 NULL; 将被传递给 motion _ cb |
| double | screen_pos [ 3 ] | Output | The screen position in Work Part Absolute Coords, projected "through the screen" onto the WCS XY plane. This is given in Work Part Absolute Coordinates. This is only returned if the response returned is UF_UI_PICK_RESPONSE. 工作部件绝对坐标中的屏幕位置,通过屏幕投影到 WCS XY 平面上。这是在工作部分的绝对坐标给出。仅当返回的响应为 UF _ UI _ PICK _ RESPONSE 时才返回。 |
| tag_t * | view_tag | Output | Tag of the view in which the screen position was indicated. This is only returned if the response returned is UF_UI_PICK_RESPONSE. 指示屏幕位置的视图的标记。仅当返回的响应为 UF _ UI _ PICK _ RESPONSE 时才返回。 |
| int * | response | Output | One of the following: UF_UI_PICK_RESPONSE UF_UI_BACK UF_UI_CANCEL 以下内容之一: UF _ UI _ PICK _ RESPONSE UF _ UI _ Back UF _ UI _ CANCEL |