有序几何图形集

创建有序几何图形集

创建测试点并将其隔离,加入有序几何图形集中

CATIA = (INFITF.Application)Marshal.GetActiveObject("CATIA.Application");
Part opart = (Part)CATIA.ActiveEditor.ActiveObject;
HybridShapeFactory hsf = (HybridShapeFactory)opart.HybridShapeFactory;
OrderedGeometricalSets orderedGeometricalSets = opart.OrderedGeometricalSets;
//新建有序几何图形集
OrderedGeometricalSet ordered0 = orderedGeometricalSets.Add();
ordered0.set_Name("层级1");
OrderedGeometricalSet ordered1 = ordered0.OrderedGeometricalSets.Add();
ordered1.set_Name("层级2_1");
OrderedGeometricalSet ordered2 = ordered0.OrderedGeometricalSets.Add();
ordered2.set_Name("层级2_2");
OrderedGeometricalSet ordered3 = ordered1.OrderedGeometricalSets.Add();
ordered3.set_Name("层级2_1_1");
OrderedGeometricalSet ordered4 = ordered2.OrderedGeometricalSets.Add();
ordered4.set_Name("层级2_2_1");
HybridShapePointCoord testPoint1 = hsf.AddNewPointCoord(0,0,0);
HybridShapePointCoord testPoint2 = hsf.AddNewPointCoord(100, 0, 0);
//隔离元素并添加至有序几何图形集
testPoint1.Compute();
testPoint2.Compute();
var isolatePoint1 = hsf.AddNewPointDatum((Reference)testPoint1);
var isolatePoint2 = hsf.AddNewPointDatum((Reference)testPoint2);
isolatePoint1.set_Name("测试点1");
isolatePoint2.set_Name("测试点2");
ordered3.InsertHybridShape(isolatePoint1);
ordered4.InsertHybridShape(isolatePoint2);

运行效果如图:
有序几何图形集_第1张图片
此处先简单介绍下有序几何图形集与几何图形集的区别:
普通的几何图形集没有先后关系,自由度较大。
有序几何图形集存在先后关系,父子级约束较为严格。
有序几何图形集_第2张图片

你可能感兴趣的:(CATIA二次开发,catia,vba,bim)