学UG二次开发就上UG网:
NX二次开发布尔运算UF函数:UF_MODL_intersect_bodies(不保留目标体或工具体);UF_MODL_intersect_bodies_with_retained_options(保留工具体或目标体);
C++二次开发
UG二次布尔运算C++源码:
- /* TODO: Add your application code here */
- /*中磊国际模具培训-创建求和运算*/
- /*学NX二次开发就上UG网-www.9sug.com块参数 */
- double blk_corner[3] = { 0, 0, 0 };
- char * blk_edg_len[3] = { "20", "20", "20" };
- tag_t blk_obj_id;
- tag_t blk_body_id;
- /*学NX二次开发就上UG网-www.9sug.com圆柱参数 */
- double cyl_origin[3] = { 0, 0, 0 };
- char * cyl_height = "20";
- char * cyl_diam = "10";
- double cyl_direction[3]{0, 0, 1};
- tag_t cyl_obj_id;
- tag_t cyl_body_id;
- /*学NX二次开发就上UG网-www.9sug.com块参数 */
- UF_MODL_create_block1(UF_NULLSIGN, blk_corner, blk_edg_len, &blk_obj_id);
- UF_MODL_ask_feat_body(blk_obj_id, &blk_body_id);
- /*学NX二次开发就上UG网-www.9sug.com圆柱参数 */
- UF_MODL_create_cyl1(UF_NULLSIGN, cyl_origin, cyl_diam,cyl_height,cyl_direction, &cyl_obj_id);
- UF_MODL_ask_feat_body(cyl_obj_id, &cyl_body_id);
- /*调整视图到合适大小*/
- tag_t view_tag = NULL_TAG;
- UF_VIEW_ask_work_view(&view_tag);
- UF_VIEW_fit_view(view_tag, 0.7);
- /*布尔运算-交*/
- int num_result = 0;
- tag_t * resulting_bodies = NULL;
- UF_MODL_intersect_bodies(blk_body_id,
- cyl_body_id,
- &num_result,
- &resulting_bodies);
- /* Terminate the API environment */
复制代码
|