/*=============================================================================
WARNING!! This file is overwritten by the UIStyler each time the Styler
file is saved.
Filename: IntersectionPointOpenC_template.c
This file was generated by the NX User Interface Styler
Created by: alfred
Version: NX 8
Date: 06-11-2012
Time: 22:44
This template file is overwritten each time the UIStyler dialog is
saved. Any modifications to this file will be lost.
==============================================================================*/
/* These include files are needed for the following template code. */
#include <stdio.h>
#include <stdlib.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_exit.h>
#include <uf_ui.h>
#include <uf_styler.h>
#include <uf_mb.h>
#include <uf_curve.h>
#include <uf_so.h>
#include <uf_part.h>
#include <uf_point.h>
#include <uf_csys.h>
#include "IntersectionPointOpenDlg.h"
/*-------------------------------------------------------------------------*/
/*------------------------------- User Functions --------------------------*/
/*-------------------------------------------------------------------------*/
/* selection initialization procedure */
tag_t currentSelectedObject = NULL_TAG;
tag_t currentSelectedCurve = NULL_TAG;
static int init_proc_for_object(
UF_UI_selection_p_t select,
void* user_data)
{
int num_triples = 7;
UF_UI_mask_t mask_triples[] = {
{UF_solid_type, 0, UF_UI_SEL_FEATURE_ANY_FACE},
{UF_solid_type, 0, UF_UI_SEL_FEATURE_ANY_EDGE},
{UF_datum_plane_type, 0, 0},
{ UF_line_type, 0, 0 },
{ UF_circle_type, 0, 0 },
{ UF_conic_type, 0, 0 },
{ UF_spline_type, 0, 0 }
};
/* enable only lines and edges */
if((UF_CALL(UF_UI_set_sel_mask(select,
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
num_triples, mask_triples))) == 0)
{
return (UF_UI_SEL_SUCCESS);
}
else
{
return (UF_UI_SEL_FAILURE);
}
}
/* selection initialization procedure */
static int init_proc_for_curve(
UF_UI_selection_p_t select,
void* user_data)
{
int num_triples = 5;
UF_UI_mask_t mask_triples[] = {{UF_solid_type, 0, UF_UI_SEL_FEATURE_ANY_EDGE},
{ UF_line_type, 0, 0 },
{ UF_circle_type, 0, 0 },
{ UF_conic_type, 0, 0 },
{ UF_spline_type, 0, 0 }
};
/* enable only lines and edges */
if((UF_CALL(UF_UI_set_sel_mask(select,
UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,
num_triples, mask_triples))) == 0)
{
return (UF_UI_SEL_SUCCESS);
}
else
{
return (UF_UI_SEL_FAILURE);
}
}
extern "C" tag_t select_face()
{
char* message = "Please select surface,curve or datum plane";
char* title = "Select surface,curve or datum plane";
int response;
tag_t object,
view;
double cursor[3];
if(!(UF_UI_select_with_single_dialog(message,title,
UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY, init_proc_for_object, NULL,
&response, &object, cursor, &view)))
{
if (response == UF_UI_OBJECT_SELECTED ||
response == UF_UI_OBJECT_SELECTED_BY_NAME)
{
UF_DISP_set_highlight(object,0);
return object;
}
else
return NULL_TAG;
}
return NULL_TAG;
}
static int select_faces(tag_t **faces)
{
char* message = "Please select faces";
char* title = "Select faces";
int
cnt,
ii,
resp;
// scope is workpart only? or any in assembly?
UF_CALL(UF_UI_select_with_class_dialog(message, title,
UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY,
init_proc_for_object, NULL, &resp, &cnt, faces));
for (ii = 0; ii < cnt; ii++)
UF_CALL(UF_DISP_set_highlight((*faces)[ii], FALSE));
return cnt;
}
extern "C" tag_t select_curve()
{
char* message = "Please select edge/curve";
char* title = "Select edge/curve";
int response;
tag_t object,view;
double cursor[3];
if(!(UF_UI_select_with_single_dialog(message,title,
UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY, init_proc_for_curve, NULL,
&response, &object, cursor, &view)))
{
if (response == UF_UI_OBJECT_SELECTED ||
response == UF_UI_OBJECT_SELECTED_BY_NAME)
{
UF_DISP_set_highlight(object, FALSE);
return object;
}
else
return NULL_TAG;
}
return NULL_TAG;
}
static int select_curves(tag_t **curves)
{
char* message = "Please select curves";
char* title = "Select curves";
int
cnt,
ii,
resp;
// scope is workpart only? or any in assembly?
UF_CALL(UF_UI_select_with_class_dialog(message, title,
UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY,
init_proc_for_curve, NULL, &resp, &cnt, curves));
for (ii = 0; ii < cnt; ii++)
UF_CALL(UF_DISP_set_highlight((*curves)[ii], FALSE));
return cnt;
}
void ClearSelectedFace(int dialog_id)
{
UF_STYLER_item_value_type_t data;
//unHighlight
data.item_attr = UF_STYLER_VALUE;
data.indicator = UF_STYLER_STRING_VALUE ;
data.item_id = CHANGE_LIST_SELECTEDOBJECT;
UF_STYLER_ask_value(dialog_id,&data);
if (data.count>0)
{
UF_DISP_set_highlight(atoi(data.value.string), FALSE);
}
UF_STYLER_free_value(&data);
// DELETE
data.item_attr = UF_STYLER_LIST_DELETE;
data.item_id = CHANGE_LIST_SELECTEDOBJECT;
data.subitem_index = UF_STYLER_NO_SUB_INDEX;
UF_STYLER_set_value(dialog_id,&data);
}
void ClearSelectedCurve(int dialog_id)
{
UF_STYLER_item_value_type_t data;
//unHighlight
data.item_attr = UF_STYLER_VALUE;
data.indicator = UF_STYLER_STRING_VALUE ;
data.item_id = CHANGE_LIST_SELECTEDCURVE;
UF_STYLER_ask_value(dialog_id,&data);
if (data.count>0)
{
UF_DISP_set_highlight(atoi(data.value.string), FALSE);
}
UF_STYLER_free_value(&data);
// DELETE
data.item_attr = UF_STYLER_LIST_DELETE;
data.item_id = CHANGE_LIST_SELECTEDCURVE;
data.subitem_index = UF_STYLER_NO_SUB_INDEX;
UF_STYLER_set_value(dialog_id,&data);
}
void MapPointFromWcsToWorkABs(double inputPoints[3], double outputPoints[3])
{
UF_CSYS_map_point(UF_CSYS_ROOT_COORDS, inputPoints, UF_CSYS_WORK_COORDS, outputPoints);
return ;
}
int CreateIntersectPoint(int dialog_id)
{
UF_STYLER_item_value_type_t data;
tag_t curve = NULL_TAG;
tag_t object = NULL_TAG;
//get curve
data.item_attr = UF_STYLER_VALUE;
data.indicator = UF_STYLER_STRING_VALUE ;
data.item_id = CHANGE_LIST_SELECTEDCURVE;
UF_STYLER_ask_value(dialog_id,&data);
if (0 == data.count)
{
UF_STYLER_free_value(&data);
uc1601("无法创建datum point.\n物件不能为空,请先选择正确的curve", 1);
return -1;
}
curve = atoi(data.value.string);
UF_STYLER_free_value(&data);
//get face object
data.item_attr = UF_STYLER_VALUE;
data.indicator = UF_STYLER_STRING_VALUE ;
data.item_id = CHANGE_LIST_SELECTEDOBJECT;
UF_STYLER_ask_value(dialog_id,&data);
if (0 == data.count)
{
UF_STYLER_free_value(&data);
uc1601("无法创建datum point.\n物件不能为空,请先选择正确的surface,curve 或datum plane", 1);
return -2;
}
object = atoi(data.value.string);
UF_STYLER_free_value(&data);
///////////////////////////////
tag_t datamPoint = NULL_TAG;
double refPoint[3] = {0, 0, 0};
UF_CURVE_intersect_info_t pointInfo;
UF_CURVE_intersect(curve, object, refPoint, &pointInfo);
if (pointInfo.type_of_intersection != 0)
{
double pointToCreate[3] = {0, 0, 0};
MapPointFromWcsToWorkABs(pointInfo.curve_point, pointToCreate);
tag_t xyzScalar[3] = {NULL_TAG, NULL_TAG, NULL_TAG};
UF_SO_create_scalar_double(UF_PART_ask_display_part(), UF_SO_update_within_modeling,
pointToCreate[0], &xyzScalar[0]);
UF_SO_create_scalar_double(UF_PART_ask_display_part(), UF_SO_update_within_modeling,
pointToCreate[1], &xyzScalar[1]);
UF_SO_create_scalar_double(UF_PART_ask_display_part(), UF_SO_update_within_modeling,
pointToCreate[2], &xyzScalar[2]);
tag_t outSoPoint = NULL_TAG;
UF_CALL(UF_POINT_create_3_scalars(xyzScalar, &outSoPoint));
//
没有合适的资源?快使用搜索试试~ 我知道了~
C开发UG点构造器Intersection Point
共69个文件
obj:13个
pdb:6个
cpp:5个
3星 · 超过75%的资源 需积分: 10 7 下载量 91 浏览量
2012-06-13
23:11:08
上传
评论
收藏 1.33MB ZIP 举报
温馨提示
使用UGOPEN来开发UG 模拟点构造器中的Intersection Point功能进行开发
资源推荐
资源详情
资源评论
收起资源包目录
Intersection20120613.zip (69个子文件)
IntersectionPoint
IntersectionPoint.cpp 0B
Release
IntersectionPoint.dll 24KB
NXSigningResource.obj 1KB
IntersectionPoint.lib 2KB
vc60.idb 57KB
CreateIntersectionPoint.obj 11KB
IntersectionPoint.pch 185KB
IntersectionPointOpenDlg.obj 15KB
IntersectionPoint.exp 857B
IntersectionPointOpenDlg.cpp 24KB
CreateIntersectionPoint.cpp 5KB
IntersectionPoint.ncb 49KB
IntersectionPoint.dsp 4KB
IntersectionPoint.plg 2KB
IntersectionPoint.opt 57KB
IntersectionPoint.dsw 559B
Debug
IntersectionPoint.sbr 0B
IntersectionPoint.dll 100KB
NXSigningResource.obj 3KB
IntersectionPoint.obj 1KB
TestDlx.cs 16KB
IntersectionPoint.lib 2KB
IntersectionPoint.ilk 87KB
vc60.idb 257KB
IntersectionPoint.bsc 1001KB
CreateIntersectionPoint.obj 61KB
TestDlx.dlx 33KB
IntersectionPoint.pch 185KB
IntersectionPoint.pdb 153KB
vc60.pdb 196KB
IntersectionPointOpenDlg.obj 65KB
IntersectionPoint.exp 855B
IntersectionPointOpenDlg.h 8KB
Intersection20120613
CreateIntersectionPoint
CreateIntersectionPoint
Release
CreateIntersectionPoint.dll.intermediate.manifest 380B
BuildLog.htm 16KB
NXSigningResource.obj 5KB
CreateIntersectionPoint.obj 511KB
mt.dep 67B
vc80.pdb 212KB
vc80.idb 259KB
IntersectionPointOpenDlg.obj 39KB
IntersectionPointOpenDlg.cpp 24KB
CreateIntersectionPoint.vcproj 5KB
CreateIntersectionPoint.vcproj.BLACKFOX.alfred.user 1KB
CreateIntersectionPoint.cpp 5KB
CreateIntersectionPoint.vcproj.HZ_CADCAE.S15525.user 1KB
Debug
CreateIntersectionPoint.dll.intermediate.manifest 380B
BuildLog.htm 22KB
CreateIntersectionPoint.dll.embed.manifest.res 464B
CreateIntersectionPoint.dll.embed.manifest 398B
NXSigningResource.obj 4KB
CreateIntersectionPoint.obj 61KB
mt.dep 67B
vc80.pdb 252KB
vc80.idb 579KB
IntersectionPointOpenDlg.obj 50KB
IntersectionPointOpenDlg.h 8KB
CreateIntersectionPoint.sln 934B
debug
CreateIntersectionPoint.pdb 563KB
CreateIntersectionPoint.exp 863B
CreateIntersectionPoint.ilk 375KB
CreateIntersectionPoint.dll 56KB
CreateIntersectionPoint.lib 2KB
CreateIntersectionPoint.suo 43KB
release
CreateIntersectionPoint.pdb 323KB
CreateIntersectionPoint.exp 865B
CreateIntersectionPoint.dll 14KB
CreateIntersectionPoint.lib 2KB
IntersectionPointOpenC.dlg 3KB
共 69 条
- 1
资源评论
- mlf031520172014-05-02不错的资料,谢谢
alfred_xtu
- 粉丝: 0
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功