iCAx开思网
标题:
如何建立草图里面元素间的约束?
[打印本页]
作者:
zsong22
时间:
2012-11-20 21:13
标题:
如何建立草图里面元素间的约束?
CATI2DWFFactory_var spWF2DFactOnSketch(spSketch);
// Creates the elements of the sketch
double pt1[2] = {10., 5.},
pt2[2] = {-10., 5.},
pt3[2] = {-10., -5.},
pt4[2] = {10., -5.};
// Edits the sketch and draws the lines and the endpoints.
spSketch->OpenEdition();
CATISpecObject_var spLine1 = spWF2DFactOnSketch->CreateLine(pt1,pt2);
CATISpecObject_var spLine2 = spWF2DFactOnSketch->CreateLine(pt2,pt3);
CATISpecObject_var spLine3 = spWF2DFactOnSketch->CreateLine(pt3,pt4);
CATISpecObject_var spLine4 = spWF2DFactOnSketch->CreateLine(pt4,pt1);
CATISpecObject_var spCircle = spWF2DFactOnSketch->CreateCircle(pt4,50,0,3.14);
如上 我打算创建一个矩形框 并以Pt4为圆心创建圆弧 。但是,由于没有约束,这些线条与圆在草图中都是活动的,并没有固定下来。
求帮助 谢谢!
作者:
linlily0925
时间:
2012-11-21 08:31
本帖最后由 linlily0925 于 2012-11-21 08:38 编辑
CATI2DConstraintFactory
CATI2DConstraintFactory_var spConstraint2DFactory(spSketch);
spConstraint2DFactory->CreateConstraint( spLine1, NULL, NULL, NULL, NULL, NULL, NULL, Cst2DType_Horizontal, 0, 0 );
spConstraint2DFactory->CreateConstraint( spLine2, NULL, NULL, NULL, NULL, NULL, NULL, Cst2DType_Vertical, 0, 0 );
spConstraint2DFactory->CreateConstraint( spLine3, NULL, NULL, NULL, NULL, NULL, NULL,Cst2DType_Horizontal, 0, 0 );
spConstraint2DFactory->CreateConstraint( spLine4, NULL, NULL, NULL, NULL, NULL, NULL, Cst2DType_Vertical, 0, 0 );
spConstraint2DFactory->CreateConstraint( spLine2, NULL, NULL, NULL, NULL, NULL, NULL, Cst2DType_Length, 0, 0 );
spConstraint2DFactory->CreateConstraint( spLine2, NULL, spLine4, NULL, NULL, NULL, NULL, Cst2DType_Distance, 0, 0 );
作者:
zsong22
时间:
2012-11-21 10:13
谢谢 丽丽! 在草图中 如何将一个创建的 CATI2DCurve 与CATI2DPoint 定义为相合呢? 或者两个CATI2DPoint 间定义为重合。
作者:
zsong22
时间:
2012-11-21 10:24
知道了 用Cst2DType_On 命令
作者:
linlily0925
时间:
2012-11-21 10:53
zsong22 发表于 2012-11-21 10:24
知道了 用Cst2DType_On 命令
恩恩,根据需要创建的约束类型 设置参数CAT2DCstType
欢迎光临 iCAx开思网 (https://www.icax.org/)
Powered by Discuz! X3.3