|  | 
 
| 请大侠帮忙看看啊。 cero二次开发,遍历尺寸函数问题: 这个问题纠结了几天了,请大侠帮我看看是什么问题,万分感谢! ProSolidDimensionVisit((ProSolid)mdl, PRO_B_FALSE, DimAction, NULL, NULL); 这个函数的第三个参数是调用DimAction函数,而我的程序运行时,为什么DimAction函数没有执行呢?
 
 下面是我的源码:  该实例是王伟老师《ProE野火版TOOLK IT二次开发入门与进阶》上的实例,自己加了一个简单的菜单,程序可以正常生产dll文件,但是在cero1.0上挂起后,运行,DimAction函数里的内容没打印出来。
 
 // Example2_1.cpp : Defines the initialization routines for the DLL.
 #include "stdafx.h"
 #include "Example2_1.h"
 /*--------------------------------------------------------------------*\
 Pro/TOOLKIT includes
 \*--------------------------------------------------------------------*/
 #include"ProMenu.h"
 #include"ProUtil.h"
 #include"ProMenubar.h"
 #include <ProSolid.h>
 #include <ProMdl.h>
 #include <ProWstring.h>
 /*--------------------------------------------------------------------*\
 Functions declaration
 \*--------------------------------------------------------------------*/
 int ShowMessageTest();
 static uiCmdAccessState AccessDefault (uiCmdAccessMode);
 ProError DimAction(ProDimension *dimension, ProError status, ProAppData data);
 /////////////////////////////////////////////////////////////////////////////
 #ifdef _DEBUG
 #define new DEBUG_NEW
 #undef THIS_FILE
 static char THIS_FILE[] = __FILE__;
 #endif
 // CExample2_1App
 BEGIN_MESSAGE_MAP(CExample2_1App, CWinApp)
 //{{AFX_MSG_MAP(CExample2_1App)
 // NOTE - the ClassWizard will add and remove mapping macros here.
 //    DO NOT EDIT what you see in these blocks of generated code!
 //}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 /////////////////////////////////////////////////////////////////////////////
 // CExample2_1App construction
 CExample2_1App::CExample2_1App()
 {
 // TODO: add construction code here,
 // Place all significant initialization in InitInstance
 }
 /////////////////////////////////////////////////////////////////////////////
 // The one and only CExample2_1App object
 CExample2_1App theApp;
 //
 /*=======================================================================*\
 FUNCTION: user_initialize()
 \*=======================================================================*/
 extern "C" int user_initialize()
 {
 ProError     status;
 ProFileName  message_file;
 uiCmdCmdId   cmd_id;
 status = ProCmdActionAdd("ShowTest",
 (uiCmdCmdActFn)ShowMessageTest,
 uiCmdPrioDefault,AccessDefault,
 PRO_B_TRUE,PRO_B_TRUE,&cmd_id);
 status = ProMenubarmenuPushbuttonAdd(
 "Utilities", "ShowMessageTest", "ShowMessageTest",
 "Active ShowMessageTest menu", NULL,
 PRO_B_TRUE, cmd_id, ProStringToWstring(message_file, "Message2.txt"));
 return status;
 }
 /*===============================================================*\
 FUNCTION: user_terminate()
 \*===============================================================*/
 extern "C" void user_terminate()
 {
 AFX_MANAGE_STATE(AfxGetStaticModuleState());
 }
 /*================================================================*\
 FUNCTION: AccessDefault()
 \*================================================================*/
 static uiCmdAccessState AccessDefault (uiCmdAccessMode access_mode)
 {
 return (ACCESS_AVAILABLE);
 }
 /*================================================================*\
 FUNCTION: ShowMessageTest()
 \*================================================================*/
 int ShowMessageTest()
 {
 ProMdl mdl;
 ProMdlCurrentGet(&mdl);
 // 依次访问每一个尺寸,并调用“DimAction”来处理这些尺寸
 ProSolidDimensionVisit((ProSolid)mdl, PRO_B_FALSE, DimAction, NULL, NULL);
 ProSolidRegenerate((ProSolid)mdl, PRO_REGEN_NO_FLAGS); //更新模型
 AfxMessageBox("Pro/TOOLKIT应用程序1成功运行!",MB_OK);   //  这个是调试用的,弹出对话框,以便确定函数是否执//行到这里
 return true;
 }
 ProError DimAction(ProDimension *dimension, ProError status, ProAppData data)
 {
 AfxMessageBox("Pro/TOOLKIT应用程序2开始运行!",MB_OK);
 ProName symbol, dim_name;
 ProStringToWstring(dim_name, "LENTH");
 ProDimensionSymbolGet(dimension, symbol); //获取传入的尺寸符号
 int result;
 ProWstringCompare(symbol, dim_name, PRO_VALUE_UNUSED, &result);
 double dim_value = 0;
 if(result == 0) //如果是我们的“LENTH”尺寸
 {
 ProDimensionValueGet(dimension, &dim_value);
 CString show;
 show.Format("current dim value is : %f", dim_value);
 AfxMessageBox(show); //输出尺寸值
 dim_value = 300;
 ProDimensionValueSet(dimension, dim_value); //设置一个新数值
 }
 AfxMessageBox("Pro/TOOLKIT应用程序2成功运行!",MB_OK);
 return PRO_TK_NO_ERROR;
 }
 | 
 |