|
/////////////////////////////////////////////////
//头文件
#include "ProToolkit.h"
#include "ProParameter.h"
#include "ProUtil.h"
#include "ProMdl.h"
#include "ProArray.h"
#include "ProModelItem.h"
#include "ProMessage.h"
#include <ProUI.h>
#include <ProUIDialog.h>
#include <ProUILabel.h>
#include <ProUIPushbutton.h>
#include <ProUIInputpanel.h>
#include <ProUIRadiogroup.h>
#include <ProUIOptionmenu.h>
#include "ProUICheckbutton.h"
#include <ProGraphic.h>
#include <ProView.h>
#include <ProObjects.h>
#include <TestError.h>
#include <ProMdl.h>
#include <ProSolid.h>
#include <ProUICmd.h>
#include <ProUIMessage.h>
#include <time.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> //函数声明
void gear();
void spur(char *,char *,ProAppData);
void spurOK(char *,char *,ProAppData);
void bevel1(char *,char *,ProAppData);
void bevellOK(char *,char *,ProAppData);
void UsrOKAction(char *,char *,ProAppData);
void UsrCancelAction(char *,char *,ProAppData); /*==============================================*\
函数:user_initialize
功能:用户初始化函数
\*==============================================*/
int user_initialize(int argc,
char *argv[],
char *version,
char *build,
wchar_t errbuf[])
{
//调用齿轮参数化设计函数
gear();
return (0);
}
/*==============================================*\
函数:user_terminate
功能:用户结束中断函数
\*==============================================*/
void user_terminate(void)
{
return;
}
/*==============================================*\
函数:gear
功能:齿轮参数化设计函数,显示主对话框
\*==============================================*/
void gear()
{
int status; //将对话框gear调入内存
ProUIDialogCreate("gear","gear");
//设置Cancel按钮激活函数,使该按钮调用函数UsrCancelAction
ProUIPushbuttonActivateActionSet("gear","Cancel",
UsrCancelAction,NULL);
//设置bevellbmp按钮激活函数,使该按钮调用函数bevell
ProUIPushbuttonActivateActionSet("gear","bevel1bmp",
bevel1,NULL);
//显示激活对话框,接受用户交互
ProUIDialogActivate("gear",&status);
//释放对话框内存
ProUIDialogDestroy("gear");
}
void UsrOKAction(
char *dialog,
char *component,
ProAppData data)
{
ProUIDialogExit(dialog,1);//?
}
/*==============================================*\
函数:UsrCancelAction
功能:关闭对话框
\*==============================================*/
void UsrCancelAction(
char *dialog,
char *component,
ProAppData data)
{
ProUIDialogExit(dialog,1);
}
/*==============================================*\
函数:spur
功能:创建直齿圆柱齿轮参数输入对话框
\*==============================================*/
void spur(
2012-05-02 00:12回复举报 |
nihai123
中级粉丝2
2楼
char *dialog,
char *component,
ProAppData data)
{
int status1;
//将对话框spur调入内存
ProUIDialogCreate("spur","spur");
//设置OK按钮激活函数,使该按钮调用函数spurOK
ProUIPushbuttonActivateActionSet("spur","Ok",spurOK,NULL);
//设置Cancel按钮激活函数,使该按钮调用函数UsrCancelAction
ProUIPushbuttonActivateActionSet("spur","Cancel",
UsrCancelAction,NULL);
//显示激活对话框,接受用户交互
ProUIDialogActivate("spur",&status1);
//释放对话框所占内存
ProUIDialogDestroy("spur");
} /*==============================================*\
函数:spurOK
功能:打开直齿齿轮模型,根据参数改变实现零件再生
\*==============================================*/ void spurOK(char *dialog,
char *component,
ProAppData data)
{
ProMdl part;
ProParameter param1;
ProParameter param2;
ProParameter param3;
ProParameter param4;
ProParamvalue value1;
ProParamvalue value2;
ProParamvalue value3;
ProParamvalue value4;
ProModelitem feature;
int i;
int teethnum1;
double pitch1,angle1,width1; //将零件spur_gear.prt.1 调入内存
ProMdlRetrieve(L"E:\\spur_gear.prt.1",PRO_PART,&part); //显示零件
ProMdlDisplay(part); //获取零件ID
ProModelitemInit(part,i,PRO_PART,&feature); //初始化各参数
ProParameterInit(&feature,L"TEETH",¶m1);
ProParameterInit(&feature,L"PITCH",¶m2);
ProParameterInit(&feature,L"ANGLE",¶m3);
ProParameterInit(&feature,L"WIDTH",¶m4); //读取对话框各编辑框的输入数值
ProUIInputpanelIntegerGet("spur","teethnum",&teethnum1);
ProUIInputpanelDoubleGet("spur","pitch",&pitch1);
ProUIInputpanelDoubleGet("spur","angle",&angle1);
ProUIInputpanelDoubleGet("spur","width",&width1); //为变量value1赋值
value1.type=PRO_PARAM_INTEGER;
value1.value.i_val=teethnum1; //为变量value2赋值
value2.type=PRO_PARAM_DOUBLE;
value2.value.d_val=1/pitch1; //为变量value3赋值
value3.type=PRO_PARAM_DOUBLE;
value3.value.d_val=angle1; //为变量value4赋值
value4.type=PRO_PARAM_DOUBLE;
value4.value.d_val=width1; //设置参数param1赋值
ProParameterValueSet(¶m1,&value1); //设置参数param2赋值
ProParameterValueSet(¶m2,&value2); //设置参数param3赋值
ProParameterValueSet(¶m3,&value3); //设置参数param4赋值
ProParameterValueSet(¶m4,&value4); //零件再生
ProSolidRegenerate((ProSolid)part,PRO_B_TRUE); //关闭对话框
ProUIDialogExit(dialog,1);
} /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
这是程序源文件和错误提示,编译时总有一个错误,大家帮帮忙看看该如何解决 ?
“test02.cpp
E:\Program Files\vc projects\test02.cpp(148) : error C2664: 'ProMdlRetrieve' : cannot convert parameter 2 from 'enum pro_obj_types' to 'ProMdlType'
Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
执行 cl.exe 时出错.“ |
|