iCAx开思工具箱

标题: eric老大!跪求help! [打印本页]

作者: shu007    时间: 2009-4-17 14:10
标题: eric老大!跪求help!
proselect() 函数运行了,可是却无法在界面上交互选择啊!求教高手!!!!


#include "ProToolkit.h"
#include "ProMdl.h"
#include "ProSolid.h"
#include "ProObjects.h"
#include "ProWstring.h"
#include "ProUtil.h"
#include "ProWindows.h"
#include "ProEdge.h"
#include "ProMessage.h"



int user_initialize(int argc,char*argv[])
{
        
        double h;
        double seleedges();
        h=seleedges();
        printf("h is %f",h);
        return(0);
}
void user_terminate()
{
//printf("pro/toolkit application terminated successfully\n");
return;
}
double seleedges()
{
        ProMdl model;
ProSelection *sel=NULL;
int n_sel,i;
int b;
ProModelitem current_model_item;
double length,totlength=0.0;
ProEdge currentedge;
ProWindowRepaint(PRO_VALUE_UNUSED);

ProSelect("edge",-1,NULL,NULL,NULL,NULL,&sel,&n_sel);
for(i=0;i<n_sel;i++)
{
ProSelectionModelitemGet(sel[i],&current_model_item);
ProGeomitemToEdge(&current_model_item,&currentedge);
ProEdgeLengthEval(currentedge,&length);
totlength=totlength+length;

}

return totlength;
}
作者: DavidJiang    时间: 2009-4-17 22:30
:stupid:,楼主叫错地方了吧!
我来告诉你这段程序有什么问题,ProSelect()函数不能在程序注册时调用,因为注册程序的对话框是个非模式对话框,如果不退出啥也做不了,可以考虑先添加一个菜单。
还有ProSelect("edge",-1,NULL,NULL,NULL,NULL,sel,&n_sel);函数中sel需要改为&sel。
作者: shu007    时间: 2009-4-18 10:08
谢谢davidjiang啊!我是典型的入门级菜鸟,见笑了!等我试试您的意见,先表示感谢!




欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3