基于ProE的齿轮参数化设计.docx
- 文档编号:4458778
- 上传时间:2022-12-01
- 格式:DOCX
- 页数:16
- 大小:17.29KB
基于ProE的齿轮参数化设计.docx
《基于ProE的齿轮参数化设计.docx》由会员分享,可在线阅读,更多相关《基于ProE的齿轮参数化设计.docx(16页珍藏版)》请在冰豆网上搜索。
基于ProE的齿轮参数化设计
基于Pro/E的齿轮参数化设计
一、齿轮设计实现文件
//chilunsheji.cpp:
定义DLL的初始化例程。
#include"stdafx.h"
#include"chilunsheji.h"
#include"LoadDlg.h"
#include"ProMenu.h"
#include"ProUtil.h"
#include"ProMenubar.h"
#include
///////////////Functionsdeclaration
intGearDesign1MenuActFn();
staticuiCmdAccessStateAccessAvailable(uiCmdAccessMode);
#ifdef_DEBUG
#definenewDEBUG_NEW
#endif
intGearDesign1();
intGearDesign2();
//CchilunshejiApp
BEGIN_MESSAGE_MAP(CchilunshejiApp,CWinApp)
END_MESSAGE_MAP()
//CchilunshejiApp构造
CchilunshejiApp:
:
CchilunshejiApp()
//唯一的一个CchilunshejiApp对象
CchilunshejiApptheApp;
//CchilunshejiApp初始化
///////////////FUNCTION:
user_initialize()
extern"C"intuser_initialize()
{
ProErrorstatus;
ProFileNameMsgFile;
uiCmdCmdIdPushButton_cmd_id;
ProStringToWstring(MsgFile,"Message1.txt");//设置菜单信息文件名//
status=ProMenubarMenuAdd("GearDesign","GearDesign",
"Utilities",PRO_B_TRUE,MsgFile);
ProCmdActionAdd("PushButtonAct",(uiCmdCmdActFn)GearDesign1MenuActFn,
uiCmdPrioDefault,AccessAvailable,PRO_B_TRUE,PRO_B_TRUE,&PushButton_cmd_id);
ProMenubarmenuPushbuttonAdd("GearDesign","GearDesign1","GearDesign1","GearDesign
1",NULL,PRO_B_TRUE,PushButton_cmd_id,MsgFile);
returnstatus;
ProMenubarmenuPushbuttonAdd("GearDesign","GearDesign2","GearDesign2","GearDesign
2",NULL,PRO_B_TRUE,PushButton_cmd_id,MsgFile);
66
returnstatus;
}
/////////////////////FUNCTION:
user_terminate()
extern"C"voiduser_terminate()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
}
BOOLCchilunshejiApp:
:
InitInstance()
{
CWinApp:
:
InitInstance();
returnTRUE;
}
staticuiCmdAccessStateAccessAvailable(uiCmdAccessModeaccess_mode)
{
return(ACCESS_AVAILABLE);
}
二、齿轮设计对话框实现文件
#include"stdafx.h"
#include"chilunsheji.h"
#include"LoadDlg.h"
#include"LoadDlg2.h"
#include"LoadDlg3.h"
#include"LoadDlg4.h"
#include
#include
#include"ProUtil.h"
#include
#include
#include
IMPLEMENT_DYNAMIC(CLoadDlg,CDialog)
CLoadDlg:
:
CLoadDlg(CWnd*pParent/*=NULL*/)
:
CDialog(CLoadDlg:
:
IDD,pParent)
{
}
CLoadDlg:
:
~CLoadDlg()
{
}
voidCLoadDlg:
:
DoDataExchange(CDataExchange*pDX)
{
CDialog:
:
DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CLoadDlg,CDialog)
67
returnstatus;
}
/////////////////FUNCTION:
user_terminate()
extern"C"voiduser_terminate()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
}
BOOLCchilunshejiApp:
:
InitInstance()
{
CWinApp:
:
InitInstance();
returnTRUE;
}
staticuiCmdAccessStateAccessAvailable(uiCmdAccessModeaccess_mode)
{
return(ACCESS_AVAILABLE);
}
二、齿轮设计对话框实现文件
#include"stdafx.h"
#include"chilunsheji.h"
#include"LoadDlg.h"
#include"LoadDlg2.h"
#include"LoadDlg3.h"
#include"LoadDlg4.h"
#include
#include
#include"ProUtil.h"
#include
#include
#include
IMPLEMENT_DYNAMIC(CLoadDlg,CDialog)
CLoadDlg:
:
CLoadDlg(CWnd*pParent/*=NULL*/)
:
CDialog(CLoadDlg:
:
IDD,pParent)
{
}
CLoadDlg:
:
~CLoadDlg()
{
}
voidCLoadDlg:
:
DoDataExchange(CDataExchange*pDX)
{
CDialog:
:
DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CLoadDlg,CDialog)
67
ON_BN_CLICKED(IDC_BUTTON1,&CLoadDlg:
:
OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2,&CLoadDlg:
:
OnBnClickedButton2)
ON_BN_CLICKED(IDC_BUTTON3,&CLoadDlg:
:
OnBnClickedButton3)
END_MESSAGE_MAP()
voidCLoadDlg:
:
OnBnClickedButton1()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
intstatus;
CLoadDlg2LoadDlg;
status=LoadDlg.DoModal();
}
voidCLoadDlg:
:
OnBnClickedButton2()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
intstatus;
CLoadDlg3LoadDlg;
status=LoadDlg.DoModal();
}
voidCLoadDlg:
:
OnBnClickedButton3()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
intstatus;
CLoadDlg4LoadDlg;
status=LoadDlg.DoModal();
}
三、直齿圆柱齿轮对话框实现文件
//LoadDlg2.cpp:
实现文件
#include"stdafx.h"
#include"chilunsheji.h"
#include"LoadDlg2.h"
#include
#include
#include"ProUtil.h"
#include
#include
#include
IMPLEMENT_DYNAMIC(CLoadDlg2,CDialog)
CLoadDlg2:
:
CLoadDlg2(CWnd*pParent/*=NULL*/)
:
CDialog(CLoadDlg2:
:
IDD,pParent)
{
M_Z=17;
M_ANGLE=20;
68
M_C=0.25;
M_M=10;
M_HA=1;
M_B=100;
M_D=0;
M_DB=0;
M_DA=0;
M_TIP_RAD=0;
M_DF=0;
}
CLoadDlg2:
:
~CLoadDlg2()
{
}
BEGIN_MESSAGE_MAP(CLoadDlg2,CDialog)
ON_BN_CLICKED(IDOK,&CLoadDlg2:
:
OnBnClickedOk)
ON_BN_CLICKED(IDCANCLE,&CLoadDlg2:
:
OnBnClickedCancle)
ON_BN_CLICKED(IDC_mokuaichongsheng,&CLoadDlg2:
:
OnBnClickedmokuaichongsheng)
END_MESSAGE_MAP()
voidCLoadDlg2:
:
OnBnClickedOk()
{
OnOK();
ProMdlmodel;
ProModelitemmodelitem;
ProName
ParamName1,ParamName2,ParamName3,ParamName4,ParamName5,ParamName6;
//wchar_t*ParamName;
ProParameterparam1,param2,param3,param4,param5,param6;
ProParamvaluevalue1,value2,value3,value4,value5,value6;
ProErrorstatus;
UpdateData(true);
status=ProMdlCurrentGet(&model);
if(status!
=PRO_TK_NO_ERROR)
return;
ProMdlToModelitem(model,&modelitem);
ProStringToWstring(ParamName1,"Z");
ProStringToWstring(ParamName2,"ANGLE");
ProStringToWstring(ParamName3,"C");
ProStringToWstring(ParamName4,"M");
ProStringToWstring(ParamName5,"HA");
ProStringToWstring(ParamName6,"B");
status=ProParameterInit(&modelitem,ParamName1,¶m1);
status=ProParameterInit(&modelitem,ParamName2,¶m2);
status=ProParameterInit(&modelitem,ParamName3,¶m3);
69
status=ProParameterInit(&modelitem,ParamName4,¶m4);
status=ProParameterInit(&modelitem,ParamName5,¶m5);
status=ProParameterInit(&modelitem,ParamName6,¶m6);
if(status==PRO_TK_NO_ERROR)
{
ProParameterValueGet(¶m1,&value1);
value1.value.d_val=M_Z;
ProParameterValueSet(¶m1,&value1);//Z
ProParameterValueGet(¶m2,&value2);
value2.value.d_val=M_ANGLE;
ProParameterValueSet(¶m2,&value2);//ANGLE
ProParameterValueGet(¶m3,&value3);
value3.value.d_val=M_C;
ProParameterValueSet(¶m3,&value3);//C
ProParameterValueGet(¶m4,&value4);
value4.value.d_val=M_M;
ProParameterValueSet(¶m4,&value4);//M
//获得参数值(HA)
ProParameterValueGet(¶m5,&value5);
value5.value.d_val=M_HA;
ProParameterValueSet(¶m5,&value5);//HA
ProParameterValueGet(¶m6,&value6);
value6.value.d_val=M_B;
ProParameterValueSet(¶m6,&value6);//B
ProSolidRegenerate((ProSolid)model,PRO_B_TRUE);
ProWindowRepaint(PRO_VALUE_UNUSED);
UpdateData(false);
}
}
voidCLoadDlg2:
:
OnBnClickedCancle()
{
OnCancel();
}
voidCLoadDlg2:
:
OnBnClickedmokuaichongsheng()
{
{
ProMdlmodel;
ProModelitemmodelitem;
ProName
ParamName1,ParamName2,ParamName3,ParamName4,ParamName5,ParamName6;
//wchar_t*ParamName;
ProParameterparam1,param2,param3,param4,param5,param6;
ProParamvaluevalue1,value2,value3,value4,value5,value6;
70
ProErrorstatus;
UpdateData(true);
status=ProMdlCurrentGet(&model);
if(status!
=PRO_TK_NO_ERROR)
return;
ProMdlToModelitem(model,&modelitem);
ProStringToWstring(ParamName1,"Z");
ProStringToWstring(ParamName2,"ANGLE");
ProStringToWstring(ParamName3,"C");
ProStringToWstring(ParamName4,"M");
ProStringToWstring(ParamName5,"HA");
ProStringToWstring(ParamName6,"B");
status=ProParameterInit(&modelitem,ParamName1,¶m1);
status=ProParameterInit(&modelitem,ParamName2,¶m2);
status=ProParameterInit(&modelitem,ParamName3,¶m3);
status=ProParameterInit(&modelitem,ParamName4,¶m4);
status=ProParameterInit(&modelitem,ParamName5,¶m5);
status=ProParameterInit(&modelitem,ParamName6,¶m6);
if(status==PRO_TK_NO_ERROR)
{
ProParameterValueGet(¶m1,&value1);
value1.value.d_val=M_Z;
ProParameterValueSet(¶m1,&value1);//Z
ProParameterValueGet(¶m2,&value2);
value2.value.d_val=M_ANGLE;
ProParameterValueSet(¶m2,&value2);//ANGLE
ProParameterValueGet(¶m3,&value3);
value3.value.d_val=M_C;
ProParameterValueSet(¶m3,&value3);//C
ProParameterValueGet(¶m4,&value4);
value4.value.d_val=M_M;
ProParameterValueSet(¶m4,&value4);//M
ProParameterValueGet(¶m5,&value5);
value5.value.d_val=M_HA;
ProParameterValueSet(¶m5,&value5);//HA
ProParameterValueGet(¶m6,&value6);
value6.value.d_val=M_B;
ProParameterValueSet(¶m6,&value6);//B
M_D=M_Z*M_M;//D
M_DB=M_D*cos(M_ANGLE);//DB
M_DA=M_D+2*M_M*M_HA;//DA
M_TIP_RAD=3.1415*M_M/8;//TIP_RAD
M_DF=M_D-2*M_M*(M_HA+M_C);//DF
71
ProSolidRegenerate((ProSolid)model,PRO_B_TRUE);
ProWindowRepaint(PRO_VALUE_UNUSED);
UpdateData(false);
}
}
}
BOOLCLoadDlg2:
:
OnInitDialog()
{
CDialog:
:
OnInitDialog();
ProMdlmodel;
ProModelitemmodelitem;
ProName
ParamName1,ParamName2,ParamName3,ParamName4,ParamName5,ParamName6;
//wchar_t*ParamName;
ProParameterparam1,param2,param3,param4,param5,param6;
ProParamvaluevalue1,value2,value3,value4,value5,value6;
ProErrorstatus;
status=ProMdlCurrentGet(&model);
if(status!
=PRO_TK_NO_ERROR)
{
ProMdlToModelitem(model,&modelitem);
ProStringToWstring(ParamName1,"Z");
ProStringToWstring(ParamName2,"ANGLE");
ProStringToWstring(ParamName3,"C");
ProStringToWstring(ParamName4,"M");
ProStringToWstring(ParamName5,"HA");
ProStringToWstring(ParamName6,"B");
status=ProParameterInit(&modelitem,ParamName1,¶m1);
status=ProParameterInit(&modelitem,ParamName2,¶m2);
status=ProParameterInit(&modelitem,ParamName3,¶m3);
status=ProParameterInit(&modelitem,ParamName4,¶m4);
status=ProParamete
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 ProE 齿轮 参数 设计