admin 发表于 2016-5-15 09:06:56

UG NX源码分享:选择图纸



”static int mask_for_drawings(UF_UI_selection_p_t select, void *type)
{
    UF_UI_mask_t
      mask = { { UF_view_type, UF_view_drawing_sheet_subtype, 0 } };
    if (!UF_CALL(UF_UI_set_sel_mask(select,
            UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC, 1, mask)))
      return (UF_UI_SEL_SUCCESS);
    else
      return (UF_UI_SEL_FAILURE);
}
static tag_t select_a_drawing(char *prompt)
{
    int
      resp;
    double
      cp;
    tag_t
      drawing,
      object,
      view;
    UF_CALL(UF_UI_select_with_single_dialog("Select a drawing", prompt,
      UF_UI_SEL_SCOPE_WORK_PART, mask_for_drawings, NULL, &resp,
      &object, cp, &view));
    if (resp == UF_UI_OBJECT_SELECTED || resp == UF_UI_OBJECT_SELECTED_BY_NAME)
    {
      UF_CALL(UF_DISP_set_highlight(object, 0));
      UF_CALL(UF_DRAW_ask_drawing_of_view(object, &drawing));
      return drawing;
    }
    else return NULL_TAG;
}
页: [1]
查看完整版本: UG NX源码分享:选择图纸