找回密码 注册 QQ登录
开思网工业级高精度在线3D打印服务

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?快速3D打印 手板模型CNC加工服务在线3D打印服务,上传模型,自动报价
查看: 16228|回复: 2
打印 上一主题 下一主题

[求助] 新人求助-大家帮忙看看代码哪儿出错了啊?

[复制链接]
跳转到指定楼层
1
发表于 2012-12-31 14:53:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
求大神指点。。。刚接触二次开发,照例子做,生成一个NURBS曲面,代码贴进去后,调试没错误,但CATIA显示“单击确定终止”,看不出错误啊
代码如下:
CATFrmEditor* pEditor = CATFrmEditor::GetCurrentEditor();
CATDocument*pDoc = pEditor->GetDocument();
CATIContainerOfDocument_var spConODocs = pDoc;
CATIContainer* spCGMContainer= NULL;
HRESULT hr = spConODocs->GetResultContainer(spCGMContainer);
CATGeoFactory_var piGeomFactory = spCGMContainer;
int nbPoleU = 5;
int nbPoleV = 5;
CATMathGridOfPoints gridOfPoints(nbPoleU,nbPoleV);
   
// Row 0
gridOfPoints.SetPoint(CATMathPoint( 0., 0., 0.),0,0);
gridOfPoints.SetPoint(CATMathPoint(10., 0., 0.),0,1);
gridOfPoints.SetPoint(CATMathPoint(20., 0., 0.),0,2);
gridOfPoints.SetPoint(CATMathPoint(30., 0., 0.),0,3);
gridOfPoints.SetPoint(CATMathPoint(40., 0., 0.),0,4);
   
// Row 1
gridOfPoints.SetPoint(CATMathPoint( 0.,10., 0.),1,0);
gridOfPoints.SetPoint(CATMathPoint(10.,10.,-10.),1,1);
gridOfPoints.SetPoint(CATMathPoint(20.,10.,-10.),1,2);
gridOfPoints.SetPoint(CATMathPoint(30.,10.,-10.),1,3);
gridOfPoints.SetPoint(CATMathPoint(40.,10., 0.),1,4);
   
// Row 2
gridOfPoints.SetPoint(CATMathPoint( 0.,20., 0.),2,0);
gridOfPoints.SetPoint(CATMathPoint(10.,20.,-40.),2,1);
gridOfPoints.SetPoint(CATMathPoint(20.,20.,-40.),2,2);
gridOfPoints.SetPoint(CATMathPoint(30.,20., -40.),2,3);
gridOfPoints.SetPoint(CATMathPoint(40.,20., 0.),2,4);
   
// Row 4
gridOfPoints.SetPoint(CATMathPoint( 0.,30., 0.),3,0);
gridOfPoints.SetPoint(CATMathPoint(10.,30., -10.),3,1);
gridOfPoints.SetPoint(CATMathPoint(20.,30., -10.),3,2);
gridOfPoints.SetPoint(CATMathPoint(30.,30., -10.),3,3);
gridOfPoints.SetPoint(CATMathPoint(40.,30., 0.),3,4);
   
// Row 5
gridOfPoints.SetPoint(CATMathPoint( 0.,40., 0.),4,0);
gridOfPoints.SetPoint(CATMathPoint(10.,40., 0.),4,1);
gridOfPoints.SetPoint(CATMathPoint(20.,40., 0.),4,2);
gridOfPoints.SetPoint(CATMathPoint(30.,40., 0.),4,3);
gridOfPoints.SetPoint(CATMathPoint(40.,40., 0.),4,4);
//This code creates the knot vectors:
CATLONG32 IsPeriodic= 0;
CATLONG32 Degree= 4;
CATLONG32 KnotsCount= 2;
double Knots[]= {0.,10.};
CATLONG32 Multiplicities[]= {5,5};
CATLONG32 IndexOffset= 1;
   
CATKnotVector NonUniformU(Degree,IsPeriodic,KnotsCount,Knots,
Multiplicities,IndexOffset);
CATKnotVector NonUniformV(Degree,IsPeriodic,KnotsCount,Knots,
Multiplicities,IndexOffset);

CATLONG32 isRational=1;
double * aWeights=new double[nbPoleU*nbPoleV];
for (int i = 0; i < nbPoleU*nbPoleV; i++)
{
aWeights[i] = 1.;
}
CATNurbsSurface * piSurf1 = piGeomFactory->CATCreateNurbsSurface(NonUniformU, NonUniformV,isRational,gridOfPoints,aWeights);

delete [] aWeights;
aWeights = NULL;

CATSurLimits surMaxLimits ;
piSurf1->GetMaxLimits(surMaxLimits) ;
   
CATSoftwareConfiguration * pConfig = new CATSoftwareConfiguration();
CATTopData topdata(pConfig);
   
CATTopSkin * pSkinOpe =::CATCreateTopSkin(piGeomFactory,&topdata,piSurf1,&surMaxLimits);
pSkinOpe->Run();

CATBody * piSkinBody = pSkinOpe->GetResult();

delete pSkinOpe;
pSkinOpe=NULL;
//Next you will instanciate the datum from the CATBody:
CATIDatumFactory_var spDatumFactory= NULL_var;
spDatumFactory = spCGMContainer;
CATISpecObject* oDatumFeature;
spDatumFactory->InstanciateDatum(piSkinBody, oDatumFeature);
CATISpecObject_var spCurObj = oDatumFeature;
oDatumFeature->Update();
CATIPrtProceduralView_var aa=spCurObj;
aa->InsertInProceduralView();
pConfig->Release();
}

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
2
发表于 2013-3-22 09:56:23 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
3
发表于 2023-12-22 11:09:03 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

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

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2024-11-22 07:53 , Processed in 0.022189 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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