iCAx开思工具箱

标题: 有关草图中的约束问题 [打印本页]

作者: lansehaiyu    时间: 2012-12-17 19:43
标题: 有关草图中的约束问题
(, 下载次数: 7)
我想通过草图中的二维约束来实现点.1和CenterPoint的相合约束。
点.1是通过直线.1的两个顶点CreatePointBetween来建立的。
CATIGSMPointBetween_var piCenterPoint = NULL_var;
  piCenterPoint = _pGSMFact->CreatePointBetween(pLinePoint1,pLinePoint2,ratioParm,CATGSMSameOrientation,CopySelectLine);
  if (piCenterPoint==NULL_var)
  {
   cout<<"创建中点失败,请检查!!!"<<endl;
   return FALSE;
  }
  else
   cout<<"创建中点成功!!!"<<endl;
CATISpecObject_var pLineCenterPoint = NULL_var;
  pLineCenterPoint=piCenterPoint;//存储中点
二维约束的实现
piSketch->OpenEdition();//关键
CATI2DConstraintFactory * spConstraint= NULL;
rc = piSketch->QueryInterface(IID_CATI2DConstraintFactory,(void **)&spConstraint);
if (SUCCEEDED(rc))
{
  cout<<"查询CATI2DConstraintFactory成功"<<endl;
  spConstraint->CreateConstraint( spLineFeat, NULL,CopySelectLine, NULL, NULL, NULL, NULL,
   Cst2DType_On, 0, 0 );
  spConstraint->CreateConstraint(spPointFeat, NULL,pLineCenterPoint, NULL, NULL, NULL, NULL,
     Cst2DType_On, 0, 0);
}
piSketch->CloseEdition();
其中第一个约束可以添加,第二个约束里如将pLineCenterPoint换为pLinePoint1,则可以实现约束。
为什么是pLineCenterPoint就不能实现呢?




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