列兵
UID2466229
U币0
G币0
技术0
主题4
精华0
阅读权限10
注册时间2011-5-30
最后登录1970-1-1
在线时间0 小时
列兵
|
#include "stdafx.h"
/*--------------------------------------------------------------------*\
Pro/TOOLKIT includes
\*--------------------------------------------------------------------*/
#include <ProSolid.h>
#include "ProUtil.h"
#include <ProWindows.h>
#include <ProUIDialog.h>
#include <ProUIPushbutton.h>
#include <ProUIInputpanel.h>
#include <ProArray.h>
#include <ProParameter.h>
#include <ProParamval.h>
#include <ProUILabel.h>
#include <ProToolkit.h>
#include <ProUtil.h>
#include <ProDimension.h>
#include <ProSolid.h>
#include <ProMessage.h>
#include <ProMenu.h>
#include <ProMenuBar.h>
#include <ProMdl.h>
#include <ProModelitem.h>
#include <ProDrawing.h>
#include <ProFeature.h>
#include <ProFeatType.h>
#include <ProDrawing.h>
#include <ProNotify.h>
#include <ProRefInfo.h>
#include <ProRelSet.h>
#include <ProSelection.h>
#include <ProUICmd.h>
#include <ProNotify.h>
#include <ProPopupmenu.h>
#include <ProSelbuffer.h>
#define OK 1
#define CANCEL 0
//ProParameter *p_data; //参数对象指针数组(全局变量)
/*--------------------------------------------------------------------*\
Functions declaration 函数声明
\*--------------------------------------------------------------------*/
void CANCEL_Action(char *, char *, ProAppData);
void Update3_Action(char *, char *, ProAppData);
void ParamUpdate(char *,char *,char *,ProModelitem *);
void Userdefined3_Action(char *, char *, ProAppData);
/*=========================================================*\
FUNCTION: Duangai3Fn()
\*=========================================================*/
int Duangai3Fn()
{
ProError status;
char *dialog_name = "Duangai3";
int ActiveDialog_status;
/*----------------------------------------------------------------*\
装入对话框资源
\*----------------------------------------------------------------*/
status=ProUIDialogCreate(dialog_name,dialog_name );
if (status!=PRO_TK_NO_ERROR)
{
AfxMessageBox("UIDialog CreateCreate error!");
return status;
}
//设置Cancel按钮的动作函数
ProUIPushbuttonActivateActionSet (dialog_name, "Cancel",
CANCEL_Action, NULL);
//设置Update3按钮的动作函数
ProUIPushbuttonActivateActionSet (dialog_name, "Update3",
Update3_Action, NULL);
//设置Userdefined3按钮的动作函数
ProUIPushbuttonActivateActionSet (dialog_name, "Userdefined3",
Userdefined3_Action, NULL);
/*----------------------------------------------------------------*\
显示和激活对话框
\*----------------------------------------------------------------*/
status=ProUIDialogActivate(dialog_name,&ActiveDialog_status);
if (status!=PRO_TK_NO_ERROR)
{
AfxMessageBox("UIDialogActivate error!");
return status;
}
/*----------------------------------------------------------------*\
从内存清除对话框资源
\*----------------------------------------------------------------*/
status=ProUIDialogDestroy (dialog_name);
if (status!=PRO_TK_NO_ERROR)
{
AfxMessageBox("UIDialogDestroy error!");
return status;
}
return status;
}
/*=========================================================*\
FUNCTION : ParamUpdate (更新参数值)
\*=========================================================*/
void ParamUpdate(char *dialog, //(In)对话框名
char *component, //(In)输入框元件名
char *Name, //(In)参数名
ProModelitem *modelitem) //(In)模型项
{
wchar_t ParamName,*NewValue;
ProParameter param;
ProParamvalue value;
ProCharLine strtmp;
ProStringToWstring(&ParamName,Name);
//根据指定的参数名获得参数对象指针
ProParameterInit(modelitem,&ParamName,¶m);
ProUIInputpanelValueGet(dialog,component,&NewValue);
ProWstringToString(strtmp,NewValue);
//获得参数值
ProParameterValueGet(¶m, &value);
switch( value.type )
{
case PRO_PARAM_DOUBLE:
value.value.d_val=atof(strtmp);
break;
case PRO_PARAM_INTEGER:
value.value.i_val=atoi(strtmp);
break;
}
//新的参数值设置
ProParameterValueSet(¶m, &value);
}
/*=========================================================*\
FUNCTION Update3_Action ("Update"按钮的动作函数定义)
\*=========================================================*/
void Update3_Action(char *dialog, char *component, ProAppData data)
{
ProMdl model;
ProModelitem modelitem;
ProMdlCurrentGet(&model);
ProMdlRetrieve(L"./sheji/Release/text/chinese_cn/Duangai3.prt", (ProMdlType)PRO_PART,(ProMdl*)&model);
ProMdlDisplay(model);
ProMdlToModelitem(model, &modelitem);
ParamUpdate(dialog,"D_Value","D",&modelitem);
ParamUpdate(dialog,"DA_Value","DA",&modelitem);
ParamUpdate(dialog,"DB_Value","DB",&modelitem);
ParamUpdate(dialog,"DC_Value","DC",&modelitem);
ParamUpdate(dialog,"SD_Value","SD",&modelitem);
ParamUpdate(dialog,"SB_Value","SB",&modelitem);
ParamUpdate(dialog,"R_Value","R",&modelitem);
ParamUpdate(dialog,"B_Value","B",&modelitem);
//模型再生
ProSolidRegenerate ((ProSolid)model,PRO_B_TRUE);
ProWindowRepaint(PRO_VALUE_UNUSED);
}
/*=========================================================*\
FUNCTION: Userdefined3_Action
\*=========================================================*/
void Userdefined3_Action(char *dialog, char *component, ProAppData data)
{
ProError status;
char *dialog_name = "Duangai3_1";
int ActiveDialog_status;
/*----------------------------------------------------------------*\
装入对话框资源
\*----------------------------------------------------------------*/
status=ProUIDialogCreate(dialog_name,dialog_name );
if (status!=PRO_TK_NO_ERROR)
{
AfxMessageBox("UIDialog CreateCreate error!");
}
//设置Cancel按钮的动作函数
ProUIPushbuttonActivateActionSet (dialog_name, "Cancel",
CANCEL_Action, NULL);
//设置Update3按钮的动作函数
ProUIPushbuttonActivateActionSet (dialog_name, "Update3",
Update3_Action, NULL);
/*----------------------------------------------------------------*\
显示和激活对话框
\*----------------------------------------------------------------*/
status=ProUIDialogActivate(dialog_name,&ActiveDialog_status);
if (status!=PRO_TK_NO_ERROR)
{
AfxMessageBox("UIDialogActivate error!");
}
/*----------------------------------------------------------------*\
从内存清除对话框资源
\*----------------------------------------------------------------*/
status=ProUIDialogDestroy (dialog_name);
if (status!=PRO_TK_NO_ERROR)
{
AfxMessageBox("UIDialogDestroy error!");
}
} |
|