1)创建三个点(参见教程5)
2) 将点连成线(参见教程6)
3) 通过三点创建一个参考平面,后面进行圆弧倒角时要用到该平面。
CATIGSMPlane3Points_var Supportplane = spGSMFactory->CreatePlane(spPoint1, spPoint2,spPoint3);
CATISpecObject_var spSupportplane = Supportplane;
4) 创建倒角半径的参数:
CATICkeParm_var Radius1 = NULL_var;
CATICkeMagnitude_var spRadMag = spParamDictionary->FindMagnitude("LENGTH");
CATUnicodeString name("Radius 1");
Radius1 = spParmFactory->CreateDimension(spRadMag,name, .01);
5) 创建倒角::
CATIGSMCorner_var Corner1 = spGSMFactory->CreateCorner(spLine1,
spLine2,
spSupportplane,
Radius1,
CATGSMSameOrientation,
CATGSMSameOrientation,
FALSE);
CATISpecObject_var spCorner1 = Corner1;
6) 裁剪去多余的线和点:
CATIGSMSplit_var Split1 = spGSMFactory->CreateSplit(spLine1,
spRadius1,
CATGSMSameOrientation);
CATISpecObject_var spSplit1 = Split1;
CATIGSMSplit_var Split1a = spGSMFactory->CreateSplit(spSplit1,
spRadius3,
CATGSMInvertOrientation);
CATISpecObject_var spSplit1a = Split1a;
7) 将线和圆弧依次连接起来,创建一个序列:
CATLISTV(CATISpecObject_var) joincurves;
joincurves.Append(spSplit1a);
joincurves.Append(spSplit2a);
joincurves.Append(spSplit3a);
joincurves.Append(spRadius1);
joincurves.Append(spRadius2);
joincurves.Append(spRadius3);
8)在讲序列连接起来之前,需要创建一个最小的结合距离:
CATICkeParm_var Mergedist = NULL_var;
CATICkeMagnitude_var spMergedist = spParamDictionary->FindMagnitude("LENGTH");
CATUnicodeString mergename("Merge Distance");
Mergedist = spParmFactory->CreateDimension(spMergedist,
mergename,
.0001);
9)连接起来并插入到视图中:
Now we can join this list of objects into a single shape and insert it into the part.
CATIGSMAssemble_var CurveAssy = spGSMFactory->CreateAssemble(joincurves,
Mergedist,
FALSE);
CATISpecObject_var spCurveAssy = CurveAssy;
spCurveAssy->Update();
CATIGSMProceduralView_var spCurObj = Curveassembly;
spCurObj->InsertInProceduralView();