文章作者:里海
來源網站:https://blog.csdn.net/WangPaiFeiXingYuan
UF_UI_select_conehead
Defined in: uf_ui.h?
int UF_UI_select_conehead(char * message, int num, double origins [ ] , double directions [ ] , char * * labels, UF_DISP_conehead_attrb_s * attributes, double selection_point, int display_coneheads, int * selected_num, int * response )
overview 概述
Displays the given coneheads and allows the user to select one of
them. The coneheads are described using the standard conehead attributes.
Each conehead has a selection point. The location of the selection
point is set by the input parameter selection_point. The user is then
prompted for a screen location, and the conehead whose selection
point is closest, is returned to the caller.
The selection_point parameter may be any value in the range 0.0 to
1.0. A value of 0.0 sets the selection point to the base of each
conehead. 1.0 sets the selection point to the tips.
The display_coneheads flag determines if, all the coneheads, none of
the coneheads, or just the selected conehead, is left displayed when
the function ends. The selected coneheads selection point is marked
with a small circle.
The user can choose Back or Cancel without selecting a conehead.
UF_DISP_set_conehead_attrb describes how to set conehead attributes.
顯示給定的錐頭,并允許用戶選擇其中之一。使用標準的 conehead 屬性描述 conehead。每個錐頭都有一個選擇點。選擇點的位置由輸入參數 select _ point 設置。然后提示用戶輸入屏幕位置,并將選擇點最近的錐頭返回給調用者。Select _ point 參數可以是范圍在0.0到1.0之間的任何值。如果值為0.0,則將選擇點設置為每個錐頭的底部。0將選擇點設置為提示。Display _ conehead 標志確定在函數結束時是否顯示所有的 conehead,沒有任何 conehead,或者只顯示所選的 conehead。選定的錐頭選擇點用一個小圓圈標記。用戶可以選擇 Back 或 Cancel,而無需選擇 conehead。UF _ DISP _ set _ conehead _ attrb 描述了如何設置 conehead 屬性。
UFUN例子
歡迎訂閱《里海NX二次開發(fā)3000例專欄》https://blog.csdn.net/wangpaifeixingyuan/category_8840986.html,點擊鏈接掃碼即可訂閱(持續(xù)更新中)。已經有幾百人訂閱,訂閱是永久的,無限期閱讀,如需幫助請私信。
parameters 參數
char * | message | Input | The cue line message. (80 character maximum) 提示線消息。(最多80個字符) |
int | num | Input | The number of coneheads to display. 要顯示的錐頭數量。 |
double | origins [ ] | Input | An array of conehead origin points. Contains num3 entries. 錐頭原點的數組。包含 num3條目。 |
double | directions [ ] | Input | An array of conehead directions. Contains num3 entries. 錐頭方向的數組。包含 num3條目。 |
char * * | labels | Input | An array of pointers to character string labels to be placed on the coneheads. If no labels are desired this may be passed as NULL. Individual entries may also be set to NULL. Contains num entries. 指向要放置在錐頭上的字符串標簽的指針數組。如果不需要任何標簽,這可以作為 NULL 傳遞。單個條目也可以設置為 NULL。包含數字項。 |
UF_DISP_conehead_attrb_s * | attributes | Input | An array of conehead attribute structures If this is set to NULL, the current conehead attributes are used for all the coneheads. For a description of this structure and how to set the current conehead attributes see UF_DISP_set_conehead_attrb. Contains num entries. Conehead 屬性結構的數組如果設置為 NULL,則所有的 conehead 都使用當前的 conehead 屬性。有關此結構以及如何設置當前 conehead 屬性的說明,請參見 UF _ DISP _ set _ conehead _ attrb。包含數字項。 |
double | selection_point | Input | Determines where the selection points are on the coneheads. This is given as a fraction of the total conehead length, 0.0 to 1.0. 確定選擇點在錐頭上的位置。這是作為總錐頭長度的一部分給出的,0.0到1.0。 |
int | display_coneheads | Input | Which coneheads will remain displayed on ReturnUF_UI_DISP_NONE UF_UI_DISP_SELECTED UF_UI_DISP_ALL 哪些錐頭將繼續(xù)顯示在 Return nUF _ UI _ DISP _ NONE UF _ UI _ DISP _ SELECTED UF _ UI _ DISP _ ALL 上 |
int * | selected_num | Output | The conehead that was selected. 1 to num. Only valid if response = UF_UI_OK. 選擇的 conehead。1到 num。只有當 response = UF _ UI _ OK 時才有效。 |
int * | response | Output | Indication of the users response: UF_UI_OK UF_UI_BACK UF_UI_CANCEL 用戶響應的指示: UF _ UI _ OK UF _ UI _ Back UF _ UI _ CANCEL |
>>> 返回目錄
文章來源:http://www.zghlxwxcb.cn/news/detail-855312.html
C++語言在UG二次開發(fā)中的應用及綜合分析
- C++ 是C語言的擴展,它既可以執(zhí)行C語言的過程化程序設計,也可以進行以抽象數據類型為特點的基于對象的設計,以及面向對象的程序設計。C++ 在處理問題規(guī)模上具有很大的適應性。
- C++不僅具有計算機高效運行的實用性特征,并且致力于提升大規(guī)模程序的編程質量以及程序設計語言的問題描述能力。
在UG二次開發(fā)中,C++語言具有以下特點
- C++語言支持多種程序設計風格
- C++的許多特性以庫的形式存在,保證了語言的簡潔和開發(fā)運行的效率
- 與C語言相比,C++引入了面向對象的概念,使得UG二次開發(fā)的人機交互界面更加簡潔
- 通過借助UG自帶的2000多種API函數,結合高級語言C++以及編程軟件Visual Studio,可以對UG進行二次開發(fā)
- 需要注意的是,市場上的Visual Studio和UG版本眾多,并非所有版本都能兼容
程序設計過程通常包括以下步驟:
- 問題分析:對要解決的問題進行深入的分析,理解問題的具體需求和限制。
- 需求定義:明確程序的目標和功能,包括用戶需求、系統(tǒng)需求等。
- 設計:根據需求進行設計,包括算法設計、數據結構設計、界面設計等。
- 編碼:根據設計的結果,使用一種編程語言將程序代碼實現出來。
- 測試:通過各種測試方法來確保程序的正確性,包括單元測試、集成測試、系統(tǒng)測試等。
- 維護:對程序進行修改和完善,以解決可能出現的問題或滿足新的需求。
- 文檔編寫:編寫程序文檔,描述程序的功能、操作方法、注意事項等。
以下是一個創(chuàng)建體素特征(塊、柱、錐、球)的二次開發(fā)例子
#include <stdio.h>
#include <stdarg.h>
#include <uf_modl_primitives.h>
#include <uf_ui_ugopen.h>
#include <uf.h>
#include <uf_defs.h>
//封裝打印函數,用于將信息打印到信息窗口
//QQ3123197280
int ECHO(const char* szFormat, ...)
{
char szMsg[5000] = "";
va_list arg_ptr;
va_start(arg_ptr, szFormat);
vsprintf_s(szMsg, szFormat, arg_ptr);
va_end(arg_ptr);
UF_UI_open_listing_window();
UF_UI_write_listing_window(szMsg);
return 0;
}
extern DllExport void ufusr(char* param, int* returnCode, int rlen)
{
UF_initialize();
//創(chuàng)建塊
UF_FEATURE_SIGN sign = UF_NULLSIGN;
//塊起點相對于ABS
double block_orig[3] = { 0.0,0.0,0.0 };
//方向相對于WCS
char* block_len[3] = { "10", "30", "10" };
tag_t blk_obj;//體特征
UF_MODL_create_block1(sign, block_orig, block_len, &blk_obj);
int iEdit = 0;
char* size[3];
UF_MODL_ask_block_parms(blk_obj, iEdit, size);
ECHO("%s,%s,%s\n", size[0], size[1], size[2]);//輸出: p6=10,p7=30,p8=10
//創(chuàng)建圓柱
UF_FEATURE_SIGN sign1 = UF_NULLSIGN;
double origin[3] = { 10.0,0.0,10.0 };
char height[] = "20";
char diam[] = "10";
double direction[3] = { 0,0,1 };//方向
tag_t cyl_obj_id;
UF_MODL_create_cyl1(sign1, origin, height, diam, direction, &cyl_obj_id);
int iEdit2 = 0;
char* cDiameter;
char* cHeight;
UF_MODL_ask_cylinder_parms(cyl_obj_id, iEdit2, &cDiameter, &cHeight);
ECHO("%s,%s\n", cDiameter, cHeight);//輸出:p9=10,p10=20
UF_free(cDiameter);
UF_free(cHeight);
//創(chuàng)建圓錐
UF_FEATURE_SIGN sign2 = UF_NULLSIGN;
double origin2[3] = { 0.0,0.0,10.0 };
char height2[] = "20";
char* diam2[2] = { "10" ,"5" };
double direction2[3] = { 0,0,1 };//方向
tag_t cone_obj_id;
UF_MODL_create_cone1(sign2, origin2, height2, diam2, direction2, &cone_obj_id);
int iEdit3 = 0;
char* cD1;
char* cD2;
char* cH;
char* cAngle;
UF_MODL_ask_cone_parms(cone_obj_id, iEdit3, &cD1, &cD2, &cH, &cAngle);
ECHO("%s,%s,%s,%s\n", cD1, cD2, cH, cAngle);//輸出:p11=10,p12=5,p13=20,p14=7.1250163489018
UF_free(cD1);
UF_free(cD2);
UF_free(cH);
UF_free(cAngle);
//創(chuàng)建球
UF_FEATURE_SIGN sign3 = UF_NULLSIGN;
double douCenter2[3] = { 0.0,0.0,30.0 };
char cDiam[] = "8";
tag_t sphere_obj_id;
UF_MODL_create_sphere1(sign3, douCenter2, cDiam, &sphere_obj_id);
int iEdit4 = 0;
char* cDiam_parm;
UF_MODL_ask_sphere_parms(sphere_obj_id, iEdit4, &cDiam_parm);
ECHO("%s\n", cDiam_parm);//輸出:p15=8
UF_free(cDiam_parm);
UF_terminate();
}
extern int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
}
效果:文章來源地址http://www.zghlxwxcb.cn/news/detail-855312.html
到了這里,關于NX二次開發(fā)UF_UI_select_conehead 函數介紹的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!