|
#include "stdafx.h"
#define PRO_USE_VAR_ARGS 1
#include "test.h"
#include "roToolkit.h"
#include "roMenu.h"
#include "roMenuBar.h"
#include "ProUtil.h"
#include "ProParameter.h"
#include "ProSolid.h"
#include "iostream"
#include "ProMdl.h"
#include "ProArray.h"
#include "ProModelItem.h"
#include "ProMessage.h"
#include <ProUI.h>
#include <ProUILabel.h>
#include <ProGraphic.h>
#include <ProView.h>
#include <ProObjects.h>
#include <TestError.h>
#include <ProMdl.h>
#include <ProUICmd.h>
#include <ProUIMessage.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <ProUIDialog.h>
#include <ProUIPushbutton.h>
#include <ProUIInputpanel.h>
#include <ProSolid.h>
#include "ProToolkitDll.h"
#include <ProToolkitErrors.h>
#include <ProModelitem.h>
#include <ProWindows.h>
#include <ProMessage.h>
#include <ProObjects.h>
void Sinneedle1(char*,char*,ProAppData);
void sinneedle1ok(char*,char*,ProAppData);
void UsrCancelAction(char*,char*,ProAppData);
static uiCmdAccessState UserAccessTestMenu (uiCmdAccessMode);
extern "C" int user_initialize()
{
AfxEnableControlContainer();
ProError status;
ProName menumsgfile;
uiCmdCmdId cmd_id;
//在Help菜单的左边添加Test菜单
ProStringToWstring(menumsgfile,"usermsg.txt");
status = ProMenubarMenuAdd("Test","Test","Help", PRO_B_FALSE,menumsgfile);
status = ProCmdActionAdd("MyTest",(uiCmdCmdActFn)Sinneedle1,uiCmdPrioDefault,UserAccessTestMenu,PRO_B_TRUE,PRO_B_TRUE,&cmd_id);
status = ProMenubarmenuPushbuttonAdd("Test","Hello","Hello","Hello Help",NULL,PRO_B_TRUE,cmd_id,menumsgfile);
return(0);
}
static uiCmdAccessState UserAccessTestMenu(uiCmdAccessMode access_mode)
{
return (ACCESS_AVAILABLE);
}
void Sinneedle1(char*dialog,char*component,ProAppData data)
{
int status502;
ProUIDialogCreate("sinneedle","sinneedle");
ProUIPushbuttonActivateActionSet("sinneedle","Cancel",UsrCancelAction,NULL);
ProUIPushbuttonActivateActionSet("sinneedle","Update",sinneedle1ok,NULL);
ProUIDialogActivate("sinneedle",&status502);
ProUIDialogDestroy("sinneedle");
}
void sinneedle1ok(char*dialog,char*component,ProAppData data)
{
ProMdl part;
ProParameter param1;
ProParameter param2;
ProParameter param3;
ProParameter param4;
ProParameter param5;
ProParameter param6;
ProParamvalue value1;
ProParamvalue value2;
ProParamvalue value3;
ProParamvalue value4;
ProParamvalue value5;
ProParamvalue value6;
ProModelitem feature;
int i;
double A1,B1,C1,H1,D1,D2;
ProMdlRetrieve(L"D:\\PROEwj\\test\\text\\prt0002.prt",PRO_MDL_PART,&part);
ProMdlDisplay(part);
ProModelitemInit(part,i,PRO_PART,&feature);
ProParameterInit(&feature,L"AAA",¶m1);
ProParameterInit(&feature,L"BBB",¶m2);
ProParameterInit(&feature,L"CCC",¶m3);
ProParameterInit(&feature,L"H1",¶m4);
ProParameterInit(&feature,L"DD1",¶m5);
ProParameterInit(&feature,L"DD2",¶m6);
ProUIInputpanelDoubleGet("sinneedle","A1",&A1);
ProUIInputpanelDoubleGet("sinneedle","B1",&B1);
ProUIInputpanelDoubleGet("sinneedle","H1",&H1);
ProUIInputpanelDoubleGet("sinneedle","D1",&D1);
ProUIInputpanelDoubleGet("sinneedle","D2",&D2);
ProUIInputpanelDoubleGet("sinneedle","C1",&C1);
value1.type=PRO_PARAM_DOUBLE;
value1.value.d_val=A1;
value2.type=PRO_PARAM_DOUBLE;
value2.value.d_val=B1;
value3.type=PRO_PARAM_DOUBLE;
value3.value.d_val=C1;
value4.type=PRO_PARAM_DOUBLE;
value4.value.d_val=H1;
value5.type=PRO_PARAM_DOUBLE;
value5.value.d_val=D1;
value6.type=PRO_PARAM_DOUBLE;
value6.value.d_val=D2;
ProParameterValueSet(¶m1,&value1);
ProParameterValueSet(¶m2,&value2);
ProParameterValueSet(¶m3,&value3);
ProParameterValueSet(¶m4,&value4);
ProParameterValueSet(¶m5,&value5);
ProParameterValueSet(¶m6,&value6);
ProSolidRegenerate((ProSolid)part,PRO_B_TRUE);
ProUIDialogExit(dialog,1);
}
void UsrCancelAction(char*dialog,char*component,ProAppData data)
{
ProUIDialogExit(dialog,1);
}
extern "C" void user_terminate()
{
}
代码如上,一直不能把输入的参数带入到零件中重新生成零件,感觉可能是 int i;ProModelitemInit(part,i,PRO_PART,&feature);这里有错误 ,但是我不会改,请大婶帮忙看看 |
|