找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 5457|回复: 1

[求助] 在参数化调用的时候出错,求大神帮忙看下代码

[复制链接]

1

主题

4

回帖

0

威望

实习生

积分
7
发表于 2015-8-25 10:09 | 显示全部楼层 |阅读模式
#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",&param1);
  ProParameterInit(&feature,L"BBB",&param2);
  ProParameterInit(&feature,L"CCC",&param3);
  ProParameterInit(&feature,L"H1",&param4);
  ProParameterInit(&feature,L"DD1",&param5);
  ProParameterInit(&feature,L"DD2",&param6);
  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(&param1,&value1);
  ProParameterValueSet(&param2,&value2);
  ProParameterValueSet(&param3,&value3);
  ProParameterValueSet(&param4,&value4);
  ProParameterValueSet(&param5,&value5);
  ProParameterValueSet(&param6,&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);这里有错误 ,但是我不会改,请大婶帮忙看看

1

主题

8

回帖

0

威望

实习生

积分
10
发表于 2024-3-18 14:51 | 显示全部楼层
同问,请问解决了吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

本站为非营利性站点,部分资源为网友搜集或发布,仅供学习和研究使用,如用于商业用途,请购买正版。站内所发布的资源,如有侵犯你的权益,请发邮件联系我们,本站将立即改正或删除。

手机版|小黑屋|野火论坛(©2007~2024) ( 苏ICP备11036728号-2 )苏公网安备 32039102000103号|站长QQ28016688

GMT+8, 2024-11-25 09:03 , Processed in 0.129668 second(s), 20 queries .

快速回复 返回顶部 返回列表