几何继承关系层次图

1 AnyGeometry

说明:所有通用几何的基础接口,即所有的MS所有的几何都继承自AnyGeometry
方法:
属性:

1.1 AnyCurve

说明:
方法:
属性:

1.1.1 CurvePrimitive

说明:创建几何曲线
方法:
AdjustFractionToBreakFraction()
功能说明:将指定位置的fraction移动到break fraction
代码示例:

  1. public void AdjustFractionToBreakFractionTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //利用上一步骤中点列表创建CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. //将CurvePrimitive转为Element, 持久化到model中
  17. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  18. element.AddToModel();
  19. //使用该方法将起点处的fraction移动到附近断点所在的fraction,
  20. //其中参数RoundingMode 有三个值,分别是up down 和round
  21. curvePrimitive.AdjustFractionToBreakFraction(0, RoundingMode.Up, out uint fractionIndex, out double outFraction);
  22. MessageBox.Show("the adjust fraction is " + outFraction.ToString());
  23. }

Clone()
功能说明:深拷贝曲线
代码示例:

  1. public void CloneTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //利用上一步骤中点列表创建CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. //将CurvePrimitive转为Element, 持久化到model中
  17. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  18. element.AddToModel();
  19. // 使用Clone()方法将curvePrimitive深拷贝一份
  20. CurvePrimitive curvePrimitive1 = curvePrimitive.Clone();
  21. //将CurvePrimitive转为Element, 持久化到model中
  22. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive1, null); //将CurvePrimitive转为Element, 持久化到model中
  23. element1.AddToModel();
  24. }

CloneBetweenFractions()
功能说明:深拷贝两个fraction之间的曲线
代码示例:

  1. public void CloneBetweenFractionsTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //利用上一步骤中点列表创建CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. //将CurvePrimitive转为Element, 持久化到model中
  17. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  18. element.AddToModel();
  19. curvePrimitive.Length(out double totalLength);
  20. //通过PointAtSignedDistanceFromFraction方法获取线串在固定位置的位置信息;通过其返回值CurveLocationDetail的Fraction获得曲线1/4 1/2处的fraction
  21. CurveLocationDetail curveLocationDetail0 = curvePrimitive.PointAtSignedDistanceFromFraction(0.0, totalLength / 4, false);
  22. CurveLocationDetail curveLocationDetail1 = curvePrimitive.PointAtSignedDistanceFromFraction(0.0, totalLength / 2, false);
  23. //使用CloneBetweenFractions方法复制 1/4 1/2之间的曲线
  24. CurvePrimitive curvePrimitive1 = curvePrimitive.CloneBetweenFractions(curveLocationDetail0.Fraction, curveLocationDetail1.Fraction, false);
  25. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive1, null); //将CurvePrimitive转为Element, 持久化到model中
  26. element1.AddToModel();
  27. }

CloneDereferenced()
功能说明:
代码示例:
ClosestPointBounded()
功能说明:计算曲线上到指定空间点距离最近的点; 有两个重载
代码示例:

  1. public void ClosestPointBoundedTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //利用上一步骤中点列表创建CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. DPoint3d spacePt = new DPoint3d(10000, 20000, 10000);
  17. CurveLocationDetail curveLocationDetail = curvePrimitive.ClosestPointBounded(spacePt);
  18. DSegment3d dSegment3d = new DSegment3d(spacePt, curveLocationDetail.Point);
  19. LineElement lineElement = new LineElement(dgnModel, null, dSegment3d);
  20. lineElement.AddToModel();
  21. }
  22. public void ClosestPointBoundedTest2()
  23. {
  24. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  25. ModelInfo modelInfo = dgnModel.GetModelInfo();
  26. //创建了点列表
  27. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  28. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  29. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  30. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  31. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  32. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  33. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  34. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  35. //利用上一步骤中点列表创建CurvePrimitive
  36. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  37. DPoint3d spacePt = new DPoint3d(10000, 20000, 10000);
  38. //使用方法获取空间点到曲线的最近点和对应的fraction
  39. bool result = curvePrimitive.ClosestPointBounded(spacePt,out double fraction, out DPoint3d outPoint);
  40. //将获取到的点和空间点连成线段,持久化到model中
  41. DSegment3d dSegment3d = new DSegment3d(spacePt, outPoint);
  42. LineElement lineElement = new LineElement(dgnModel, null, dSegment3d);
  43. lineElement.AddToModel();
  44. MessageBox.Show("the fraction of closest point is" + fraction.ToString());
  45. }

ClosestPointBoundedXY()
功能说明:计算曲线投影到XY面上以后,到空间点距离最近的点
代码示例:

  1. public void ClosestPointBoundedXYTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 10000));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 10000));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 10000));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 10000));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 10000));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 10000));
  14. //利用上一步骤中点列表创建CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. DPoint3d spacePt = new DPoint3d(10000, 20000, 10000);
  17. //使用ClosestPointBoundedXY方法获取曲线上到空间点最近的点,将两个点连城线段,持久化到mdoel中
  18. CurveLocationDetail curveLocationDetail = curvePrimitive.ClosestPointBoundedXY(spacePt, DMatrix4d.Identity);
  19. DSegment3d dSegment3d = new DSegment3d(spacePt, curveLocationDetail.Point);
  20. LineElement lineElement = new LineElement(dgnModel, null, dSegment3d);
  21. lineElement.AddToModel();
  22. }

CreateArc(**)**
功能说明:创建圆弧,是CurvePrimitive的静态方法;输入参数是DEllipse3d类型
代码示例:

  1. public static void CurvePrimitiveExample_CreateArc()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. DEllipse3d dEllipse3D = new DEllipse3d(0 * UorPerMas, 5 * UorPerMas, 0 * UorPerMas, 10 * UorPerMas, 10 * UorPerMas, 0 * UorPerMas); //创建DEllipse3d
  6. CurvePrimitive curvePrimitive = CurvePrimitive.CreateArc(dEllipse3D);// 使用CurvePrimitive下的静态方法CreateArc
  7. //CurvePrimitive的两个属性
  8. bool m_IsExtenSilbleFractionSpace = curvePrimitive.IsExtensibleFractionSpace;
  9. bool m_IsMappableFractionSpace = curvePrimitive.IsMappableFractionSpace;
  10. //将CurvePrimitive转为Element, 持久化到model中
  11. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  12. element.AddToModel();
  13. }

CreateBsplineCurve()
功能说明:创建B样条曲线,是CurvePrimitive的静态方法;该方法有三个重载,详见代码示例
代码示例:

  1. public static void CurvePrimitiveExample_CreateBsplineCurve()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. CurvePrimitive curvePrimitive = CurvePrimitive.CreateBsplineCurve();// 使用CurvePrimitive下的静态方法CreateBsplineCurve, 该方法创建了一个空的B样条曲线对象
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0,0,0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. List<double> weight = new List<double>() ;
  15. List<double> knot = new List<double>() ;
  16. CurvePrimitive curvePrimitive0 = CurvePrimitive.CreateBsplineCurve(dPoint3Ds, weight, knot, 2, false, true);// 使用CurvePrimitive下的静态方法CreateBsplineCurve
  17. Element element0 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive0, null);//将CurvePrimitive转为Element, 持久化到model中
  18. element0.AddToModel();
  19. List<DPoint3d> dPoint3Dsss = new List<DPoint3d>();
  20. dPoint3Dsss.Add(new DPoint3d(0, 0, 0));
  21. dPoint3Dsss.Add(new DPoint3d(-10000, 10000, 0));
  22. dPoint3Dsss.Add(new DPoint3d(-20000, 60000, 0));
  23. dPoint3Dsss.Add(new DPoint3d(-40000, -10000, 0));
  24. dPoint3Dsss.Add(new DPoint3d(-70000, 20000, 0));
  25. dPoint3Dsss.Add(new DPoint3d(-90000, -40000, 0));
  26. MSBsplineCurve mSBsplineCurve = MSBsplineCurve.CreateFromAkima(dPoint3Dsss.ToArray()); //要求最少有6个点
  27. CurvePrimitive curvePrimitive1 = CurvePrimitive.CreateBsplineCurve(mSBsplineCurve);// 使用CurvePrimitive下的静态方法CreateBsplineCurve
  28. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive1, null); //将CurvePrimitive转为Element, 持久化到model中
  29. element1.AddToModel();
  30. }

CreateChildCurveVectorCopyFromSource()
功能说明:从源CurveVector创建一个几何曲线,是对源CurveVector的深度拷贝,拷贝后源CurveVector没有被清理;输入参数是CurveVector类型;
代码示例:

  1. public static void CurvePrimitiveExample_CreateChildCurveVectorCopyFromSource()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //创建CurveVector为下一步骤做做准备
  15. CurveVector curves = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.None, false);
  16. //使用CurvePrimitive的静态函数CreateChildCurveVectorCopyFromSource新建一个CurvePrimitive
  17. CurvePrimitive curvePrimitive = CurvePrimitive.CreateChildCurveVectorCopyFromSource(curves);
  18. //将CurvePrimitive转为Element, 持久化到model中
  19. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  20. element.AddToModel();
  21. }

CreateChildCurveVectorSwapFromSource()
功能说明:从源CurveVector创建一个几何曲线,拷贝后源CurveVector被清除掉,这是与上个方法的区别所在;输入参数是CurveVector类型;
代码示例:

  1. public static void CurvePrimitiveExample_CreateChildCurveVectorSwapFromSource()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //创建CurveVector为下一步骤做做准备
  15. CurveVector curves = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.None, false);
  16. //使用CurvePrimitive的静态函数CreateChildCurveVectorSwapFromSource新建一个CurvePrimitive
  17. CurvePrimitive curvePrimitive = CurvePrimitive.CreateChildCurveVectorSwapFromSource(curves);
  18. //将CurvePrimitive转为Element, 持久化到model中
  19. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  20. element.AddToModel();
  21. }

CreateFromNative()
功能说明:从指针创建曲线
代码示例:

  1. public void CreateFromNativeTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  6. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  7. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  8. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  9. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  11. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  12. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  13. CurvePrimitive curvePrimitive0 = CurvePrimitive.CreateLineString(dPoint3Ds);
  14. IntPtr intPtr = CurvePrimitive.DereferenceToNative(curvePrimitive0, true);
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateFromNative(intPtr);
  16. //将CurvePrimitive转为Element, 持久化到model中
  17. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  18. element.AddToModel();
  19. }

CreateInterpolationCurve()
功能说明:使用创建MS插值曲线的方法创建CurvePrimitive
代码示例:

  1. public static void CurvePrimitiveExample_CreateInterpolationCurve()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //创建样条曲线结束方向
  15. List<DVector3d> dVector3Ds = new List<DVector3d>();
  16. dVector3Ds.Add(new DVector3d(dPoint3Ds[4], dPoint3Ds[5]));
  17. //创建MS的插值曲线
  18. MSInterpolationCurve mSInterpolationCurve = MSInterpolationCurve.CreateFromPointsAndEndTangents(dPoint3Ds,true,300.0,dVector3Ds,false, true, true, true);
  19. //利用上一步骤中的M插值曲线创建CurvePrimitive
  20. CurvePrimitive curvePrimitive = CurvePrimitive.CreateInterpolationCurve(mSInterpolationCurve);
  21. //将CurvePrimitive转为Element, 持久化到model中
  22. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  23. element.AddToModel();
  24. }

CreateLine()
功能说明:使用创建线的方法创建CurvePrimitive
代码示例:

  1. public static void CurvePrimitiveExample_CreateLine()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. //创建线节段 DSegment3d
  10. DSegment3d dSegment3D = new DSegment3d(dPoint3Ds[0], dPoint3Ds[1]);
  11. //利用上一步骤中的线节段 DSegment3d创建CurvePrimitive
  12. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLine(dSegment3D);
  13. //将CurvePrimitive转为Element, 持久化到model中
  14. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  15. element.AddToModel();
  16. }

CreateLineString()
功能说明:使用创建线串的方法创建CurvePrimitive
代码示例:

  1. public static void CurvePrimitiveExample_CreateLineString()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //利用上一步骤中点列表创建CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. //将CurvePrimitive转为Element, 持久化到model中
  17. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  18. element.AddToModel();
  19. }

CreatePartialCurve()
功能说明:使用父曲线(CurvePrimitive)创建新的同类型曲线;方法会修改父曲线对象
代码示例:

  1. public static void CurvePrimitiveExample_CreatePartialCurve()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //利用点列表创建CurvePrimitive0
  15. CurvePrimitive curvePrimitive0 = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. //将curvePrimitive0作为入参输入到CreatePartialCurve方法中,创建新的curvePrimitive
  17. CurvePrimitive curvePrimitive = CurvePrimitive.CreatePartialCurve(curvePrimitive0,0.3,0.7,1);
  18. //将 创建后的子几何曲线CurvePrimitive转为Element, 持久化到model中
  19. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  20. element.AddToModel();
  21. //将父几何曲线CurvePrimitive0转为Element, 持久化到model中
  22. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive0, null); //将CurvePrimitive转为Element, 持久化到model中
  23. element.AddToModel();
  24. //最终的执行结果, 添加到model中的CurvePrimitive是两条相同的曲线
  25. }

CreatePointString()
功能说明:从点列表直接创建线串几何
代码示例:

  1. public static void CurvePrimitiveExample_CreatePointString()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //使用点列表直接创建线串
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreatePointString(dPoint3Ds);
  16. //将创建的CurvePrimitive转为Element, 持久化到model中
  17. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  18. element.AddToModel();
  19. }

CreateSpiralBearingRadiusBearingRadius()
功能说明:按照曲线类型创建不同类型的螺旋线;第一个参数transitionType 的值对应的曲线类型
static const int TransitionType_Unknown = 0;
static const int TransitionType_Clothoid = 10; 回旋曲线
static const int TransitionType_Bloss = 11; 布劳斯曲线
static const int TransitionType_Biquadratic = 12; 四次幂
static const int TransitionType_Cosine = 13; 余弦曲线
static const int TransitionType_Sine = 14; 正弦曲线
static const int TransitionType_Viennese = 20; 维也纳
static const int TransitionType_WeightedViennese = 21; 加权维也纳
第二个参数 startRadians 开始弧度(注意取值范围 0~2Pi)
代码示例:

  1. public static void CurvePrimitiveExample_CreateSpiralBearingRadiusBearingRadius()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. CurvePrimitive curvePrimitive = CurvePrimitive.CreateSpiralBearingRadiusBearingRadius(10,0,200.0,2*Math.PI,10000,DTransform3d.Identity,0.0,1.0);
  6. /* 第一个整型参数 transitionType 的值对应的曲线类型
  7. static const int TransitionType_Unknown = 0;
  8. static const int TransitionType_Clothoid = 10; 回旋曲线
  9. static const int TransitionType_Bloss = 11; 布劳斯曲线
  10. static const int TransitionType_Biquadratic = 12; 四次幂
  11. static const int TransitionType_Cosine = 13; 余弦曲线
  12. static const int TransitionType_Sine = 14; 正弦曲线
  13. static const int TransitionType_Viennese = 20; 维也纳
  14. static const int TransitionType_WeightedViennese = 21; 加权维也纳
  15. 第二个参数 startRadians 开始弧度
  16. startRadius 开始半径
  17. */
  18. //将创建的CurvePrimitive转为Element, 持久化到model中
  19. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  20. element.AddToModel();
  21. }

CreateStrongTypeFromNativeICurvePrimitive ()
功能说明:使用CurvePrimitive的指针创建新的曲线,有两个参数,第一个是现存曲线的指针,第二个是创建方式:CreateAction.Capture,直接将源曲线的指针作为新创建曲线的指针,二者使用同一块内存;CreateAction.Clone,在内存中开辟新的区域,作为新创建曲线的存储区域;在代码示例中,分别获取了三条曲线的指针,使用CreateAction.Capture参数的指针与源曲线一致,使用CreateAction.Clone的指针与源曲线不同。
代码示例:

  1. public static void CurvePrimitiveExample_CreateStrongTypeFromNativeICurvePrimitive()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //使用点列表直接创建线串
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreatePointString(dPoint3Ds);
  16. //获取curvePrimitive曲线的指针
  17. IntPtr intPtr = CurvePrimitive.DereferenceToNative(curvePrimitive, true);
  18. //使用源曲线的指针,CreateAction.Capture参数创建新的曲线,并且获取创建后曲线的指针
  19. CurvePrimitive curvePrimitive0 = CurvePrimitive.CreateStrongTypeFromNativeICurvePrimitive(intPtr, CreateAction.Capture);
  20. IntPtr intPtr0 = CurvePrimitive.DereferenceToNative(curvePrimitive0, true);
  21. //使用源曲线的指针,CreateAction.Clone参数创建新的曲线,并且获取创建后曲线的指针
  22. CurvePrimitive curvePrimitive1 = CurvePrimitive.CreateStrongTypeFromNativeICurvePrimitive(intPtr, CreateAction.Clone);
  23. IntPtr intPtr1 = CurvePrimitive.DereferenceToNative(curvePrimitive1, true);
  24. //将创建的CurvePrimitive转为Element, 持久化到model中
  25. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null); //将CurvePrimitive转为Element, 持久化到model中
  26. element.AddToModel();
  27. Element element0 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive0, null); //将CurvePrimitive转为Element, 持久化到model中
  28. element0.AddToModel();
  29. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive1, null); //将CurvePrimitive转为Element, 持久化到model中
  30. element1.AddToModel();
  31. //将源曲线的指针和两种参数创建曲线的指针组合为字符串,并显示到窗口;我们可以看到源曲线和使用Capture参数创建曲线的指针是一致的, 使用后clone参数创建的曲线与源曲线的指针不一致
  32. //虽然在model中,创建的三条曲线重叠显示在在同一位置, 但它们的创建方式和创建时的方法是不同的
  33. string mess = "sourceCurveIntPtr is" + intPtr + "\n captureActionCurveIntPtr is " + intPtr0 + "\n cloneActionCurveIntPtr is " + intPtr1;
  34. MessageBox.Show(mess);
  35. }

DereferenceToNative ()
功能说明:各种曲线类型的基本接口;获取CurvePrimitive曲线的指针
代码示例:

  1. public static void CurvePrimitiveExample_DereferenceToNative()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //使用点列表直接创建线串
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreatePointString(dPoint3Ds);
  16. //获取curvePrimitive曲线的指针
  17. IntPtr intPtr = CurvePrimitive.DereferenceToNative(curvePrimitive,true);
  18. //将指针转化为字符串,使用消息盒子显示出来
  19. string PtrString = intPtr.ToString();
  20. MessageBox.Show(PtrString);
  21. }

Dispose()
功能说明:
代码示例:
FastMaxAbs()
功能说明:该方法返回一个double类型的曲线坐标值最大的绝对值;并不一定返回真正意义上曲线上坐标绝对值的最大值,也可能会返回样条曲线极点中坐标值最大的绝对值;
代码示例:

  1. public static void CurvePrimitiveExample_FastMaxAbs()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -200000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -100000, 0));
  14. //使用点列表直接创建线串
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreatePointString(dPoint3Ds);
  16. //FastMaxAbs()方法返回一个double类型的曲线坐标值最大的绝对值
  17. double value = curvePrimitive.FastMaxAbs();
  18. //将返回值转为字符串,显示在窗口中
  19. string valueString = value.ToString();
  20. MessageBox.Show(valueString);
  21. }

FractionToFrenetFrame ()
功能说明:out类型的输出参数获取参数化曲线上某点处的变换矩阵;方法的返回值是布尔类型,如果曲线不是参数化曲线,方法会返回flase
代码示例:

  1. public static void CurvePrimitiveExample_FractionToFrenetFrame()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //绘制一个0度到360度的一个螺旋线,其起始半径为200,终止半径为10000 (都是UOR单位)
  6. CurvePrimitive curvePrimitive = CurvePrimitive.CreateSpiralBearingRadiusBearingRadius(10, 0, 200.0, 2 * Math.PI, 10000, DTransform3d.Identity, 0.0, 1.0);
  7. //FractionToFrenetFrame获取参数化曲线上某点处的变换矩阵;如果曲线不是参数化曲线,方法会返回flase
  8. curvePrimitive.FractionToFrenetFrame(0.1,out DTransform3d dTransform3D);
  9. TransformInfo transformInfo = new TransformInfo(dTransform3D);
  10. //创建点列表
  11. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  12. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  13. dPoint3Ds.Add(new DPoint3d(10000, 0, 0));
  14. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  15. dPoint3Ds.Add(new DPoint3d(0, 10000, 0));
  16. //创建shape元素,将原始的shape元素添加到model中
  17. ShapeElement shape = new ShapeElement(dgnModel, null, dPoint3Ds.ToArray());
  18. shape.AddToModel();
  19. //对原始的shape元素应用变换矩阵后,也添加到model中,观察两次添加shape元素的位置
  20. shape.ApplyTransform(transformInfo);
  21. shape.AddToModel();
  22. }

FractionToPoint(Double, DPoint3d)
功能说明:out类型的输出参数返回参数化曲线上某点处的坐标;方法的返回值是布尔类型,如果曲线不是参数化曲线,方法会返回flase
代码示例:

  1. public static void CurvePrimitiveExample_FractionToPoint0()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //绘制一个0度到360度的一个螺旋线,其起始半径为200,终止半径为10000 (都是UOR单位)
  6. CurvePrimitive curvePrimitive = CurvePrimitive.CreateSpiralBearingRadiusBearingRadius(10, 0, 200.0, 2 * Math.PI, 10000, DTransform3d.Identity, 0.0, 1.0);
  7. //重载1 获取曲线上某点的坐标
  8. curvePrimitive.FractionToPoint(0.5, out DPoint3d dPoint3D);
  9. //创建一条起点为0,终点为曲线中点的直线,并持久化到model中
  10. DSegment3d dSegment3D = new DSegment3d(new DPoint3d(0, 0, 0), dPoint3D);
  11. LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
  12. lineElement.AddToModel();
  13. }

FractionToPoint(Double, DPoint3d, DVector3d)
功能说明:out类型的输出参数返回参数化曲线上某点处的坐标,和该点处的切线方向;方法的返回值是布尔类型,如果曲线不是参数化曲线,方法会返回flase
代码示例:

  1. public static void CurvePrimitiveExample_FractionToPoint1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //绘制一个0度到360度的一个螺旋线,其起始半径为200,终止半径为10000 (都是UOR单位)
  6. CurvePrimitive curvePrimitive = CurvePrimitive.CreateSpiralBearingRadiusBearingRadius(10, 0, 200.0, 2 * Math.PI, 10000, DTransform3d.Identity, 0.0, 1.0);
  7. //重载2 获取曲线上某点的坐标,曲线上该点处的切向量(一阶导数)
  8. curvePrimitive.FractionToPoint(0.1, out DPoint3d dPoint3D,out DVector3d dVector3D);
  9. //获取切向量的终点
  10. DPoint3d endPoint3D = DPoint3d.Add(dPoint3D, dVector3D);
  11. //创建一条起点在曲线上,终点为切向量终点的直线,并持久化到model中
  12. DSegment3d dSegment3D = new DSegment3d(dPoint3D, endPoint3D);
  13. LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
  14. lineElement.AddToModel();
  15. }

FractionToPoint(Double, DPoint3d, DVector3d, DVector3d)
功能说明:out类型的输出参数返回参数化曲线上某点处的坐标,曲线上该点处的切向量(一阶导数)和二阶导数;方法的返回值是布尔类型,如果曲线不是参数化曲线,方法会返回flase
代码示例:

  1. public static void CurvePrimitiveExample_FractionToPoint2()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //绘制一个0度到360度的一个螺旋线,其起始半径为200,终止半径为10000 (都是UOR单位)
  6. CurvePrimitive curvePrimitive = CurvePrimitive.CreateSpiralBearingRadiusBearingRadius(10, 0, 200.0, 2 * Math.PI, 10000, DTransform3d.Identity, 0.0, 1.0);
  7. //重载3 获取曲线上某点的坐标,曲线上该点处的切向量(一阶导数)和二阶导数
  8. curvePrimitive.FractionToPoint(0.1, out DPoint3d dPoint3D, out DVector3d dVector3D, out DVector3d dVector3D1);
  9. //获取二阶导数向量的终点
  10. DPoint3d endPoint3D = DPoint3d.Add(dPoint3D, dVector3D1);
  11. //创建一条起点在曲线上,终点为二阶导数向量终点的直线,并持久化到model中
  12. DSegment3d dSegment3D = new DSegment3d(dPoint3D, endPoint3D);
  13. LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
  14. lineElement.AddToModel();
  15. }

FractionToPoint(Double, DPoint3d, DVector3d, DVector3d, DVector3d)
功能说明:out类型的输出参数返回参数化曲线上某点处的坐标,曲线上该点处的切向量(一阶导数)和二阶导数,三阶导数;方法的返回值是布尔类型,如果曲线不是参数化曲线,方法会返回flase
代码示例:

  1. public static void CurvePrimitiveExample_FractionToPoint3()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //绘制一个0度到360度的一个螺旋线,其起始半径为200,终止半径为10000 (都是UOR单位)
  6. CurvePrimitive curvePrimitive = CurvePrimitive.CreateSpiralBearingRadiusBearingRadius(10, 0, 200.0, 2 * Math.PI, 10000, DTransform3d.Identity, 0.0, 1.0);
  7. //重载4 获取曲线上某点的坐标,曲线上该点处的切向量(一阶导数)和二阶导数,三阶导数
  8. curvePrimitive.FractionToPoint(0.1, out DPoint3d dPoint3D, out DVector3d dVector3D, out DVector3d dVector3D1, out DVector3d dVector3D2);
  9. //获取三阶导数向量的终点
  10. DPoint3d endPoint3D = DPoint3d.Add(dPoint3D, dVector3D2);
  11. //创建一条起点在曲线上,终点为三阶导数向量终点的直线,并持久化到model中
  12. DSegment3d dSegment3D = new DSegment3d(dPoint3D, endPoint3D);
  13. LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
  14. lineElement.AddToModel();
  15. }

GetBreakFraction ()
功能说明:获得曲线某一断点的fraction值,第一个参数代表想获取第几个断点的索引值
代码示例:

  1. public static void CurvePrimitiveExample_GetBreakFraction()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -200000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -100000, 0));
  14. //使用点列表直接创建线串
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreatePointString(dPoint3Ds);
  16. //将CurvePrimitive转为Element, 持久化到model中
  17. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  18. element.AddToModel();
  19. //使用GetBreakFraction方法获取曲线某一断点处的fraction值
  20. curvePrimitive.GetBreakFraction(1,out double fraction);
  21. //将获取到的fraction转为string, 显示在消息框中
  22. string mess = "the first break fraction is " + fraction.ToString();
  23. MessageBox.Show(mess);
  24. }

GetBsplineCurve ()
功能说明:如果曲线是B样条曲线类型的,则返回MSBsplineCurve;如果不是,则返回null
代码示例:

  1. public static void CurvePrimitiveExample_GetBsplineCurve()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -200000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -100000, 0));
  14. List<double> weight = new List<double>();
  15. List<double> knot = new List<double>();
  16. // 使用CurvePrimitive下的静态方法CreateBsplineCurve
  17. CurvePrimitive curvePrimitive0 = CurvePrimitive.CreateBsplineCurve(dPoint3Ds, weight, knot, 2, false, true);
  18. //使用GetBsplineCurve方法获取MSBsplineCurve
  19. MSBsplineCurve mSBsplineCurve0 = curvePrimitive0.GetBsplineCurve();
  20. //如果获取结果为空,则弹出消息提示
  21. if (mSBsplineCurve0 == null)
  22. {
  23. string mess = "在这个CurvePrimitive中不包含B样条曲线";
  24. MessageBox.Show(mess);
  25. }
  26. // 如果获取结果不为空,则将MSBsplineCurve转化为element添加到当前文件中
  27. else
  28. {
  29. CurvePrimitive curvePrimitive00 = CurvePrimitive.CreateBsplineCurve(mSBsplineCurve0);
  30. //将CurvePrimitive转为Element, 持久化到model中
  31. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive00, null);
  32. element.AddToModel();
  33. }

GetChildCurveVector ()
功能说明:
代码示例:
GetCurvePrimitiveType ()
功能说明:该方法返回CurvePrimitive曲线的类型;不同的整形数字代表不同的曲线类型,详细如下
NotClassified = -1,
None = 0,
Invalid = 0,
Line = 1,
LineString = 2,
Arc = 3,
BsplineCurve = 4,
InterpolationCurve = 5,
AkimaCurve = 6,
PointString = 7,
CurveVector = 8,
Spiral = 9,
PartialCurve = 10
代码示例:

  1. public static void CurvePrimitiveExample_GetCurvePrimitiveType()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -200000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -100000, 0));
  14. //使用CreateLineString方法创建线串类型的CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. //GetCurvePrimitiveType 使用该方法获取所创建曲线的类型
  17. var curvePrimitiveType = curvePrimitive.GetCurvePrimitiveType();
  18. /*
  19. NotClassified = -1,
  20. None = 0,
  21. Invalid = 0,
  22. Line = 1,
  23. LineString = 2,
  24. Arc = 3,
  25. BsplineCurve = 4,
  26. InterpolationCurve = 5,
  27. AkimaCurve = 6,
  28. PointString = 7,
  29. CurveVector = 8,
  30. Spiral = 9,
  31. PartialCurve = 10,
  32. */
  33. //将所获取的曲线类型在消息框显示出来
  34. MessageBox.Show(curvePrimitiveType.ToString());
  35. }

GetInterpolationCurve ()
功能说明:
代码示例:
GetMarkerBit ()
功能说明:
代码示例:
GetMSBsplineCurve ()
功能说明:
代码示例:
GetProxyBsplineCurve ()
功能说明:
代码示例:
GetRange ()
功能说明:获取一个curvePrimitive对象的包围盒(Range),该方法的返回值是一个bool类型的值,代表获取的结果
代码示例:

  1. public static void CurvePrimitiveExample_GetRange()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //使用CreateLineString方法创建线串类型的CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. //获取曲线的包围盒(range)
  17. bool result = curvePrimitive.GetRange(out DRange3d dRange3D);
  18. if (result)
  19. {
  20. MessageBox.Show("Get the range of curvePrimitive successfully");
  21. }
  22. }

GetSpiral ()
功能说明:
代码示例:
GetStartEnd(DPoint3d, DPoint3d)
功能说明:该方法获取curvePrimitive的起终点
代码示例:

  1. public static void CurvePrimitiveExample_GetStartEnd()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //使用CreateLineString方法创建线串类型的CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. // 使用方法获取curvePrimitive的起终点
  17. bool result = curvePrimitive.GetStartEnd(out DPoint3d startPt, out DPoint3d endPt);
  18. //以curvePrimitive的起终点画直线,并添加到model中
  19. DSegment3d dSegment3D = new DSegment3d(startPt, endPt);
  20. LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
  21. lineElement.AddToModel();
  22. }

GetStartEnd(DPoint3d, DPoint3d,DVector3d,DVector3d)
功能说明:获取curvePrimitive起终点的重载方法, 不仅能获取到起终点的坐标,并且能获取到起终点的切线
代码示例:

  1. public static void CurvePrimitiveExample_GetStartEnd1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //使用CreateLineString方法创建线串类型的CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. //获取curvePrimitive起终点的重载方法, 不仅能获取到起终点的坐标,并且能获取到起终点的切线
  17. bool result = curvePrimitive.GetStartEnd(out DPoint3d startPt, out DPoint3d endPt,out DVector3d tangentA,out DVector3d tangentB);
  18. //以curvePrimitive的起终点画直线,并添加到model中
  19. DSegment3d dSegment3D = new DSegment3d(startPt, endPt);
  20. LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
  21. lineElement.AddToModel();
  22. }

GetStartPoint ()
功能说明:获取curvePrimitive对象的起点
代码示例:

  1. public static void CurvePrimitiveExample_GetStartPoint()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //使用CreateLineString方法创建线串类型的CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. //使用GetStartPoint方法获取curvePrimitive对象的起点
  17. bool result = curvePrimitive.GetStartPoint(out DPoint3d startPt);
  18. //将曲线起点的XYZ坐标分别显示到消息窗口中
  19. MessageBox.Show("startPoint's X value is"+startPt.X.ToString() +
  20. "\r\n startPoint's Y value is" + startPt.Y.ToString()+
  21. "\r\n startPoint's Z value is" + startPt.Z.ToString());
  22. }

GetStrokeCount ()
功能说明:
代码示例:

  1. public static void CurvePrimitiveExample_GetStrokeCount()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //使用CreateLineString方法创建线串类型的CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. FacetOptions facetOptions = new FacetOptions();
  17. facetOptions.SetCurveDefaultsDefaults();
  18. uint result = curvePrimitive.GetStrokeCount(facetOptions, 0.1, 0.5);
  19. MessageBox.Show(result.ToString());
  20. }

IsPeriodicFractionSpace ()
功能说明:如果曲线是周期曲线的一部分,则返回true,否则返回false;在代码示例中用线串和圆分别举例子
代码示例:

  1. public static void CurvePrimitiveExample_IsPeriodicFractionSpace()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //使用CreateLineString方法创建线串类型的CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. //使用CreateArc方法创建圆类型的CurvePrimitive
  17. DEllipse3d dEllipse3D = new DEllipse3d(0 * UorPerMas, 5 * UorPerMas, 0 * UorPerMas, 10 * UorPerMas, 10 * UorPerMas, 0 * UorPerMas); //创建DEllipse3d
  18. CurvePrimitive curvePrimitive1 = CurvePrimitive.CreateArc(dEllipse3D);// 使用CurvePrimitive下的静态方法CreateArc
  19. //如果曲线是周期类型的曲线,该方法会返回true, 否则会返回false;使用该方法分别判断线串和圆
  20. bool result = curvePrimitive.IsPeriodicFractionSpace(out double value0);
  21. bool result1 = curvePrimitive1.IsPeriodicFractionSpace(out double value1);
  22. //将判断结果分别显示在消息框中
  23. if (result1)
  24. {
  25. MessageBox.Show("Circle is Periodic Fraction Space, and it's period is " + value1.ToString());
  26. }
  27. else
  28. {
  29. MessageBox.Show("Circle isn't Periodic Fraction Space, and it's period is " + value1.ToString());
  30. }
  31. if (result)
  32. {
  33. MessageBox.Show("LineString is Periodic Fraction Space, and it's period is " + value0.ToString());
  34. }
  35. else
  36. {
  37. MessageBox.Show("LineString isn't Periodic Fraction Space, and it's period is " + value0.ToString());
  38. }
  39. }

IsSameStructure ()
功能说明:判断这个CurvePrimitive和其他的是否具有相同的树结构;若有,则返回true,否则返回false
代码示例:

  1. public static void CurvePrimitiveExample_IsSameStructure()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  14. //使用CreateLineString方法创建线串类型的CurvePrimitive
  15. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  16. //使用CreateArc方法创建圆类型的CurvePrimitive
  17. DEllipse3d dEllipse3D = new DEllipse3d(0 * UorPerMas, 5 * UorPerMas, 0 * UorPerMas, 10 * UorPerMas, 10 * UorPerMas, 0 * UorPerMas); //创建DEllipse3d
  18. CurvePrimitive curvePrimitive1 = CurvePrimitive.CreateArc(dEllipse3D);// 使用CurvePrimitive下的静态方法CreateArc
  19. //使用该方法判断两个curvePrimitive是否是相同的结构
  20. bool result = curvePrimitive.IsSameStructure(curvePrimitive1);
  21. //将返回的结果展示在消息框中
  22. if (result)
  23. {
  24. MessageBox.Show("linString and circle is same structure");
  25. }
  26. else
  27. {
  28. MessageBox.Show("linString and circle isn't same structure");
  29. }
  30. }

IsSameStructureAndGeometry ()
功能说明:断这个CurvePrimitive和其他的是否具有相同的树结构和几何信息;若有,则返回true,否则返回false
代码示例:

  1. public static void CurvePrimitiveExample_IsSameStructureAndGeometry()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //使用CreateArc方法创建圆类型的CurvePrimitive
  6. DEllipse3d dEllipse3D0 = new DEllipse3d(0 * UorPerMas, 5 * UorPerMas, 0 * UorPerMas, 5 * UorPerMas, 10 * UorPerMas, 0 * UorPerMas); //创建DEllipse3d
  7. CurvePrimitive curvePrimitive0 = CurvePrimitive.CreateArc(dEllipse3D0);// 使用CurvePrimitive下的静态方法CreateArc
  8. //使用CreateArc方法创建圆类型的CurvePrimitive
  9. DEllipse3d dEllipse3D1 = new DEllipse3d(0 * UorPerMas, 5 * UorPerMas, 0 * UorPerMas, 10 * UorPerMas, 10 * UorPerMas, 0 * UorPerMas); //创建DEllipse3d
  10. CurvePrimitive curvePrimitive1 = CurvePrimitive.CreateArc(dEllipse3D1);// 使用CurvePrimitive下的静态方法CreateArc
  11. //将两个圆弧or椭圆持久化到model中
  12. Element element0 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive0, null);
  13. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive1, null);
  14. element0.AddToModel();
  15. element1.AddToModel();
  16. // 使用方法判断二者是否具有i相同的结构和几何,将结果展示在消息框中
  17. bool result = curvePrimitive0.IsSameStructureAndGeometry(curvePrimitive1, 0.1);
  18. if (result == false)
  19. {
  20. MessageBox.Show("they have same structure but different Geometry");
  21. }
  22. else
  23. {
  24. MessageBox.Show("they have same structure and Geometry");
  25. }
  26. }

Length ()
功能说明:返回曲线的长度值;如果曲线是不可度量的则返回false
代码示例:

  1. public static void CurvePrimitiveExample_Length()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  6. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  7. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  8. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  9. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  11. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  12. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  13. //使用CreateLineString方法创建线串类型的CurvePrimitive
  14. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  15. //将曲线转为element并持久化到model中
  16. Element element = DraftingElementSchema.ToElement(dgnModel,curvePrimitive,null);
  17. element.AddToModel();
  18. //使用该方法获取曲线的长度值,将长度值展示在消息框中
  19. curvePrimitive.Length(out double length);
  20. MessageBox.Show("the length of that curve is " + length.ToString());
  21. }

PointAtSignedDistanceFromFraction ()
功能说明:在基本曲线上从一个fraction移动一段距离后,返回基本曲线上某点处的位置信息;方法的参数:startFraction,在曲线上开始的fraction;signedDistance,沿曲线移动的距离;allowExtension,是否支持曲线的延伸;方法的返回值,CurveLocationDetail,曲线位置的详细信息,包含所在点的坐标和此点在曲线上的fraction等。
代码示例:

  1. public static void CurvePrimitiveExample_PointAtSignedDistanceFromFraction()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  6. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  7. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  8. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  9. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  11. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  12. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  13. //使用CreateLineString方法创建线串类型的CurvePrimitive,将线串转化为元素添加到model中
  14. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  15. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  16. element.AddToModel();
  17. // 求出基本曲线上给定位置(曲线终点处)处的坐标点,
  18. curvePrimitive.Length(out double curveLength);
  19. CurveLocationDetail curveLocationDetail = curvePrimitive.PointAtSignedDistanceFromFraction(0.0, curveLength, false);
  20. DPoint3d dPoint3D = curveLocationDetail.Point;
  21. //以曲线的起点和终点画线段,并添加到model中
  22. DSegment3d dSegment3D = new DSegment3d(dPoint3Ds[0], dPoint3D);
  23. LineElement lineElement = new LineElement(dgnModel,null,dSegment3D);
  24. lineElement.AddToModel();
  25. }

SetMarkerBit ()
功能说明:
代码示例:
SetPolesAndOrder ()
功能说明:为已创建的B样条曲线添加数据
代码示例:

  1. public static void CurvePrimitiveExample_SetPolesAndOrder()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. List<DPoint3d> dPoint3Dsss = new List<DPoint3d>();
  6. dPoint3Dsss.Add(new DPoint3d(0, 0, 0));
  7. dPoint3Dsss.Add(new DPoint3d(-10000, 10000, 0));
  8. dPoint3Dsss.Add(new DPoint3d(-20000, 60000, 0));
  9. dPoint3Dsss.Add(new DPoint3d(-40000, -10000, 0));
  10. dPoint3Dsss.Add(new DPoint3d(-70000, 20000, 0));
  11. dPoint3Dsss.Add(new DPoint3d(-90000, -40000, 0));
  12. //先创建一条B样条曲线,转化为元素,并添加到model中
  13. MSBsplineCurve mSBsplineCurve = MSBsplineCurve.CreateFromAkima(dPoint3Dsss.ToArray()); //要求最少有6个点
  14. CurvePrimitive curvePrimitive1 = CurvePrimitive.CreateBsplineCurve(mSBsplineCurve);// 使用CurvePrimitive下的静态方法CreateBsplineCurve
  15. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive1, null);
  16. element.AddToModel();
  17. //使用该方法为之前步骤创建的B样条曲线添加参数
  18. List<double> knot = new List<double>();
  19. List<double> weight = new List<double>();
  20. curvePrimitive1.SetPolesAndOrder(dPoint3Dsss, weight, knot, 3, false, false);
  21. Element element0 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive1, null);
  22. element0.AddToModel();
  23. }

SignedDistanceBetweenFractions ()
功能说明:返回曲线上两个fraction之间的距离;本例子中使用1/4和1/2处的fraction,注意只有直线中点处的fraction是0.5,其余类型曲线的fraction均可通过例子中的方法获取。如果不是参数化的曲线,则会返回false
image.png
代码示例:

  1. public static void CurvePrimitiveExample_SignedDistanceBetweenFractions()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. List<DPoint3d> dPoint3Dsss = new List<DPoint3d>();
  6. dPoint3Dsss.Add(new DPoint3d(0, 0, 0));
  7. dPoint3Dsss.Add(new DPoint3d(-10000, 10000, 0));
  8. dPoint3Dsss.Add(new DPoint3d(-20000, 60000, 0));
  9. dPoint3Dsss.Add(new DPoint3d(-40000, -10000, 0));
  10. dPoint3Dsss.Add(new DPoint3d(-70000, 20000, 0));
  11. dPoint3Dsss.Add(new DPoint3d(-90000, -40000, 0));
  12. //生成线串,转化为element,并添加到model中
  13. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Dsss);
  14. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  15. element.AddToModel();
  16. //通过length()方法获得线串的总长度
  17. curvePrimitive.Length(out double totalLength);
  18. //通过PointAtSignedDistanceFromFraction方法获取线串在固定位置的位置信息;通过其返回值CurveLocationDetail的Fraction获得曲线1/4 1/2处的fraction
  19. CurveLocationDetail curveLocationDetail0 = curvePrimitive.PointAtSignedDistanceFromFraction(0.0, totalLength / 4, false);
  20. CurveLocationDetail curveLocationDetail1 = curvePrimitive.PointAtSignedDistanceFromFraction(0.0, totalLength / 2, false);
  21. //SignedDistanceBetweenFractions使用该方法获得曲线1/4 1/2之间的距离
  22. curvePrimitive.SignedDistanceBetweenFractions(curveLocationDetail0.Fraction, curveLocationDetail1.Fraction, out double signedDistance);
  23. //将1/4 1/2处的fraction值打印在窗口中;将总长度和1/4 1/2之间的距离打印在窗口中;最后打印出它们之间的距离是4倍的关系
  24. MessageBox.Show("the fraction in 1/4 length is "+ curveLocationDetail0.Fraction.ToString()+
  25. "\n\r the the fraction in 1/2 length is "+ curveLocationDetail1.Fraction.ToString()+
  26. "\n\r the distance between them is "+ signedDistance.ToString()+
  27. "\n\r the total length of lineString is "+ totalLength.ToString()+
  28. "\n\r their quotient is "+ (totalLength/ signedDistance).ToString());
  29. }

Transform ()
功能说明:对曲线进行变换
代码示例:

  1. public static void CurvePrimitiveExample_Transform()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. List<DPoint3d> dPoint3Dsss = new List<DPoint3d>();
  6. dPoint3Dsss.Add(new DPoint3d(0, 0, 0));
  7. dPoint3Dsss.Add(new DPoint3d(-10000, 10000, 0));
  8. dPoint3Dsss.Add(new DPoint3d(-20000, 60000, 0));
  9. dPoint3Dsss.Add(new DPoint3d(-40000, -10000, 0));
  10. dPoint3Dsss.Add(new DPoint3d(-70000, 20000, 0));
  11. dPoint3Dsss.Add(new DPoint3d(-90000, -40000, 0));
  12. //生成线串,转化为element,并添加到model中
  13. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Dsss);
  14. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  15. element.AddToModel();
  16. DMatrix3d matrix = new DMatrix3d(1, 0, 0, 0, 0, 1, 0, 1, 0);//定义变换矩阵,将Y坐标和Z坐标调换
  17. DTransform3d trans = new DTransform3d(matrix);//定义变换几何
  18. curvePrimitive.Transform(trans);
  19. //应用transform方法对曲线进行变换,将变换的结果转换为element,并添加到model中
  20. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  21. element1.AddToModel();
  22. }

TryAddLineStringPoint ()
功能说明:为线串类型的曲线添加点,方法执行成功后会返回false
代码示例:

  1. public static void CurvePrimitiveExample_TryAddLineStringPoint()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. List<DPoint3d> dPoint3Dsss = new List<DPoint3d>();
  6. dPoint3Dsss.Add(new DPoint3d(0, 0, 0));
  7. dPoint3Dsss.Add(new DPoint3d(-10000, 10000, 0));
  8. dPoint3Dsss.Add(new DPoint3d(-20000, 60000, 0));
  9. dPoint3Dsss.Add(new DPoint3d(-40000, -10000, 0));
  10. dPoint3Dsss.Add(new DPoint3d(-70000, 20000, 0));
  11. dPoint3Dsss.Add(new DPoint3d(-90000, -40000, 0));
  12. //生成线串,转化为element,并添加到model中
  13. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Dsss);
  14. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  15. element.AddToModel();
  16. DPoint3d dPoint3D = new DPoint3d(-100000, 50000, 0);
  17. //生成线串,为线串添加一个点;方法执行成功后会返回false
  18. bool res = curvePrimitive.TryAddLineStringPoint(ref dPoint3D);
  19. if (!res)
  20. {
  21. //将添加了点的线串转化为element,添加到model中
  22. Element element22 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  23. element22.AddToModel();
  24. }
  25. else
  26. {
  27. MessageBox.Show("TryAddLineStringPoint Failed");
  28. }
  29. }

TryGetArc ()
功能说明:
代码示例:
TryGetLine ()
功能说明:获取线类型曲线的DSegment3d, 若获取成功,则返回flase;示例代码的效果在同一位置生成两条线段
代码示例:

  1. public static void CurvePrimitiveExample_TryGetLine()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. List<DPoint3d> dPoint3Dsss = new List<DPoint3d>();
  6. dPoint3Dsss.Add(new DPoint3d(-20000, 60000, 0));
  7. dPoint3Dsss.Add(new DPoint3d(-10000, 10000, 0));
  8. //创建线,转为element, 添加到model中
  9. DSegment3d dSegment3D = new DSegment3d(dPoint3Dsss[0], dPoint3Dsss[1]);
  10. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLine(dSegment3D);
  11. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  12. element.AddToModel();
  13. //使用方法获取CurvePrimitive的DSegment3d元素,转化为element,添加到model中
  14. curvePrimitive.TryGetLine(out DSegment3d dSegment3D1);
  15. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  16. element1.AddToModel();
  17. }

TryGetLineString ()
功能说明:返回线串类型曲线的点列表,其他类型的曲线,会返回null
代码示例:

  1. public static void CurvePrimitiveExample_TryGetLineString()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. List<DPoint3d> dPoint3Dsss = new List<DPoint3d>();
  6. dPoint3Dsss.Add(new DPoint3d(0, 0, 0));
  7. dPoint3Dsss.Add(new DPoint3d(-10000, 10000, 0));
  8. dPoint3Dsss.Add(new DPoint3d(-20000, 60000, 0));
  9. dPoint3Dsss.Add(new DPoint3d(-40000, -10000, 0));
  10. dPoint3Dsss.Add(new DPoint3d(-70000, 20000, 0));
  11. dPoint3Dsss.Add(new DPoint3d(-90000, -40000, 0));
  12. //生成线串,转化为element,并添加到model中
  13. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Dsss);
  14. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  15. element.AddToModel();
  16. //准备个空列表,接收函数返回的线串的点列表
  17. List<DPoint3d> resPointList = new List<DPoint3d>();
  18. curvePrimitive.TryGetLineString(resPointList);
  19. // 判断返回的列表和原始生成线串的列表是否一致,
  20. if (resPointList.SequenceEqual(dPoint3Dsss))
  21. {
  22. MessageBox.Show("get a same point list with the orogin list");
  23. }
  24. else
  25. {
  26. MessageBox.Show("they are different list");
  27. }
  28. }

TryGetLineStringPointCount ()
功能说明:返回线串类型曲线的点个数;如果不是线串类型,则会返回0
代码示例:

  1. public static void CurvePrimitiveExample_TryGetLineStringPointCount()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. List<DPoint3d> dPoint3Dsss = new List<DPoint3d>();
  6. dPoint3Dsss.Add(new DPoint3d(0, 0, 0));
  7. dPoint3Dsss.Add(new DPoint3d(-10000, 10000, 0));
  8. dPoint3Dsss.Add(new DPoint3d(-20000, 60000, 0));
  9. dPoint3Dsss.Add(new DPoint3d(-40000, -10000, 0));
  10. dPoint3Dsss.Add(new DPoint3d(-70000, 20000, 0));
  11. dPoint3Dsss.Add(new DPoint3d(-90000, -40000, 0));
  12. //生成线串,转化为element,并添加到model中
  13. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Dsss);
  14. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  15. element.AddToModel();
  16. curvePrimitive.TryGetLineStringPointCount(out int count);
  17. MessageBox.Show("the count of this lineString's point is " + count.ToString());
  18. }

TryGetPointInLineString ()
功能说明:返回线串中某个索引处的点
代码示例:

TryGetSegmentInLineString ()
功能说明:
代码示例:
WireCentroid ()
功能说明:获取两个fraction之间对应曲线的长度和这段曲线的中点
代码示例:

  1. public static void CurvePrimitiveExample_WireCentroid()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  6. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  7. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  8. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  9. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  11. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  12. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  13. //使用CreateLineString方法创建线串类型的CurvePrimitive,将线串转化为元素添加到model中
  14. CurvePrimitive curvePrimitive = CurvePrimitive.CreateLineString(dPoint3Ds);
  15. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  16. element.AddToModel();
  17. // 求出基本曲线上给定位置(曲线终点处)处的位置信息
  18. curvePrimitive.Length(out double curveLength);
  19. CurveLocationDetail curveLocationDetail0 = curvePrimitive.PointAtSignedDistanceFromFraction(0.0, curveLength/4, false);
  20. CurveLocationDetail curveLocationDetail1 = curvePrimitive.PointAtSignedDistanceFromFraction(0.0, curveLength / 2, false);
  21. //获取1/4 和1/2处对应的fraction
  22. double fraction1 = curveLocationDetail0.Fraction;
  23. double fraction2 = curveLocationDetail1.Fraction;
  24. //使用WireCentroid方法获取1/4 和1/2之间曲线的长度和这段对应的中点
  25. curvePrimitive.WireCentroid(out double sectionLength, out DPoint3d sectionPoint, fraction1, fraction2);
  26. //创建一个新的点列表,将1/4 和1/2处对应的点的和这段的终点添加到空的点列表中
  27. List<DPoint3d> dPoint3Dss = new List<DPoint3d>();
  28. dPoint3Dss.Add(curveLocationDetail0.Point);
  29. dPoint3Dss.Add(sectionPoint);
  30. dPoint3Dss.Add(curveLocationDetail1.Point);
  31. //利用上一步骤的点列表创建新的线串,转化为element,并添加到model中
  32. CurvePrimitive curvePrimitive1 = CurvePrimitive.CreateLineString(dPoint3Dss);
  33. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitive1, null);
  34. element1.AddToModel();
  35. //在消息框中显示1/4 和1/2之间曲线的长度和本段长度占曲线总长的比例
  36. MessageBox.Show("section length is " + sectionLength.ToString() +
  37. " \n\r that is "+(sectionLength/curveLength).ToString() + "for the total curve length");
  38. }

属性:
IsExtensibleFractionSpace { get; }
IsMappableFractionSpace { get; }
功能说明:对于任意的CurvePrimitive,都可以访问这两个只读属性来获得曲线的属性
代码示例:

  1. public static void CurvePrimitiveExample_CreateArc()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. DEllipse3d dEllipse3D = new DEllipse3d(0 * UorPerMas, 5 * UorPerMas, 0 * UorPerMas, 10 * UorPerMas, 10 * UorPerMas, 0 * UorPerMas); //创建DEllipse3d
  6. CurvePrimitive curvePrimitive = CurvePrimitive.CreateArc(dEllipse3D);// 使用CurvePrimitive下的静态方法CreateArc
  7. //CurvePrimitive的两个属性
  8. bool m_IsExtenSilbleFractionSpace = curvePrimitive.IsExtensibleFractionSpace;
  9. bool m_IsMappableFractionSpace = curvePrimitive.IsMappableFractionSpace;
  10. //将CurvePrimitive转为Element, 持久化到model中
  11. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitive, null);
  12. element.AddToModel();
  13. }

1.1.1.1 BsplineCurve

说明:BsplineCurve类继承自CurvePrimitive类,并实现了IBsplineCurve, IBsplineCurveConstruction接口,类中有B样条曲线相关的方法和属性等信息
构造器:
功能说明:创建空的B样条曲线对象,曲线的控点后期可以通过AddControlPoint()方法添加;曲线必须在经过Validate()方法后才能使用
代码示例:

  1. public void BsplineCurveTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. Bentley.GeometryNET.BsplineCurve bsplineCurve11 = Bentley.GeometryNET.BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve11, null);
  17. element.AddToModel();
  18. //创建一个空的B样条曲线,坐标后期可以使用AddControlPoint()添加,直到Validate()函数之后,曲线才能使用
  19. Bentley.GeometryNET.BsplineCurve res = new Bentley.GeometryNET.BsplineCurve();
  20. res.AddControlPoint(dPoint3Ds[0]);
  21. res.AddControlPoint(dPoint3Ds[1]);
  22. res.AddControlPoint(dPoint3Ds[2]);
  23. res.AddControlPoint(dPoint3Ds[3]);
  24. res.AddControlPoint(dPoint3Ds[4]);
  25. res.AddControlPoint(dPoint3Ds[5]);
  26. res.AddControlPoint(dPoint3Ds[6]);
  27. res.SetOrder(3);
  28. res.ValidateConstruction();
  29. Element element1 = DraftingElementSchema.ToElement(dgnModel, res, null);
  30. element1.AddToModel();
  31. }

方法:
AddControlPoint(DPoint3d controlPoint);
功能说明:为空的B样条曲线添加控制点
代码示例:

  1. public void AddControlPointTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建一个空的B样条曲线,使用AddControlPoint()添加点,直到Validate()函数之后,曲线才能使用
  15. Bentley.GeometryNET.BsplineCurve res = new Bentley.GeometryNET.BsplineCurve();
  16. res.AddControlPoint(dPoint3Ds[0]);
  17. res.AddControlPoint(dPoint3Ds[1]);
  18. res.AddControlPoint(dPoint3Ds[2]);
  19. res.AddControlPoint(dPoint3Ds[3]);
  20. res.AddControlPoint(dPoint3Ds[4]);
  21. res.AddControlPoint(dPoint3Ds[5]);
  22. res.AddControlPoint(dPoint3Ds[6]);
  23. res.SetOrder(3);
  24. res.ValidateConstruction();
  25. //ValidateConstruction执行之后,将曲线转化为element,添加到model中
  26. Element element1 = DraftingElementSchema.ToElement(dgnModel, res, null);
  27. element1.AddToModel();
  28. }

AddKnot(double knot);
功能说明:为B样条曲线添加分段点
代码示例:

  1. public void AddKnotTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. //为创建的B样条曲线添加分段点,将新的曲线转化为element并添加到model中
  19. var res = bsplineCurve.AddKnot(0.1);
  20. Element element1 = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  21. element1.AddToModel();
  22. }

AddWeight(double weight);
功能说明:为B样条曲线添加weight
代码示例:

  1. public void AddWeightTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. //使用addweight方法为样条曲线添加weight,然后将其转为element,并添加到model中
  19. var res = bsplineCurve.AddWeight(0.2);
  20. Element element1 = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  21. element1.AddToModel();
  22. }

ControlPoints();
功能说明:获取B样条曲线的控制点
代码示例:

  1. public void ControlPointsTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. //使用ControlPoints方法获取样条曲线的控制点,将控制点生成线串,然后将其转为element,并添加到model中
  19. var res = bsplineCurve.ControlPoints();
  20. LineString lineString = new LineString(res);
  21. Element element1 = DraftingElementSchema.ToElement(dgnModel, lineString, null);
  22. element1.AddToModel();
  23. }

CreateFromPoles(IList pole, IList knot, int order, bool closed);
功能说明:从关键点创建B样条曲线
代码示例:

  1. public void CreateFromPolesTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //CreateFromPoles 重载1, 点列表和曲线阶数
  15. //创建B样条曲线,转化为element,并添加到model中
  16. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  17. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  18. element.AddToModel();
  19. }

CreateFromPoles(IList pole, int order);
功能说明:从关键点创建B样条曲线
代码示例:

  1. public void CreateFromPolesTest2()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //CreateFromPoles 重载2, 点列表和曲线阶数,是否闭合
  15. //创建B样条曲线,转化为element,并添加到model中
  16. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3,true);
  17. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  18. element.AddToModel();
  19. }

CreateFromPoles(IList pole, int order, bool closed);
功能说明:从关键点创建B样条曲线
代码示例:

  1. public void CreateFromPolesTest3()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. List<double> knot = new List<double>() { 0.1,0.6,0.8};
  15. //CreateFromPoles 重载3, 点列表和曲线阶数,是否闭合,曲线分段的区间
  16. //创建B样条曲线,转化为element,并添加到model中
  17. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, knot, 3,false);
  18. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  19. element.AddToModel();
  20. }

CreateFromPoles(IList pole, IList weight, IList knot, int order, bool closed, bool weightsAlreadyApplied);
功能说明:从关键点创建B样条曲线
代码示例:

  1. public void CreateFromPolesTest4()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. List<double> knot = new List<double>() { 0.1, 0.6, 0.8 };
  15. List<double> weight = new List<double>() { 0.1, 0.6, 0.8 };
  16. //CreateFromPoles 重载4, 点列表和曲线阶数,是否闭合,曲线分段的区间,曲线weight值和是否应用该值
  17. //创建B样条曲线,转化为element,并添加到model中
  18. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, knot, weight, 3,true,false);
  19. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  20. element.AddToModel();
  21. }

DispatchToDDHandler(AbstractDDHandler handler);
功能说明:
代码示例:
GetClosed();
功能说明:判断B仰天曲线是否比闭合
代码示例:

  1. public void GetClosedTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. //判断B样条是否闭合,返回值为bool类型,将结果显示在消息框中
  19. bool res = bsplineCurve.GetClosed();
  20. MessageBox.Show("the result is " + res.ToString());
  21. }

GetControlPointCount();
功能说明:获取B样条曲线控制点的个数
代码示例:

  1. public void GetControlPointCountTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. //使用方法获取B样条曲线的控制点个数,并用消息框显示出来
  19. int ptNumbers = bsplineCurve.GetControlPointCount();
  20. MessageBox.Show("the control points number of this bsplineCurve is " + ptNumbers.ToString());
  21. }

GetKnotCount();
功能说明:获取B样条曲线分段点的个数
代码示例:

  1. public void GetControlPointCountTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. //使用方法获取B样条曲线的控制点个数,并用消息框显示出来
  19. int ptNumbers = bsplineCurve.GetControlPointCount();
  20. MessageBox.Show("the control points number of this bsplineCurve is " + ptNumbers.ToString());
  21. }

GetOrder();
功能说明:获取B样条曲线的阶数
代码示例:

  1. public void GetOrderTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. //使用方法获取B样条曲线的阶数,并用消息框显示出来
  19. var numbers = bsplineCurve.GetOrder();
  20. MessageBox.Show("the order of this bsplineCurve is " + numbers.ToString());
  21. }

GetWeightCount();
功能说明:获取B样条曲线weight的个数
代码示例:

  1. public void GetWeightCountTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. ////使用方法获取B样条曲线的weight count,并用消息框显示出来
  19. int numbers = bsplineCurve.GetWeightCount();
  20. MessageBox.Show("the weight count of this bsplineCurve is " + numbers.ToString());
  21. }

Knots();
功能说明:获取B样条曲线的分段点knots
代码示例:

  1. public void KnotsTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. //使用方法获取B样条曲线的分段信息
  19. var knots = bsplineCurve.Knots();
  20. MessageBox.Show("the knots of this bsplineCurve is " + knots.ToString());
  21. }

SetClosed(bool closed);
功能说明:将B样条曲线设置为闭合
代码示例:

  1. public void SetClosedTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. //将B样条设为闭合,返回值为bool类型,将结果转化为element,并添加到model中
  19. bool res = bsplineCurve.SetClosed(true);
  20. Element element1 = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  21. element1.AddToModel();
  22. }

SetOrder(int order);
功能说明:设置B样条曲线的阶数
代码示例:

  1. public void SetOrderTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. //SetOrder 方法将样条曲线的阶数设置为4,新的曲线转为element,添加到model中
  19. bool res = bsplineCurve.SetOrder(4);
  20. Element element1 = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  21. element1.AddToModel();
  22. }

ValidateConstruction();
功能说明:用构造器创建的空的B样条曲线经过ValidateConstruction()方法后才能使用
代码示例:

  1. public void ValidateConstructionTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建一个空的B样条曲线,使用AddControlPoint()添加点,直到Validate()函数之后,曲线才能使用
  15. Bentley.GeometryNET.BsplineCurve res = new Bentley.GeometryNET.BsplineCurve();
  16. res.AddControlPoint(dPoint3Ds[0]);
  17. res.AddControlPoint(dPoint3Ds[1]);
  18. res.AddControlPoint(dPoint3Ds[2]);
  19. res.AddControlPoint(dPoint3Ds[3]);
  20. res.AddControlPoint(dPoint3Ds[4]);
  21. res.AddControlPoint(dPoint3Ds[5]);
  22. res.AddControlPoint(dPoint3Ds[6]);
  23. res.SetOrder(3);
  24. res.ValidateConstruction();
  25. //ValidateConstruction执行之后,将曲线转化为element,添加到model中
  26. Element element1 = DraftingElementSchema.ToElement(dgnModel, res, null);
  27. element1.AddToModel();
  28. }

Weights();
功能说明:获取B样条曲线的weight信息
代码示例:

  1. public void WeightsTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. var res = bsplineCurve.Weights();
  19. MessageBox.Show("this bsplineCurve's weight is " + res.ToString());
  20. }

属性:
AsIGeometry { get; }
功能说明:获取B样条曲线的类型信息
代码示例:

  1. public void AsIGeometryTest1()
  2. {
  3. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  4. ModelInfo modelInfo = dgnModel.GetModelInfo();
  5. //创建了点列表
  6. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  7. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  8. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  9. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  10. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(40000, 10000, 0));
  12. dPoint3Ds.Add(new DPoint3d(70000, -20000, 0));
  13. dPoint3Ds.Add(new DPoint3d(90000, 40000, 0));
  14. //创建B样条曲线,转化为element,并添加到model中
  15. BsplineCurve bsplineCurve = BsplineCurve.CreateFromPoles(dPoint3Ds, 3);
  16. Element element = DraftingElementSchema.ToElement(dgnModel, bsplineCurve, null);
  17. element.AddToModel();
  18. var res = bsplineCurve.AsIGeometry;
  19. MessageBox.Show(res.ToString());
  20. }

1.1.1.2 ParametricCurve

说明:ParametricCurve类继承于CurvePrimitive类,有CurvePrimitive类的方法和属性
构造器:
ParametricCurve()
功能说明:ParametricCurve的构造函数,创建一个新的ParametricCurve对象
代码示例:
方法:

属性:
AsLineString {get;}
功能说明:
代码示例:
AsEllipticArc {get;}
功能说明:
代码示例:
AsCircularArc {get;}
功能说明:
代码示例:
AsLineSegment {get;}
功能说明:
代码示例:
AsIParametricCurve {get;}
功能说明:
代码示例:

1.1.1.2.1 CircularArc
说明:继承于ParametricCurve类
构造器:
CircularArc()
功能说明:CircularArc类的构造函数,创建一个新的CircularArc对象,该函数有两个重载
代码示例:

  1. public void CircularArcTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建一个dEllipse3D对象
  7. DEllipse3d dEllipse3D = new DEllipse3d(0 * UorPerMas, 5 * UorPerMas, 0 * UorPerMas, 10 * UorPerMas, 10 * UorPerMas, 0 * UorPerMas); //创建DEllipse3d
  8. // 使用入参为dEllipse3D的构造函数重载
  9. Bentley.GeometryNET.CircularArc circularArc = new Bentley.GeometryNET.CircularArc(dEllipse3D);
  10. //转为element,并持久化到model中
  11. Element element = DraftingElementSchema.ToElement(dgnModel, circularArc, null);
  12. element.AddToModel();
  13. }
  14. public void CircularArcTest2()
  15. {
  16. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  17. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  18. ModelInfo modelInfo = dgnModel.GetModelInfo();
  19. //新建一个dEllipse3D对象
  20. DEllipse3d dEllipse3D = new DEllipse3d(0 * UorPerMas, 5 * UorPerMas, 0 * UorPerMas, 10 * UorPerMas, 10 * UorPerMas, 0 * UorPerMas); //创建DEllipse3d
  21. // 使用入参为dEllipse3D的构造函数重载
  22. Bentley.GeometryNET.CircularArc circularArc = new Bentley.GeometryNET.CircularArc(dEllipse3D);
  23. // 使用入参为circularArc类型的构造函数重载
  24. Bentley.GeometryNET.CircularArc circularArc1 = new Bentley.GeometryNET.CircularArc(circularArc);
  25. //转为element,并持久化到model中
  26. Element element = DraftingElementSchema.ToElement(dgnModel, circularArc1, null);
  27. element.AddToModel();
  28. }

方法:

属性:

1.1.1.2.2 EllipticArc
说明:
方法:
属性:

1.1.1.2.3 LineSegment
说明:
方法:
属性:

1.1.1.2.4 LineString
说明:
方法:
属性:

1.1.1.3 TransitionSpiral

说明:
方法:
属性:

1.2 AnyGroup

说明:各种IxxxGroup继承的最小接口,其中每个xxx都是一个约束类型。
方法:
属性:

1.2.1 GeometryGroup

说明:几何组,继承自AnyGroup类
方法:
属性:

1.3 AnyPoint

说明:
方法:
属性:

1.3.1 AnySinglePoint

说明:
方法:
属性:

1.3.1.1 Coordinate

说明:
方法:
属性:

1.4 AnySolid

说明:作为ISolidGroup的最小接口
构造函数:
方法:
属性:

1.4.1 AnyAnalyticSolid

说明:
方法:
属性:

1.4.2 SolidPrimitive

说明:solid体的几何原型
构造器:
SolidPrimitive()
功能说明:新建空的solid primitive对象
代码示例:

  1. public void SolidPrimitiveTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建一个圆台
  10. DgnConeDetail dgnConeDetail = new DgnConeDetail(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitZ, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  11. //使用SolidPrimitive的静态方法创建圆台
  12. Bentley.GeometryNET.SolidPrimitive solidPrimitive = Bentley.GeometryNET.SolidPrimitive.CreateDgnCone(dgnConeDetail);
  13. //新建一个空的solid primitive 对象
  14. Bentley.GeometryNET.SolidPrimitive solidPrimitive1 = new Bentley.GeometryNET.SolidPrimitive();
  15. solidPrimitive1 = solidPrimitive;
  16. //将SolidPrimitive转化为element,并持久化到model中
  17. Element element = DraftingElementSchema.ToElement(dgnModel, solidPrimitive, null);
  18. element.AddToModel();
  19. Element element1 = DraftingElementSchema.ToElement(dgnModel, solidPrimitive1, null);
  20. element1.AddToModel();
  21. }

方法:
ComputeSecondMomentAreaProducts()
功能说明:返回面积、质心、方向和主要力矩等信息,计算时将其视为一个壳
代码示例:

  1. public void ComputeSecondMomentAreaProductsTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建一个圆台
  10. DgnConeDetail dgnConeDetail = new DgnConeDetail(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitZ, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  11. //使用SolidPrimitive的静态方法创建圆台
  12. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnCone(dgnConeDetail);
  13. //该方法返回solid 的 面积、质心、方向和主要力矩等信息
  14. bool res = solidPrimitive.ComputeSecondMomentAreaProducts(out DMatrix4d dMatrix4D);
  15. //将矩阵的第一个值打印出来
  16. dMatrix4D.Get(out double c00, out double c01, out double c02, out double c03, out double c10, out double c11, out double c12, out double c13, out double c20, out double c21, out double c22, out double c23, out double c30, out double c31, out double c32, out double c33);
  17. System.Windows.Forms.MessageBox.Show(c00.ToString());
  18. }

CreateDgnBox()
功能说明:创建dgnBox
代码示例:

  1. public void CreateDgnBoxTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建dgnBox
  10. DgnBoxDetail dgnBoxDetail = new DgnBoxDetail(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, UorPerMas, UorPerMas, UorPerMas, true);
  11. //使用静态函数创建SolidPrimitive
  12. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnBox(dgnBoxDetail);
  13. //将SolidPrimitive转化为element,并持久化到model中
  14. Element element = DraftingElementSchema.ToElement(dgnModel, solidPrimitive, null);
  15. element.AddToModel();
  16. }

CreateDgnCone()
功能说明:创建圆台
代码示例:

  1. public void CreateDgnConeTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建一个圆台
  10. DgnConeDetail dgnConeDetail = new DgnConeDetail(dPoint3DA, dPoint3DB,DVector3d.UnitX,DVector3d.UnitZ,1.0*UorPerMas,0.8*UorPerMas,false);
  11. //使用SolidPrimitive的静态方法创建圆台
  12. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnCone(dgnConeDetail);
  13. //将SolidPrimitive转化为element,并持久化到model中
  14. Element element = DraftingElementSchema.ToElement(dgnModel, solidPrimitive, null);
  15. element.AddToModel();
  16. }

CreateDgnExtrusion()
功能说明:创建拉伸体
代码示例:

  1. public void CreateDgnExtrusionTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //创建了点列表
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. //新建一个DgnExtrusionDetail
  16. CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Open, false);
  17. DgnExtrusionDetail dgnExtrusionDetail = new DgnExtrusionDetail(curvePrimitives, DVector3d.UnitY, true);
  18. // 使用静态方法创建拉伸体
  19. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnExtrusion(dgnExtrusionDetail);
  20. //将SolidPrimitive转化为element,并持久化到model中
  21. Element element = DraftingElementSchema.ToElement(dgnModel, solidPrimitive, null);
  22. element.AddToModel();
  23. }

CreateDgnRotationalSweep()
功能说明:创建dgn旋转体 DgnRotationalSweep
代码示例:

  1. public void CreateDgnRotationalSweepTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. DRay3d dRay3D = new DRay3d(DPoint3d.Zero, DVector3d.UnitZ);
  10. //新建dgn旋转体信息
  11. DgnRotationalSweepDetail dgnRotationalSweepDetail = new DgnRotationalSweepDetail(curvePrimitives, dRay3D,Angle.TWOPI, true);
  12. //使用静态方法新建SolidPrimitive
  13. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnRotationalSweep(dgnRotationalSweepDetail);
  14. //将SolidPrimitive转化为element,并持久化到model中
  15. Element element = DraftingElementSchema.ToElement(dgnModel, solidPrimitive, null);
  16. element.AddToModel();
  17. }

CreateDgnRuledSweep ()
功能说明:创建有规则的扫掠体
代码示例:

  1. public void CreateDgnRuledSweepTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. List<CurveVector> curvePrimitives = new List<CurveVector>();
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. List<DPoint3d> dPoint3Ds0 = new List<DPoint3d>();
  9. List<DPoint3d> dPoint3Ds1 = new List<DPoint3d>();
  10. List<DPoint3d> dPoint3Ds2 = new List<DPoint3d>();
  11. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  12. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  13. dPoint3Ds0.Add(new DPoint3d(20000, 60000, 0));
  14. dPoint3Ds0.Add(new DPoint3d(30000, -60000, 0));
  15. dPoint3Ds1.Add(new DPoint3d(40000, -10000, 0));
  16. dPoint3Ds1.Add(new DPoint3d(70000, 20000, 0));
  17. dPoint3Ds2.Add(new DPoint3d(90000, -40000, 0));
  18. dPoint3Ds2.Add(new DPoint3d(100000, 40000, 0));
  19. //创建CurveVector列表
  20. CurveVector curvePrimitive = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Open, false);
  21. CurveVector curvePrimitive0 = CurveVector.CreateLinear(dPoint3Ds0, CurveVector.BoundaryType.Open, false);
  22. CurveVector curvePrimitive1 = CurveVector.CreateLinear(dPoint3Ds1, CurveVector.BoundaryType.Open, false);
  23. CurveVector curvePrimitive2 = CurveVector.CreateLinear(dPoint3Ds2, CurveVector.BoundaryType.Open, false);
  24. curvePrimitives.Add(curvePrimitive);
  25. curvePrimitives.Add(curvePrimitive0);
  26. curvePrimitives.Add(curvePrimitive1);
  27. curvePrimitives.Add(curvePrimitive2);
  28. //创建规则拉伸体信息 DgnRuledSweepDetail
  29. DgnRuledSweepDetail dgnRuledSweepDetail = new DgnRuledSweepDetail(curvePrimitives, true);
  30. // 使用静态函数创建solidPrimitive
  31. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnRuledSweep(dgnRuledSweepDetail);
  32. //将SolidPrimitive转化为element,并持久化到model中
  33. Element element = DraftingElementSchema.ToElement(dgnModel, solidPrimitive, null);
  34. element.AddToModel();
  35. }

CreateDgnSphere ()
功能说明:新建圆柱体
代码示例:

  1. public void CreateDgnSphereTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建一个dgn圆柱体
  7. DgnSphereDetail dgnSphereDetail = new DgnSphereDetail(DPoint3d.Zero, UorPerMas);
  8. // 使用静态方法新建一个 圆柱体
  9. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnSphere(dgnSphereDetail);
  10. //将SolidPrimitive转化为element,并持久化到model中
  11. Element element = DraftingElementSchema.ToElement(dgnModel, solidPrimitive, null);
  12. element.AddToModel();
  13. }

CreateDgnTorusPipe ()
功能说明:新建dgn环管体
代码示例:

  1. public void CreateDgnTorusPipeTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建dgn环管
  7. DgnTorusPipeDetail dgnTorusPipeDetail = new DgnTorusPipeDetail(DPoint3d.Zero, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, 0.5 * UorPerMas, 180, true);
  8. //使用静态方法创建环管solid
  9. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnTorusPipe(dgnTorusPipeDetail);
  10. //将SolidPrimitive转化为element,并持久化到model中
  11. Element element = DraftingElementSchema.ToElement(dgnModel, solidPrimitive, null);
  12. element.AddToModel();
  13. }

CreateFromNative ()
功能说明:从本地指针创建solid primitive
代码示例:

  1. public void CreateFromNativeTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建dgn环管
  7. DgnTorusPipeDetail dgnTorusPipeDetail = new DgnTorusPipeDetail(DPoint3d.Zero, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, 0.5 * UorPerMas, 180, true);
  8. //使用静态方法创建环管solid
  9. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnTorusPipe(dgnTorusPipeDetail);
  10. // 获取指针值
  11. IntPtr intPtr = SolidPrimitive.DereferenceToNative(solidPrimitive, true);
  12. // 使用指针创建一个solid primitive
  13. SolidPrimitive solidPrimitive0 = SolidPrimitive.CreateFromNative(intPtr);
  14. //将SolidPrimitive转化为element,并持久化到model中
  15. Element element = DraftingElementSchema.ToElement(dgnModel, solidPrimitive0, null);
  16. element.AddToModel();
  17. }

CreateStrongTypeFromNativeISolidPrimitive ()
功能说明:从指针创建强类型几何
代码示例:

  1. public void CreateStrongTypeFromNativeISolidPrimitiveTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建dgn环管
  7. DgnTorusPipeDetail dgnTorusPipeDetail = new DgnTorusPipeDetail(DPoint3d.Zero, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, 0.5 * UorPerMas, 180, true);
  8. //使用静态方法创建环管solid
  9. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnTorusPipe(dgnTorusPipeDetail);
  10. // 获取指针值
  11. IntPtr intPtr = SolidPrimitive.DereferenceToNative(solidPrimitive, true);
  12. //从指针创建新的几何
  13. AnyGeometry solidPrimitive0 = SolidPrimitive.CreateStrongTypeFromNativeIGeometry(intPtr, CreateAction.Capture);
  14. //将几何转为element 并添加到model中
  15. Element element = DraftingElementSchema.ToElement(dgnModel, solidPrimitive0 as SolidPrimitive, null);
  16. element.AddToModel();
  17. }

DereferenceToNative ()
功能说明:获取solid primitive对象的指针
代码示例:

  1. public void DereferenceToNativeTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建dgn环管
  7. DgnTorusPipeDetail dgnTorusPipeDetail = new DgnTorusPipeDetail(DPoint3d.Zero, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, 0.5 * UorPerMas, 180, true);
  8. //使用静态方法创建环管solid
  9. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnTorusPipe(dgnTorusPipeDetail);
  10. // 获取指针值
  11. IntPtr intPtr = SolidPrimitive.DereferenceToNative(solidPrimitive, true);
  12. System.Windows.Forms.MessageBox.Show("the intPtr of this solid primitive is " + intPtr.ToString());
  13. }

Dispose()
功能说明:
代码示例:
IsSameStructure ()
功能说明:判断solid primitive是否为相同结构
代码示例:

  1. public void IsSameStructureTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建一个圆台
  10. DgnConeDetail dgnConeDetail = new DgnConeDetail(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitZ, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  11. //使用SolidPrimitive的静态方法创建圆台
  12. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnCone(dgnConeDetail);
  13. //创建dgnBox
  14. DgnBoxDetail dgnBoxDetail = new DgnBoxDetail(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, UorPerMas, UorPerMas, UorPerMas, true);
  15. //使用静态函数创建SolidPrimitive
  16. SolidPrimitive solidPrimitive0 = SolidPrimitive.CreateDgnBox(dgnBoxDetail);
  17. //比较两个solid primitive是否为相同结构
  18. bool res = solidPrimitive.IsSameStructure(solidPrimitive0);
  19. System.Windows.Forms.MessageBox.Show("they are same structure? " + res.ToString());
  20. }

IsSameStructureAndGeometry ()
功能说明:判断两个solid primitive对象是否为相同的结构和几何
代码示例:

  1. public void IsSameStructureAndGeometryTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. DPoint3d dPoint3DBB = new DPoint3d(0, 0, 2 * UorPerMas);
  10. //创建一个圆台
  11. DgnConeDetail dgnConeDetail = new DgnConeDetail(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitZ, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  12. //使用SolidPrimitive的静态方法创建圆台
  13. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnCone(dgnConeDetail);
  14. //创建一个圆台
  15. DgnConeDetail dgnConeDetail0 = new DgnConeDetail(dPoint3DA, dPoint3DBB, DVector3d.UnitX, DVector3d.UnitZ, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  16. //使用SolidPrimitive的静态方法创建圆台
  17. SolidPrimitive solidPrimitive0 = SolidPrimitive.CreateDgnCone(dgnConeDetail0);
  18. // 判断是否为相同结构和几何
  19. bool res = solidPrimitive.IsSameStructureAndGeometry(solidPrimitive0, 0.01 * UorPerMas);
  20. bool ressss = solidPrimitive.IsSameStructure(solidPrimitive0);
  21. System.Windows.Forms.MessageBox.Show("they are same structure? " + ressss.ToString()+"\n\r"+
  22. "they are same geometry? "+ res.ToString());

TryGetConstructiveFrame ()
功能说明:获取局部坐标系统的转换,这是构建该实体的典型方法。
代码示例:

  1. public void TryGetConstructiveFrameTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. DPoint3d dPoint3DBB = new DPoint3d(0, 0, 2 * UorPerMas);
  10. //创建一个圆台
  11. DgnConeDetail dgnConeDetail = new DgnConeDetail(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitZ, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  12. //使用SolidPrimitive的静态方法创建圆台
  13. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnCone(dgnConeDetail);
  14. // 获取 solid primitive的 Constructive Frame
  15. bool res = solidPrimitive.TryGetConstructiveFrame(out DTransform3d loaclToWorld, out DTransform3d worldToLocal);
  16. if (res)
  17. {
  18. System.Windows.Forms.MessageBox.Show("get the Constructive Frame successfully");
  19. }
  20. else
  21. {
  22. System.Windows.Forms.MessageBox.Show("get the Constructive Frame failed");
  23. }
  24. }

TryGetDgnBoxDetail ()
功能说明:如果这是SolidPrimitive的DgnBox变体,则返回其详细数据的(副本)。对于任何其他变体,返回nullptr
代码示例:

  1. public void TryGetDgnBoxDetailTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建dgnBox
  10. DgnBoxDetail dgnBoxDetail = new DgnBoxDetail(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, UorPerMas, UorPerMas, UorPerMas, true);
  11. //使用静态函数创建SolidPrimitive
  12. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnBox(dgnBoxDetail);
  13. DgnBoxDetail res = solidPrimitive.TryGetDgnBoxDetail();
  14. System.Windows.Forms.MessageBox.Show("the box detail topX is " +res.TopX.ToString()+
  15. "\n\r the box detail topY is "+res.TopY.ToString()+
  16. "\n\r the box detail baseX is " + res.BaseX.ToString() +
  17. "\n\r the box detail baseY is " + res.BaseY.ToString());
  18. }

TryGetDgnConeDetail ()
功能说明:如果这是SolidPrimitive的DgnCone变体,返回它的详细数据的(副本)。对于任何其他变体,返回nullptr
代码示例:

  1. public void TryGetDgnConeDetailTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建一个圆台
  10. DgnConeDetail dgnConeDetail = new DgnConeDetail(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitZ, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  11. //使用SolidPrimitive的静态方法创建圆台
  12. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnCone(dgnConeDetail);
  13. DgnConeDetail res = solidPrimitive.TryGetDgnConeDetail();
  14. if (res != null)
  15. {
  16. System.Windows.Forms.MessageBox.Show("have get the DgnConeDetail successfully");
  17. }
  18. }

TryGetDgnExtrusionDetail ()
功能说明:如果这是SolidPrimitive的DgnExtrusion变体,则返回其详细数据的(副本)。对于任何其他变体,返回nullptr
代码示例:

  1. public void TryGetDgnExtrusionDetailTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //创建了点列表
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. //新建一个DgnExtrusionDetail
  16. CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Open, false);
  17. DgnExtrusionDetail dgnExtrusionDetail = new DgnExtrusionDetail(curvePrimitives, DVector3d.UnitY, true);
  18. // 使用静态方法创建拉伸体
  19. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnExtrusion(dgnExtrusionDetail);
  20. DgnExtrusionDetail res = solidPrimitive.TryGetDgnExtrusionDetail();
  21. if (res != null)
  22. {
  23. System.Windows.Forms.MessageBox.Show("have get the DgnExtrusionDetail successfully");
  24. }
  25. }

TryGetDgnRotationalSweepDetail ()
功能说明:如果这是SolidPrimitive的DgnRotationalSweep变体,返回它的详细数据的(副本)。对于任何其他变体,返回nullptr
代码示例:

  1. public void TryGetDgnRotationalSweepDetailTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. DRay3d dRay3D = new DRay3d(DPoint3d.Zero, DVector3d.UnitZ);
  10. //新建dgn旋转体信息
  11. DgnRotationalSweepDetail dgnRotationalSweepDetail = new DgnRotationalSweepDetail(curvePrimitives, dRay3D, Angle.TWOPI, true);
  12. //使用静态方法新建SolidPrimitive
  13. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnRotationalSweep(dgnRotationalSweepDetail);
  14. DgnRotationalSweepDetail res = solidPrimitive.TryGetDgnRotationalSweepDetail();
  15. if (res != null)
  16. {
  17. System.Windows.Forms.MessageBox.Show("have get the DgnRotationalSweepDetail successfully");
  18. }
  19. }

TryGetDgnRuledSweepDetail ()
功能说明:如果这是SolidPrimitive的DgnRuledSweep变体,则返回其详细数据的(副本)。对于任何其他变体,返回nullptr
代码示例:

  1. public void TryGetDgnRuledSweepDetailTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. List<CurveVector> curvePrimitives = new List<CurveVector>();
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. List<DPoint3d> dPoint3Ds0 = new List<DPoint3d>();
  9. List<DPoint3d> dPoint3Ds1 = new List<DPoint3d>();
  10. List<DPoint3d> dPoint3Ds2 = new List<DPoint3d>();
  11. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  12. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  13. dPoint3Ds0.Add(new DPoint3d(20000, 60000, 0));
  14. dPoint3Ds0.Add(new DPoint3d(30000, -60000, 0));
  15. dPoint3Ds1.Add(new DPoint3d(40000, -10000, 0));
  16. dPoint3Ds1.Add(new DPoint3d(70000, 20000, 0));
  17. dPoint3Ds2.Add(new DPoint3d(90000, -40000, 0));
  18. dPoint3Ds2.Add(new DPoint3d(100000, 40000, 0));
  19. //创建CurveVector列表
  20. CurveVector curvePrimitive = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Open, false);
  21. CurveVector curvePrimitive0 = CurveVector.CreateLinear(dPoint3Ds0, CurveVector.BoundaryType.Open, false);
  22. CurveVector curvePrimitive1 = CurveVector.CreateLinear(dPoint3Ds1, CurveVector.BoundaryType.Open, false);
  23. CurveVector curvePrimitive2 = CurveVector.CreateLinear(dPoint3Ds2, CurveVector.BoundaryType.Open, false);
  24. curvePrimitives.Add(curvePrimitive);
  25. curvePrimitives.Add(curvePrimitive0);
  26. curvePrimitives.Add(curvePrimitive1);
  27. curvePrimitives.Add(curvePrimitive2);
  28. //创建规则拉伸体信息 DgnRuledSweepDetail
  29. DgnRuledSweepDetail dgnRuledSweepDetail = new DgnRuledSweepDetail(curvePrimitives, true);
  30. // 使用静态函数创建solidPrimitive
  31. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnRuledSweep(dgnRuledSweepDetail);
  32. DgnRuledSweepDetail res = solidPrimitive.TryGetDgnRuledSweepDetail();
  33. if (res != null)
  34. {
  35. System.Windows.Forms.MessageBox.Show("have get the DgnRuledSweepDetail successfully");
  36. }
  37. }

TryGetDgnSphereDetail ()
功能说明:如果这是SolidPrimitive的DgnSphere变体,则返回其详细数据的(副本)。对于任何其他变体,返回nullptr
代码示例:

  1. public void TryGetDgnSphereDetailTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建一个dgn圆柱体
  7. DgnSphereDetail dgnSphereDetail = new DgnSphereDetail(DPoint3d.Zero, UorPerMas);
  8. // 使用静态方法新建一个 圆柱体
  9. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnSphere(dgnSphereDetail);
  10. DgnSphereDetail res = solidPrimitive.TryGetDgnSphereDetail();
  11. if (res != null)
  12. {
  13. System.Windows.Forms.MessageBox.Show("have get the DgnRuledSweepDetail successfully");
  14. }
  15. }

TryGetDgnTorusPipeDetail ()
功能说明:如果这是SolidPrimitive的DgnTorusPipe变体,返回它的详细数据的(副本)。对于任何其他变体,返回nullptr
代码示例:

  1. public void TryGetDgnTorusPipeDetailTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建dgn环管
  7. DgnTorusPipeDetail dgnTorusPipeDetail = new DgnTorusPipeDetail(DPoint3d.Zero, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, 0.5 * UorPerMas, 180, true);
  8. //使用静态方法创建环管solid
  9. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnTorusPipe(dgnTorusPipeDetail);
  10. DgnTorusPipeDetail res = solidPrimitive.TryGetDgnTorusPipeDetail();
  11. if (res != null)
  12. {
  13. System.Windows.Forms.MessageBox.Show("have get the DgnRuledSweepDetail successfully");
  14. }
  15. }

TryGetRange()
功能说明:计算并返回solid primitive的范围。
代码示例:

  1. public void TryGetRangeTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建dgn环管
  7. DgnTorusPipeDetail dgnTorusPipeDetail = new DgnTorusPipeDetail(DPoint3d.Zero, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, 0.5 * UorPerMas, 180, true);
  8. //使用静态方法创建环管solid
  9. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnTorusPipe(dgnTorusPipeDetail);
  10. //获取该solid primitive的 range信息
  11. bool res = solidPrimitive.TryGetRange(out DRange3d dRange3D);
  12. //将此range的 Low High作为顶点生成线段,并添加到model中
  13. DSegment3d dSegment3D = new DSegment3d(dRange3D.Low, dRange3D.High);
  14. LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
  15. lineElement.AddToModel();
  16. }

属性:
IsStrongSolidType { get; }
功能说明:solid primitive是否为StrongSolidType的属性
代码示例:

  1. public void IsStrongSolidTypeTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建一个圆台
  10. DgnConeDetail dgnConeDetail = new DgnConeDetail(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitZ, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  11. //使用SolidPrimitive的静态方法创建圆台
  12. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnCone(dgnConeDetail);
  13. bool res = solidPrimitive.IsStrongSolidType;
  14. System.Windows.Forms.MessageBox.Show("is this solid primitive a StrongSolidType? "+ res.ToString());
  15. }

PrimitiveType { get; }
功能说明:solid 类型的属性信息,类型包括以下几种:
None = 0,
DgnTorusPipe = 1,
DgnCone = 2,
DgnBox = 3,
DgnSphere = 4,
DgnExtrusion = 5,
DgnRotationalSweep = 6,
DgnRuledSweep = 7
代码示例:

  1. public void PrimitiveTypeTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建一个圆台
  10. DgnConeDetail dgnConeDetail = new DgnConeDetail(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitZ, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  11. //使用SolidPrimitive的静态方法创建圆台
  12. SolidPrimitive solidPrimitive = SolidPrimitive.CreateDgnCone(dgnConeDetail);
  13. SolidPrimitiveType res = solidPrimitive.PrimitiveType;
  14. System.Windows.Forms.MessageBox.Show("this solid primitive's type is " + res.ToString());
  15. /*
  16. None = 0,
  17. DgnTorusPipe = 1,
  18. DgnCone = 2,
  19. DgnBox = 3,
  20. DgnSphere = 4,
  21. DgnExtrusion = 5,
  22. DgnRotationalSweep = 6,
  23. DgnRuledSweep = 7
  24. */
  25. }

1.4.2.1 CircularCone

说明:
方法:
属性:

1.4.2.2 CircularCylinder

说明:
方法:
属性:

1.4.2.3 SkewedCone

说明:
方法:
属性:

1.4.2.4 StronglyTypedSolidPrimitive

说明:派生自SolidPrimitive的强类型实体基元的中间类
方法:
构造函数:
属性:

1.4.2.4.1 Block

说明:强类型,兼容CommonGeoemtry的Block.
构造函数:
Block()
功能说明:
代码示例:
Block(IPlacement, DPoint3d, DPoint3d, Boolean)
功能说明:
代码示例:
方法:
DispatchToDDHandler()
功能说明:
代码示例:
GetBlock()
功能说明:
代码示例:
属性:
AsIGeometry { get; }
功能说明:
代码示例:

1.4.2.4.2 DgnBox

说明:强类型、兼容CommonGeoemtry的DgnBox。
构造函数:
DgnBox(DPoint3d baseOrigin, DPoint3d topOrigin, DVector3d vectorX, DVector3d vectorY, double baseX, double baseY, double topX, double topY, bool capped);
功能说明:构造函数,创建一个新的dgnBox对象
代码示例:

  1. public void DgnBoxTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建dgnBox
  10. Bentley.GeometryNET.DgnBox dgnBox = new Bentley.GeometryNET.DgnBox(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, UorPerMas, UorPerMas, UorPerMas, true);
  11. Element element = DraftingElementSchema.ToElement(dgnModel, dgnBox, null);
  12. element.AddToModel();
  13. }

方法:
DispatchToDDHandler ()
功能说明:
代码示例:
GetDgnBox ()
功能说明:获取dgnBox的各种信息
代码示例:

  1. public void GetDgnBoxTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建dgnBox
  10. Bentley.GeometryNET.DgnBox dgnBox = new Bentley.GeometryNET.DgnBox(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, UorPerMas, UorPerMas, UorPerMas, true);
  11. // 获取dgnBox的各种信息
  12. dgnBox.GetDgnBox(out DPoint3d baseOrigin, out DPoint3d topOrigin, out DVector3d vectorX, out DVector3d vectorY, out double baseX, out double baseY, out double topX, out double topY, out bool capped);
  13. }

属性:
AsIGeometry { get; }
功能说明:
代码示例:

1.4.2.4.3 DgnCone

说明:强类型的DgnCone
构造函数:
DgnCone(DPoint3d, DPoint3d, Double, Double, Boolean)
功能说明:构造函数,创建一个新的dgnCone对象
代码示例:

  1. public void DgnConeTest3()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建一个圆台
  10. Bentley.GeometryNET.DgnCone dgnConeDetail = new Bentley.GeometryNET.DgnCone(dPoint3DA, dPoint3DB, DMatrix3d.Identity, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  11. //将圆台转为element, 存到model中
  12. Element element = DraftingElementSchema.ToElement(dgnModel, dgnConeDetail, null);
  13. element.AddToModel();
  14. }

DgnCone(DPoint3d, DPoint3d, DMatrix3d, Double, Double, Boolean)
功能说明:构造函数,创建一个新的dgnCone对象
代码示例:

  1. public void DgnConeTest2()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建一个圆台
  10. Bentley.GeometryNET.DgnCone dgnConeDetail = new Bentley.GeometryNET.DgnCone(dPoint3DA, dPoint3DB, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  11. //将圆台转为element, 存到model中
  12. Element element = DraftingElementSchema.ToElement(dgnModel, dgnConeDetail, null);
  13. element.AddToModel();
  14. }

DgnCone(DPoint3d, DPoint3d, DVector3d, DVector3d, Double, Double, Boolean)
功能说明:构造函数,创建一个新的dgnCone对象
代码示例:

  1. public void DgnConeTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建一个圆台
  10. Bentley.GeometryNET.DgnCone dgnConeDetail = new Bentley.GeometryNET.DgnCone(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitZ, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  11. //将圆台转为element, 存到model中
  12. Element element = DraftingElementSchema.ToElement(dgnModel, dgnConeDetail, null);
  13. element.AddToModel();
  14. }

方法:
DispatchToDDHandler ()
功能说明:
代码示例:
GetDgnCone ()
功能说明:获取dgnCone的信息
代码示例:

  1. public void GetDgnConeTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //准备生成圆台的顶 底中心点
  7. DPoint3d dPoint3DA = new DPoint3d(0, 0, 0);
  8. DPoint3d dPoint3DB = new DPoint3d(0, 0, 1 * UorPerMas);
  9. //创建一个圆台
  10. Bentley.GeometryNET.DgnCone dgnConeDetail = new Bentley.GeometryNET.DgnCone(dPoint3DA, dPoint3DB, DVector3d.UnitX, DVector3d.UnitZ, 1.0 * UorPerMas, 0.8 * UorPerMas, false);
  11. //获取dgnCone的信息
  12. dgnConeDetail.GetDgnCone(out DPoint3d centerA, out DPoint3d centerB, out DVector3d vectorX, out DVector3d vectorY, out double radiusA, out double radiusB, out bool capped);
  13. //将圆台转为element, 存到model中
  14. Element element = DraftingElementSchema.ToElement(dgnModel, dgnConeDetail, null);
  15. element.AddToModel();
  16. }

属性:
AsIGeometry { get; }
功能说明:
代码示例:

1.4.2.4.4 DgnExtrusion

说明:强类型、兼容CommonGeoemtry的DgnExtrusion。
构造函数:
DgnExtrusion()
功能说明:拉伸体的构造函数
代码示例:

  1. public void DgnExtrusionTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //创建了点列表
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. //新建一个DgnExtrusionDetail
  16. CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Open, false);
  17. Bentley.GeometryNET.DgnExtrusion dgnExtrusionDetail = new Bentley.GeometryNET.DgnExtrusion(curvePrimitives, DVector3d.UnitY, true);
  18. //将SolidPrimitive转化为element,并持久化到model中
  19. Element element = DraftingElementSchema.ToElement(dgnModel, dgnExtrusionDetail, null);
  20. element.AddToModel();
  21. }

方法:
DispatchToDDHandler()
功能说明:
代码示例:
GetBaseGeometry()
功能说明:获取基本的拉伸几何
代码示例:

  1. public void GetBaseGeometryTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //创建了点列表
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. //新建一个DgnExtrusionDetail
  16. CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Open, false);
  17. Bentley.GeometryNET.DgnExtrusion dgnExtrusionDetail = new Bentley.GeometryNET.DgnExtrusion(curvePrimitives, DVector3d.UnitY, true);
  18. // 获取拉伸的几何信息
  19. Bentley.GeometryNET.Common.ISweepable sweepable = dgnExtrusionDetail.GetBaseGeometry();
  20. if (sweepable != null)
  21. {
  22. System.Windows.Forms.MessageBox.Show("get the base geometry successfully");
  23. }
  24. }

GetCapped()
功能说明:获取DgnExtrusion是否闭合
代码示例:

  1. public void GetCappedTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //创建了点列表
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. //新建一个DgnExtrusionDetail
  16. CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Open, false);
  17. Bentley.GeometryNET.DgnExtrusion dgnExtrusionDetail = new Bentley.GeometryNET.DgnExtrusion(curvePrimitives, DVector3d.UnitY, true);
  18. // 获取DgnExtrusion 是否闭合,将结果打印出来
  19. bool res = dgnExtrusionDetail.GetCapped();
  20. System.Windows.Forms.MessageBox.Show("this DgnExtrusion is capped " + res.ToString());
  21. }

GetExtrusionVector()
功能说明:获取拉伸向量
代码示例:

  1. public void GetExtrusionVectorTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //创建了点列表
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. //新建一个DgnExtrusionDetail
  16. CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Open, false);
  17. Bentley.GeometryNET.DgnExtrusion dgnExtrusionDetail = new Bentley.GeometryNET.DgnExtrusion(curvePrimitives, DVector3d.UnitY, true);
  18. // 获取拉伸向量,将获取到的结果打印出来
  19. DVector3d res = dgnExtrusionDetail.GetExtrusionVector();
  20. if (res != null)
  21. {
  22. System.Windows.Forms.MessageBox.Show("get the ExtrusionVector successfully");
  23. }

SetBaseGeometry()
功能说明:
代码示例:
SetCapped()
功能说明:设置闭合状态
代码示例:

  1. public void SetCappedTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //创建了点列表
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. //新建一个DgnExtrusionDetail
  16. CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Open, false);
  17. Bentley.GeometryNET.DgnExtrusion dgnExtrusionDetail = new Bentley.GeometryNET.DgnExtrusion(curvePrimitives, DVector3d.UnitY, true);
  18. //转为element 存到model中
  19. Element element = DraftingElementSchema.ToElement(dgnModel, dgnExtrusionDetail, null);
  20. element.AddToModel();
  21. //设置闭合为flase
  22. dgnExtrusionDetail.SetCapped(false);
  23. //将新的转为element,存到model中
  24. Element element1 = DraftingElementSchema.ToElement(dgnModel, dgnExtrusionDetail, null);
  25. element1.AddToModel();
  26. }

SetExtrusionVector()
功能说明:设置拉伸向量
代码示例:

  1. public void SetExtrusionVectorTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //创建了点列表
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. //新建一个DgnExtrusionDetail
  16. CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Open, false);
  17. Bentley.GeometryNET.DgnExtrusion dgnExtrusionDetail = new Bentley.GeometryNET.DgnExtrusion(curvePrimitives, DVector3d.UnitY, true);
  18. //转为element 存到model中
  19. Element element = DraftingElementSchema.ToElement(dgnModel, dgnExtrusionDetail, null);
  20. element.AddToModel();
  21. //设置闭合为flase
  22. dgnExtrusionDetail.SetExtrusionVector(DVector3d.UnitZ);
  23. //将新的转为element,存到model中
  24. Element element1 = DraftingElementSchema.ToElement(dgnModel, dgnExtrusionDetail, null);
  25. element1.AddToModel();
  26. }

ValidateConstruction()
功能说明:
代码示例:
属性:
AsIGeometry { get; }
功能说明:
代码示例:

1.4.2.4.5 DgnRotationalSweep

说明:强类型、兼容CommonGeoemtry的DgnRotationalSweep。
构造函数:
DgnRotationalSweep()
功能说明:构造函数,创建一个新的DgnRotationalSweep对象
代码示例:

  1. public void DgnRotationalSweepTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. //新建dgn旋转体信息
  10. Bentley.GeometryNET.DgnRotationalSweep dgnRotationalSweepDetail = new Bentley.GeometryNET.DgnRotationalSweep(curvePrimitives, DPoint3d.Zero, DVector3d.UnitZ, UorPerMas, true);
  11. //转化为element,并持久化到model中
  12. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  13. element.AddToModel();
  14. }

方法:
DispatchToDDHandler()
功能说明:
代码示例:
GetAxis()
功能说明:获取DgnRotationalSweep旋转轴
代码示例:

  1. public void GetAxisTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. //新建dgn旋转体信息
  10. Bentley.GeometryNET.DgnRotationalSweep dgnRotationalSweepDetail = new Bentley.GeometryNET.DgnRotationalSweep(curvePrimitives, DPoint3d.Zero, DVector3d.UnitZ, UorPerMas, true);
  11. //获取旋转轴
  12. DVector3d res = dgnRotationalSweepDetail.GetAxis();
  13. //转化为element,并持久化到model中
  14. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  15. element.AddToModel();
  16. }

GetBaseGeometry()
功能说明:获取DgnRotationalSweep基本的几何
代码示例:

  1. public void GetBaseGeometryTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. //新建dgn旋转体信息
  10. Bentley.GeometryNET.DgnRotationalSweep dgnRotationalSweepDetail = new Bentley.GeometryNET.DgnRotationalSweep(curvePrimitives, DPoint3d.Zero, DVector3d.UnitZ, UorPerMas, true);
  11. // 获取基本几何信息
  12. ISweepable sweepable = dgnRotationalSweepDetail.GetBaseGeometry();
  13. //转化为element,并持久化到model中
  14. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  15. element.AddToModel();
  16. }

GetCapped ()
功能说明:获取DgnRotationalSweep是否闭合
代码示例:

  1. public void GetCappedTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. //新建dgn旋转体信息
  10. Bentley.GeometryNET.DgnRotationalSweep dgnRotationalSweepDetail = new Bentley.GeometryNET.DgnRotationalSweep(curvePrimitives, DPoint3d.Zero, DVector3d.UnitZ, UorPerMas, true);
  11. // 获取是否闭合
  12. bool res = dgnRotationalSweepDetail.GetCapped();
  13. //转化为element,并持久化到model中
  14. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  15. element.AddToModel();
  16. }

GetCenter()
功能说明:获取DgnRotationalSweep的中点
代码示例:

  1. public void GetCenterTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. //新建dgn旋转体信息
  10. Bentley.GeometryNET.DgnRotationalSweep dgnRotationalSweepDetail = new Bentley.GeometryNET.DgnRotationalSweep(curvePrimitives, DPoint3d.Zero, DVector3d.UnitZ, UorPerMas, true);
  11. // 获取中点
  12. DPoint3d res = dgnRotationalSweepDetail.GetCenter();
  13. //转化为element,并持久化到model中
  14. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  15. element.AddToModel();
  16. }

GetSweepAngle()
功能说明:获取旋转角度
代码示例:

  1. public void GetSweepAngleTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. //新建dgn旋转体信息
  10. Bentley.GeometryNET.DgnRotationalSweep dgnRotationalSweepDetail = new Bentley.GeometryNET.DgnRotationalSweep(curvePrimitives, DPoint3d.Zero, DVector3d.UnitZ, UorPerMas, true);
  11. // 获取旋转角度
  12. Angle res = dgnRotationalSweepDetail.GetSweepAngle();
  13. //转化为element,并持久化到model中
  14. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  15. element.AddToModel();
  16. }

SetAxis()
功能说明:设置旋转轴
代码示例:

  1. public void SetAxisTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. //新建dgn旋转体信息
  10. Bentley.GeometryNET.DgnRotationalSweep dgnRotationalSweepDetail = new Bentley.GeometryNET.DgnRotationalSweep(curvePrimitives, DPoint3d.Zero, DVector3d.UnitZ, UorPerMas, true);
  11. //转化为element,并持久化到model中
  12. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  13. element.AddToModel();
  14. //设置新的旋转轴
  15. dgnRotationalSweepDetail.SetAxis(DVector3d.UnitX);
  16. //转化为element,并持久化到model中
  17. Element element1 = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  18. element1.AddToModel();
  19. }

SetBaseGeometry()
功能说明:
代码示例:
SetCapped()
功能说明:设置DgnRotationalSweep是否闭合
代码示例:

  1. public void SetCappedTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. //新建dgn旋转体信息
  10. Bentley.GeometryNET.DgnRotationalSweep dgnRotationalSweepDetail = new Bentley.GeometryNET.DgnRotationalSweep(curvePrimitives, DPoint3d.Zero, DVector3d.UnitZ, UorPerMas, true);
  11. //转化为element,并持久化到model中
  12. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  13. element.AddToModel();
  14. //设置新的闭合状态
  15. dgnRotationalSweepDetail.SetCapped(false);
  16. //转化为element,并持久化到model中
  17. Element element1 = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  18. element1.AddToModel();
  19. }

SetCenter()
功能说明:为DgnRotationalSweep设置新的中心点
代码示例:

  1. public void SetCenterTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. //新建dgn旋转体信息
  10. Bentley.GeometryNET.DgnRotationalSweep dgnRotationalSweepDetail = new Bentley.GeometryNET.DgnRotationalSweep(curvePrimitives, DPoint3d.Zero, DVector3d.UnitZ, UorPerMas, true);
  11. //转化为element,并持久化到model中
  12. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  13. element.AddToModel();
  14. //设置新的中心点
  15. dgnRotationalSweepDetail.SetCenter(new DPoint3d(UorPerMas,UorPerMas,UorPerMas));
  16. //转化为element,并持久化到model中
  17. Element element1 = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  18. element1.AddToModel();
  19. }

SetSweepAngle()
功能说明:为DgnRotationalSweep设置转转角度
代码示例:

  1. public void SetSweepAngleTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建圆作为旋转体的端面,指定旋转体的旋转轴
  7. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, UorPerMas, DVector3d.UnitY);
  8. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Inner);
  9. //新建dgn旋转体信息
  10. Bentley.GeometryNET.DgnRotationalSweep dgnRotationalSweepDetail = new Bentley.GeometryNET.DgnRotationalSweep(curvePrimitives, DPoint3d.Zero, DVector3d.UnitZ, UorPerMas, true);
  11. //转化为element,并持久化到model中
  12. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  13. element.AddToModel();
  14. //设置新的旋转角度
  15. dgnRotationalSweepDetail.SetSweepAngle(0.8*Angle.PI);
  16. //转化为element,并持久化到model中
  17. Element element1 = DraftingElementSchema.ToElement(dgnModel, dgnRotationalSweepDetail, null);
  18. element1.AddToModel();
  19. }

ValidateConstruction()
功能说明:
代码示例:
属性:
AsIGeometry { get; }
功能说明:
代码示例:

1.4.2.4.6 DgnRuledSweep

说明:强类型、兼容CommonGeoemtry的DgnRuledSweep。
构造函数:
DgnRuledSweep(IEnumerable, Boolean)
功能说明:构造函数,新建一个DgnRuledSweep对象
代码示例:

  1. public void DgnRuledSweepTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. List<CurveVector> curvePrimitives = new List<CurveVector>();
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. dPoint3Ds.Add(new DPoint3d(100000, 40000, 0));
  16. //创建CurveVector列表
  17. DEllipse3d dEllipse3D0 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[0], UorPerMas, DVector3d.UnitX);
  18. DEllipse3d dEllipse3D1 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[1], 0.5*UorPerMas, DVector3d.UnitY);
  19. DEllipse3d dEllipse3D2 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[2], 0.8*UorPerMas, DVector3d.UnitZ);
  20. DEllipse3d dEllipse3D3 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[3], 1.5*UorPerMas, DVector3d.UnitX);
  21. DEllipse3d dEllipse3D4 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[4], 0.9*UorPerMas, DVector3d.UnitY);
  22. CurveVector curvePrimitive = CurveVector.CreateDisk(dEllipse3D0, CurveVector.BoundaryType.Open );
  23. CurveVector curvePrimitive0 = CurveVector.CreateDisk(dEllipse3D1, CurveVector.BoundaryType.Open );
  24. CurveVector curvePrimitive1 = CurveVector.CreateDisk(dEllipse3D2, CurveVector.BoundaryType.Open );
  25. CurveVector curvePrimitive2 = CurveVector.CreateDisk(dEllipse3D3, CurveVector.BoundaryType.Open );
  26. CurveVector curvePrimitive3 = CurveVector.CreateDisk(dEllipse3D4, CurveVector.BoundaryType.Open);
  27. curvePrimitives.Add(curvePrimitive);
  28. curvePrimitives.Add(curvePrimitive0);
  29. curvePrimitives.Add(curvePrimitive1);
  30. curvePrimitives.Add(curvePrimitive2);
  31. curvePrimitives.Add(curvePrimitive3);
  32. //创建规则拉伸体 DgnRuledSweep
  33. Bentley.GeometryNET.DgnRuledSweep dgnRuledSweepDetail = new Bentley.GeometryNET.DgnRuledSweep(curvePrimitives, true);
  34. //转化为element 添加到model中
  35. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRuledSweepDetail, null);
  36. element.AddToModel();
  37. }

DgnRuledSweep(CurveVector, CurveVector, Boolean)
功能说明:构造函数,新建一个DgnRuledSweep对象
代码示例:

  1. public void DgnRuledSweepTest2()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. List<CurveVector> curvePrimitives = new List<CurveVector>();
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. dPoint3Ds.Add(new DPoint3d(100000, 40000, 0));
  16. //创建CurveVector列表
  17. DEllipse3d dEllipse3D0 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[0], UorPerMas, DVector3d.UnitX);
  18. DEllipse3d dEllipse3D1 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[1], 0.5 * UorPerMas, DVector3d.UnitY);
  19. DEllipse3d dEllipse3D2 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[2], 0.8 * UorPerMas, DVector3d.UnitZ);
  20. DEllipse3d dEllipse3D3 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[3], 1.5 * UorPerMas, DVector3d.UnitX);
  21. DEllipse3d dEllipse3D4 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[4], 0.9 * UorPerMas, DVector3d.UnitY);
  22. CurveVector curvePrimitive = CurveVector.CreateDisk(dEllipse3D0, CurveVector.BoundaryType.Open);
  23. CurveVector curvePrimitive0 = CurveVector.CreateDisk(dEllipse3D1, CurveVector.BoundaryType.Open);
  24. curvePrimitives.Add(curvePrimitive);
  25. curvePrimitives.Add(curvePrimitive0);
  26. //创建规则拉伸体 DgnRuledSweep
  27. Bentley.GeometryNET.DgnRuledSweep dgnRuledSweepDetail = new Bentley.GeometryNET.DgnRuledSweep(curvePrimitives[0], curvePrimitives[1], true);
  28. //转化为element 添加到model中
  29. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRuledSweepDetail, null);
  30. element.AddToModel();
  31. }

方法:
AddContour()
功能说明:
代码示例:
Contours()
功能说明:
代码示例:
DispatchToDDHandler()
功能说明:
代码示例:
GetCapped()
功能说明:获取DgnRuledSweep的闭合信息
代码示例:

  1. public void GetCappedTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. List<CurveVector> curvePrimitives = new List<CurveVector>();
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. dPoint3Ds.Add(new DPoint3d(100000, 40000, 0));
  16. //创建CurveVector列表
  17. DEllipse3d dEllipse3D0 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[0], UorPerMas, DVector3d.UnitX);
  18. DEllipse3d dEllipse3D1 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[1], 0.5 * UorPerMas, DVector3d.UnitY);
  19. DEllipse3d dEllipse3D2 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[2], 0.8 * UorPerMas, DVector3d.UnitZ);
  20. DEllipse3d dEllipse3D3 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[3], 1.5 * UorPerMas, DVector3d.UnitX);
  21. DEllipse3d dEllipse3D4 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[4], 0.9 * UorPerMas, DVector3d.UnitY);
  22. CurveVector curvePrimitive = CurveVector.CreateDisk(dEllipse3D0, CurveVector.BoundaryType.Open);
  23. CurveVector curvePrimitive0 = CurveVector.CreateDisk(dEllipse3D1, CurveVector.BoundaryType.Open);
  24. CurveVector curvePrimitive1 = CurveVector.CreateDisk(dEllipse3D2, CurveVector.BoundaryType.Open);
  25. CurveVector curvePrimitive2 = CurveVector.CreateDisk(dEllipse3D3, CurveVector.BoundaryType.Open);
  26. CurveVector curvePrimitive3 = CurveVector.CreateDisk(dEllipse3D4, CurveVector.BoundaryType.Open);
  27. curvePrimitives.Add(curvePrimitive);
  28. curvePrimitives.Add(curvePrimitive0);
  29. curvePrimitives.Add(curvePrimitive1);
  30. curvePrimitives.Add(curvePrimitive2);
  31. curvePrimitives.Add(curvePrimitive3);
  32. //创建规则拉伸体 DgnRuledSweep
  33. Bentley.GeometryNET.DgnRuledSweep dgnRuledSweepDetail = new Bentley.GeometryNET.DgnRuledSweep(curvePrimitives, true);
  34. //转化为element 添加到model中
  35. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRuledSweepDetail, null);
  36. element.AddToModel();
  37. // 获取是否闭合的信息,并打印出来
  38. bool res = dgnRuledSweepDetail.GetCapped();
  39. System.Windows.Forms.MessageBox.Show("is this DgnRuledSweep capped ? " + res.ToString());
  40. }

GetContourCount()
功能说明:获取DgnRuledSweep拉伸端面的数目
代码示例:

  1. public void GetContourCountTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. List<CurveVector> curvePrimitives = new List<CurveVector>();
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. dPoint3Ds.Add(new DPoint3d(100000, 40000, 0));
  16. //创建CurveVector列表
  17. DEllipse3d dEllipse3D0 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[0], UorPerMas, DVector3d.UnitX);
  18. DEllipse3d dEllipse3D1 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[1], 0.5 * UorPerMas, DVector3d.UnitY);
  19. DEllipse3d dEllipse3D2 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[2], 0.8 * UorPerMas, DVector3d.UnitZ);
  20. DEllipse3d dEllipse3D3 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[3], 1.5 * UorPerMas, DVector3d.UnitX);
  21. DEllipse3d dEllipse3D4 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[4], 0.9 * UorPerMas, DVector3d.UnitY);
  22. CurveVector curvePrimitive = CurveVector.CreateDisk(dEllipse3D0, CurveVector.BoundaryType.Open);
  23. CurveVector curvePrimitive0 = CurveVector.CreateDisk(dEllipse3D1, CurveVector.BoundaryType.Open);
  24. CurveVector curvePrimitive1 = CurveVector.CreateDisk(dEllipse3D2, CurveVector.BoundaryType.Open);
  25. CurveVector curvePrimitive2 = CurveVector.CreateDisk(dEllipse3D3, CurveVector.BoundaryType.Open);
  26. CurveVector curvePrimitive3 = CurveVector.CreateDisk(dEllipse3D4, CurveVector.BoundaryType.Open);
  27. curvePrimitives.Add(curvePrimitive);
  28. curvePrimitives.Add(curvePrimitive0);
  29. curvePrimitives.Add(curvePrimitive1);
  30. curvePrimitives.Add(curvePrimitive2);
  31. curvePrimitives.Add(curvePrimitive3);
  32. //创建规则拉伸体 DgnRuledSweep
  33. Bentley.GeometryNET.DgnRuledSweep dgnRuledSweepDetail = new Bentley.GeometryNET.DgnRuledSweep(curvePrimitives, true);
  34. //转化为element 添加到model中
  35. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRuledSweepDetail, null);
  36. element.AddToModel();
  37. // 获取是拉伸端面的信息,并打印出来
  38. int res = dgnRuledSweepDetail.GetContourCount();
  39. System.Windows.Forms.MessageBox.Show("this DgnRuledSweep's profiles number is " + res.ToString());
  40. }

SetCapped()
功能说明:设置DgnRuledSweep是否闭合
代码示例:

  1. public void SetCappedTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. List<CurveVector> curvePrimitives = new List<CurveVector>();
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(0, 0, 0));
  9. dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
  10. dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
  11. dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
  12. dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
  13. dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
  14. dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
  15. dPoint3Ds.Add(new DPoint3d(100000, 40000, 0));
  16. //创建CurveVector列表
  17. DEllipse3d dEllipse3D0 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[0], UorPerMas, DVector3d.UnitX);
  18. DEllipse3d dEllipse3D1 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[1], 0.5 * UorPerMas, DVector3d.UnitY);
  19. DEllipse3d dEllipse3D2 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[2], 0.8 * UorPerMas, DVector3d.UnitZ);
  20. DEllipse3d dEllipse3D3 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[3], 1.5 * UorPerMas, DVector3d.UnitX);
  21. DEllipse3d dEllipse3D4 = DEllipse3d.FromCenterRadiusNormal(dPoint3Ds[4], 0.9 * UorPerMas, DVector3d.UnitY);
  22. CurveVector curvePrimitive = CurveVector.CreateDisk(dEllipse3D0, CurveVector.BoundaryType.Open);
  23. CurveVector curvePrimitive0 = CurveVector.CreateDisk(dEllipse3D1, CurveVector.BoundaryType.Open);
  24. CurveVector curvePrimitive1 = CurveVector.CreateDisk(dEllipse3D2, CurveVector.BoundaryType.Open);
  25. CurveVector curvePrimitive2 = CurveVector.CreateDisk(dEllipse3D3, CurveVector.BoundaryType.Open);
  26. CurveVector curvePrimitive3 = CurveVector.CreateDisk(dEllipse3D4, CurveVector.BoundaryType.Open);
  27. curvePrimitives.Add(curvePrimitive);
  28. curvePrimitives.Add(curvePrimitive0);
  29. curvePrimitives.Add(curvePrimitive1);
  30. curvePrimitives.Add(curvePrimitive2);
  31. curvePrimitives.Add(curvePrimitive3);
  32. //创建规则拉伸体 DgnRuledSweep
  33. Bentley.GeometryNET.DgnRuledSweep dgnRuledSweepDetail = new Bentley.GeometryNET.DgnRuledSweep(curvePrimitives, true);
  34. //转化为element 添加到model中
  35. Element element = DraftingElementSchema.ToElement(dgnModel, dgnRuledSweepDetail, null);
  36. element.AddToModel();
  37. // 设置闭合为否
  38. bool res = dgnRuledSweepDetail.SetCapped(false);
  39. //转化为element 添加到model中
  40. Element element1 = DraftingElementSchema.ToElement(dgnModel, dgnRuledSweepDetail, null);
  41. element1.AddToModel();
  42. }

ValidateConstruction()
功能说明:
代码示例:
属性:
AsIGeometry { get; }
功能说明:
代码示例:

1.4.2.4.7 DgnSphere

说明:强类型、兼容CommonGeoemtry的DgnSphere。
构造函数:
DgnSphere(DPoint3d, Double)
功能说明:DgnSphere的构造函数
代码示例:

  1. public void DgnSphereTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建一个dgn圆柱体
  7. Bentley.GeometryNET.DgnSphere dgnSphereDetail = new Bentley.GeometryNET.DgnSphere(DPoint3d.Zero, UorPerMas);
  8. //将SolidPrimitive转化为element,并持久化到model中
  9. Element element = DraftingElementSchema.ToElement(dgnModel, dgnSphereDetail, null);
  10. element.AddToModel();
  11. }

DgnSphere(DPoint3d, DMatrix3d, Double)
功能说明:DgnSphere的构造函数
代码示例:

  1. public void DgnSphereTest2()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建一个dgn圆柱体
  7. Bentley.GeometryNET.DgnSphere dgnSphereDetail = new Bentley.GeometryNET.DgnSphere(DPoint3d.Zero, DMatrix3d.Identity, UorPerMas);
  8. //将SolidPrimitive转化为element,并持久化到model中
  9. Element element = DraftingElementSchema.ToElement(dgnModel, dgnSphereDetail, null);
  10. element.AddToModel();
  11. }

DgnSphere(DPoint3d, DVector3d, DVector3d, Double, Double, Angle, Angle, Boolean)
功能说明:DgnSphere的构造函数
代码示例:

  1. public void DgnSphereTest3()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建一个dgn圆柱体
  7. Bentley.GeometryNET.DgnSphere dgnSphereDetail = new Bentley.GeometryNET.DgnSphere(DPoint3d.Zero, DVector3d.UnitX,DVector3d.UnitZ,UorPerMas,2*UorPerMas,Angle.Zero,Angle.TWOPI,true);
  8. //将SolidPrimitive转化为element,并持久化到model中
  9. Element element = DraftingElementSchema.ToElement(dgnModel, dgnSphereDetail, null);
  10. element.AddToModel();
  11. }

方法:
DispatchToDDHandler ()
功能说明:
代码示例:
GetDgnSphere ()
功能说明:获取DgnSphere的信息
代码示例:

  1. public void GetDgnSphereTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建一个dgn圆柱体
  7. Bentley.GeometryNET.DgnSphere dgnSphereDetail = new Bentley.GeometryNET.DgnSphere(DPoint3d.Zero, UorPerMas);
  8. // 获取DgnSphere 的信息
  9. dgnSphereDetail.GetDgnSphere(out DPoint3d center, out DVector3d vectorX, out DVector3d vectorZ, out double radiusXY, out double radiusZ, out Angle startLatitude, out Angle latitudeSweep, out bool capped);
  10. //将SolidPrimitive转化为element,并持久化到model中
  11. Element element = DraftingElementSchema.ToElement(dgnModel, dgnSphereDetail, null);
  12. element.AddToModel();
  13. }

属性:
AsIGeometry { get; }
功能说明:
代码示例:

1.4.2.4.8 DgnTorusPipe

说明:强类型、兼容CommonGeoemtry的DgnTorusPipe。
构造函数:
DgnTorusPipe()
功能说明:构造函数,创建一个DgnTorusPipe对象
代码示例:

  1. public void DgnTorusPipeTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建dgn环管
  7. Bentley.GeometryNET.DgnTorusPipe dgnTorusPipeDetail = new Bentley.GeometryNET.DgnTorusPipe(DPoint3d.Zero, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, 0.5 * UorPerMas, Angle.NEGATIVE_PI, true);
  8. //转化为element,并持久化到model中
  9. Element element = DraftingElementSchema.ToElement(dgnModel, dgnTorusPipeDetail, null);
  10. element.AddToModel();
  11. }

方法:
DispatchToDDHandler ()
功能说明:
代码示例:
GetDgnTorusPipe ()
功能说明:获取DgnTorusPipe的信息
代码示例:

  1. public void GetDgnTorusPipeTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建dgn环管
  7. Bentley.GeometryNET.DgnTorusPipe dgnTorusPipeDetail = new Bentley.GeometryNET.DgnTorusPipe(DPoint3d.Zero, DVector3d.UnitX, DVector3d.UnitY, UorPerMas, 0.5 * UorPerMas, Angle.PI, true);
  8. // 获取DgnTorusPipe的信息
  9. dgnTorusPipeDetail.GetDgnTorusPipe(out DPoint3d center, out DVector3d vectorX, out DVector3d vectorY, out double majorRadius, out double minorRadius, out Angle sweepAngle, out bool capped);
  10. //转化为element,并持久化到model中
  11. Element element = DraftingElementSchema.ToElement(dgnModel, dgnTorusPipeDetail, null);
  12. element.AddToModel();
  13. }

属性:
AsIGeometry { get; }
功能说明:
代码示例:

1.4.2.4.9 Sphere

说明:强类型、兼容CommonGeoemtry的Sphere。
构造函数:
Sphere()
功能说明:
代码示例:
方法:
DispatchToDDHandler ()
功能说明:
代码示例:
GetSphere ()
功能说明:
代码示例:
属性:
AsIGeometry { get; }
功能说明:
代码示例:

1.4.2.4.10 TorusPipe

说明:强类型、兼容CommonGeoemtry的TorusPipe。
构造函数:
TorusPipe()
功能说明:
代码示例:
方法:
DispatchToDDHandler ()
功能说明:
代码示例:
GetTorusPipe ()
功能说明:
代码示例:
属性:
AsIGeometry { get; }
功能说明:
代码示例:

1.5 AnySurface

说明:
方法:
属性:

1.5.1 AnyParametricSurface

说明:
方法:
属性:

1.5.2 CurveBoundedRegion

说明:
方法:
属性:

1.5.2.1 CurvePrimitiveCollection

说明:
方法:
属性:

1.5.2.1.1 UnionRegion
说明:
方法:
属性:

1.5.2.2 CurvePrimitiveCollection

说明:
方法:
属性:

1.5.2.2.1 CurveVector

说明:CurveVector是曲线基元的集合,该集合有一个特定的边界类型,是它作为开链、单个循环(内部或外部),或者多个循环的父循环。可以用来表示路径、回路、多回路区域和集合。
构造器:
CurveVector()
功能说明:构造函数,创建一个空的CurveVector对象
代码示例:

  1. public void CurveVectorTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //构造函数新建一个CurveVector对象
  7. Bentley.GeometryNET.CurveVector curvePrimitives11 = new Bentley.GeometryNET.CurveVector(Bentley.GeometryNET.CurveVector.BoundaryType.Outer);
  8. //新建一个 CurveVector
  9. DVector3d dVector3D = new DVector3d(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
  10. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 3 * UorPerMas, dVector3D);
  11. Bentley.GeometryNET.CurveVector curvePrimitives = Bentley.GeometryNET.CurveVector.CreateDisk(dEllipse3D, Bentley.GeometryNET.CurveVector.BoundaryType.Outer);
  12. curvePrimitives11 = curvePrimitives;
  13. //将平面上方的曲线转化为element,并添加到model中
  14. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives11, null);
  15. element.AddToModel();
  16. }

方法:
AppendSplitCurvesByPlane ()
功能说明:通过平面分裂曲线
代码示例:

  1. public void AppendSplitCurvesByPlaneTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建一个 CurveVector
  7. DVector3d dVector3D = new DVector3d(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
  8. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 3*UorPerMas, dVector3D);
  9. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);
  10. // 准备切割线的平面
  11. DPlane3d dPlane3D = new DPlane3d(DPoint3d.Zero, DVector3d.UnitX);
  12. // 准备空的接收函数执行结果的 CurveVector
  13. CurveVector belowCollector = CurveVector.Create(CurveVector.BoundaryType.Outer);
  14. CurveVector aboveCollector = CurveVector.Create(CurveVector.BoundaryType.Outer);
  15. CurveVector onCollector = CurveVector.Create(CurveVector.BoundaryType.Outer);
  16. //使用方法,得到平面切割后的曲线
  17. curvePrimitives.AppendSplitCurvesByPlane(dPlane3D, belowCollector, aboveCollector, onCollector);
  18. //将平面上方的曲线转化为element,并添加到model中
  19. Element element = DraftingElementSchema.ToElement(dgnModel, aboveCollector, null);
  20. element.AddToModel();
  21. }

AppendSplitCurvesByRegion ()
功能说明:使用region切割曲线,返回region上、内部、外部的曲线
代码示例:

  1. public void AppendSplitCurvesByRegionTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建一个 CurveVector
  7. //DVector3d dVector3D = new DVector3d(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
  8. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 2*UorPerMas, DVector3d.UnitZ);
  9. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);
  10. // 新建一个用于切割的CurveVector
  11. DEllipse3d dEllipse3D1 = DEllipse3d.FromCenterRadiusNormal(new DPoint3d(UorPerMas,0,0), 2* UorPerMas, DVector3d.UnitZ);
  12. CurveVector region = CurveVector.CreateDisk(dEllipse3D1, CurveVector.BoundaryType.Outer);
  13. // 准备空的接收函数执行结果的 CurveVector
  14. CurveVector insideCollector = CurveVector.Create(CurveVector.BoundaryType.Outer);
  15. CurveVector outsideCollector = CurveVector.Create(CurveVector.BoundaryType.Outer);
  16. CurveVector onCollector = CurveVector.Create(CurveVector.BoundaryType.Outer);
  17. //使用方法,获取区域内、外,和区域上的CurveVector
  18. curvePrimitives.AppendSplitCurvesByRegion(region, insideCollector, outsideCollector, onCollector);
  19. //将区域内的曲线转化为element,并添加到model中
  20. Element element = DraftingElementSchema.ToElement(dgnModel, insideCollector, null);
  21. element.AddToModel();
  22. }

AreaDifference ()
功能说明:求两个curveVector相减的区域
AreaOperations.png
代码示例:

  1. public void AreaDifferenceTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建两个 CurveVector
  7. //DVector3d dVector3D = new DVector3d(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
  8. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 2 * UorPerMas, DVector3d.UnitZ);
  9. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);
  10. DEllipse3d dEllipse3D1 = DEllipse3d.FromCenterRadiusNormal(new DPoint3d(UorPerMas, 0, 0), 2 * UorPerMas, DVector3d.UnitZ);
  11. CurveVector region = CurveVector.CreateDisk(dEllipse3D1, CurveVector.BoundaryType.Outer);
  12. // 求两个CurveVector的不同部分,将结果转化为element, 添加到model中
  13. CurveVector result = CurveVector.AreaDifference(curvePrimitives, region);
  14. Element element = DraftingElementSchema.ToElement(dgnModel, result, null);
  15. element.AddToModel();
  16. }

AreaIntersection ()
功能说明:求两个CurveVector的相交区域
代码示例:

  1. public void AreaIntersectionTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建两个 CurveVector
  7. //DVector3d dVector3D = new DVector3d(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
  8. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 2 * UorPerMas, DVector3d.UnitZ);
  9. CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);
  10. DEllipse3d dEllipse3D1 = DEllipse3d.FromCenterRadiusNormal(new DPoint3d(UorPerMas, 0, 0), 2 * UorPerMas, DVector3d.UnitZ);
  11. CurveVector region = CurveVector.CreateDisk(dEllipse3D1, CurveVector.BoundaryType.Outer);
  12. // 求两个CurveVector的相交部分,将结果转化为element, 添加到model中
  13. CurveVector result = CurveVector.AreaIntersection(curvePrimitives, region);
  14. Element element = DraftingElementSchema.ToElement(dgnModel, result, null);
  15. element.AddToModel();
  16. }

AreaOffset ()
功能说明:设置曲线区域偏移
代码示例:

  1. public void AreaOffsetTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建一个 CurveVector
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0));
  9. dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0));
  10. dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, 0));
  11. dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 0));
  12. CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);
  13. //偏移曲线区域
  14. CurveVector result = curvePrimitives.AreaOffset(3*UorPerMas, 0, 0);
  15. //将原曲线和偏移后的曲线转为element, 添加到model中
  16. Element element = DraftingElementSchema.ToElement(dgnModel, result, null);
  17. element.AddToModel();
  18. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
  19. element1.AddToModel();
  20. }

AreaParity ()
功能说明:返回去除两个曲线公共区域之后部分
代码示例:

  1. public void AreaParityTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建两个 CurveVector
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0));
  9. dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0));
  10. dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, 0));
  11. dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 0));
  12. CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);
  13. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 3 * UorPerMas, DVector3d.UnitZ);
  14. CurveVector curvePrimitives1 = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);
  15. //返回去除两个曲线公共区域之后部分
  16. CurveVector curvePrimitives11 = CurveVector.AreaParity(curvePrimitives, curvePrimitives1);
  17. //以上三个曲线转为element,添加到model中
  18. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
  19. element.AddToModel();
  20. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives1, null);
  21. element1.AddToModel();
  22. Element element11 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives11, null);
  23. element11.AddToModel();
  24. }

AreaUnion ()
功能说明:返回两个曲线合并后的区域
代码示例:

  1. public void AreaUnionTest1()
  2. {
  3. double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
  4. DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
  5. ModelInfo modelInfo = dgnModel.GetModelInfo();
  6. //新建两个 CurveVector
  7. List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
  8. dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0));
  9. dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0));
  10. dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, 0));
  11. dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 0));
  12. CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);
  13. DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 3 * UorPerMas, DVector3d.UnitZ);
  14. CurveVector curvePrimitives1 = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);
  15. //返回两个曲线合并后的区域
  16. CurveVector curvePrimitives11 = CurveVector.AreaUnion(curvePrimitives, curvePrimitives1);
  17. //以上三个曲线转为element,添加到model中
  18. Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
  19. element.AddToModel();
  20. Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives1, null);
  21. element1.AddToModel();
  22. Element element11 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives11, null);
  23. element11.AddToModel();
  24. }

CentroidAreaXY ()
功能说明:返回在xy平面上看到的曲线矢量的形心和面积。如果曲率面不是区域类型之一(联合区域、宇称区域或闭环),则返回false。
代码示例:

 public void CentroidAreaXYTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 倾斜的圆
            DVector3d dVector3D = new DVector3d(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 3 * UorPerMas, dVector3D);
            CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);

            //返回在xy平面上看到的曲线矢量的形心和面积
            bool res = curvePrimitives.CentroidAreaXY(out DPoint3d centerPt, out double area);

            bool ress = curvePrimitives.CentroidNormalArea(out DPoint3d dPoint3Dss, out DVector3d dVector3D1, out double areass);

            System.Windows.Forms.MessageBox.Show("the AreaXY is "+ area.ToString()+ "\n\r the initial area is " + areass.ToString());
        }

CentroidNormalArea ()
功能说明:返回曲线向量的形心、法向量和面积。如果曲率面不是区域类型之一(联合区域、宇称区域或闭环),则返回false
代码示例:

public void CentroidNormalAreaTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 倾斜的圆
            DVector3d dVector3D = new DVector3d(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 3 * UorPerMas, dVector3D);
            CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);

            //返回曲线向量的形心、法向量和面积
            bool ress = curvePrimitives.CentroidNormalArea(out DPoint3d dPoint3Dss, out DVector3d dVector3D1, out double areass);

            System.Windows.Forms.MessageBox.Show(" the initial area is " + areass.ToString());
        }

Clone ()
功能说明:深度拷贝
代码示例:

public void CloneTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 倾斜的圆
            DVector3d dVector3D = new DVector3d(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 3 * UorPerMas, dVector3D);
            CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);

            //对上一步骤创建的曲线深度拷贝
            CurveVector curvePrimitives1 = curvePrimitives.Clone();

            //以上两个曲线转为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives1, null);
            element1.AddToModel();
        }

CloneAsBsplines ()
功能说明:返回curvePrimitives的深度复制,并将其中的curvePrimitives替换为B样条曲线,并且其上部树结构被保留
代码示例:

public void CloneAsBsplinesTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 倾斜的圆
            DVector3d dVector3D = new DVector3d(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 3 * UorPerMas, dVector3D);
            CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);

            //返回curvePrimitives的深度复制,并将其中的curvePrimitives替换为B样条曲线
            CurveVector curvePrimitives1 = curvePrimitives.CloneAsBsplines();

            //以上两个曲线转为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives1, null);
            element1.AddToModel();

        }

CloneBetweenCyclicIndexedFractions ()
功能说明:深度拷贝index0的fractionA到index1的fractionB之间的曲线,支持循环拷贝
代码示例:

public void CloneBetweenCyclicIndexedFractionsTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 0));

            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            // 深度拷贝index0的fractionA到index1的fractionB之间的曲线
            CurveVector curvePrimitives1 = curvePrimitives.CloneBetweenCyclicIndexedFractions(2, 0.2, 0, 0.6);

            //以上两个曲线转为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives1, null);
            element1.AddToModel();


        }

CloneBetweenDirectedFractions ()
功能说明:深度拷贝index0的fractionA到index1的fractionB之间的曲线,不支持循环拷贝,仅能按照索引顺序
代码示例:

 public void CloneBetweenDirectedFractionsTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 0));

            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            // 深度拷贝index0的fractionA到index1的fractionB之间的曲线
            CurveVector curvePrimitives1 = curvePrimitives.CloneBetweenDirectedFractions(0, 0.2, 2, 0.6,false);

            //以上两个曲线转为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives1, null);
            element1.AddToModel();
        }

CloneDereferenced ()
功能说明:
代码示例:
CloneOffsetCurvesXY ()
功能说明:返回曲线带符号(正负号表示放大缩小)的距离偏移后的(深度)克隆。这是一种曲线运算,可能会得到自相交的偏移曲线。
代码示例:

 public void CloneOffsetCurvesXYTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 0));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //以上曲线转为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            //偏移曲线(该例子得到了自相交的曲线)
            CurveVector curvePrimitives1 = curvePrimitives.CloneOffsetCurvesXY(4 * UorPerMas, 0, 0);

            //以上曲线转为element,添加到model中
            Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives1, null);
            element1.AddToModel();
        }

CloneWithFillets ()
功能说明:返回曲线倒角后的深度克隆
代码示例:

 public void CloneWithFilletsTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 0));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //以上曲线转为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 深度克隆并倒角
            CurveVector curvePrimitives1 = curvePrimitives.CloneWithFillets(0.1 * UorPerMas);

            //以上曲线转为element,添加到model中

            Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives1, null);
            element1.AddToModel();
        }

CloneWithSplits ()
功能说明:返回曲线被分割后的深度克隆
代码示例:

public void CloneWithSplitsTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 0));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            // 新建分割的曲线
            List<DPoint3d> dPoint3Dss = new List<DPoint3d>();
            dPoint3Dss.Add(new DPoint3d(-2*UorPerMas, -0, 0));
            dPoint3Dss.Add(new DPoint3d(2*UorPerMas, 0, 0));
            CurveVector curvePrimitives0 = CurveVector.CreateLinear(dPoint3Dss, CurveVector.BoundaryType.Inner, false);
            //源曲线转化为element 添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            //对曲线进行分割
            CurveVector curvePrimitives1 = curvePrimitives.CloneWithSplits(curvePrimitives0);

            //以上曲线转为element,添加到model中
            Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives1, null);
            element1.AddToModel();
        }

ClosestPointBounded ()
功能说明:获取曲线上离目标点最近的点
代码示例:

public void ClosestPointBoundedTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 0));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //转化为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获取曲线上离目标点最近的点
            CurveLocationDetail res = curvePrimitives.ClosestPointBounded(new DPoint3d(-1.1 * UorPerMas, -UorPerMas, 0));

            //将目标点和曲线上的最近点连成直线,添加到model中
            DSegment3d dSegment3D = new DSegment3d(new DPoint3d(-1.1 * UorPerMas, -UorPerMas, 0), res.Point);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();

        }

ClosestPointBoundedXY(DPoint3d)
功能说明:仅使用XY坐标获取离曲线上最近的点
代码示例:

public void ClosestPointBoundedXYTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0.3 * UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0.8 * UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 1.3 * UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //转化为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获取曲线上离目标点最近的点
            CurveLocationDetail res = curvePrimitives.ClosestPointBoundedXY(new DPoint3d(-1.1 * UorPerMas, -UorPerMas, 0));

            //将目标点和曲线上的最近点连成直线,添加到model中
            DSegment3d dSegment3D = new DSegment3d(new DPoint3d(-1.1 * UorPerMas, -UorPerMas, 0), res.Point);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }

ClosestPointBoundedXY(DPoint3d, DMatrix4d)
功能说明:仅使用XY坐标获取离曲线上最近的点
代码示例:

public void ClosestPointBoundedXYTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0.3*UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0.8*UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 1.3*UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //转化为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获取曲线上离目标点最近的点
            CurveLocationDetail res = curvePrimitives.ClosestPointBoundedXY(new DPoint3d(-1.1 * UorPerMas, -UorPerMas, 0),DMatrix4d.Identity);

            //将目标点和曲线上的最近点连成直线,添加到model中
            DSegment3d dSegment3D = new DSegment3d(new DPoint3d(-1.1 * UorPerMas, -UorPerMas, 0), res.Point);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }

ComputeSecondMomentAreaProducts ()
功能说明:返回曲线的面积、质心、方向和主力矩,计算时将其视为一个薄平面。
代码示例:

 public void ComputeSecondMomentAreaProductsTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0.3 * UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0.8 * UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 1.3 * UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //转化为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();
            // 获取返回曲线的面积、质心、方向和主力矩,存在矩阵中
            bool result = curvePrimitives.ComputeSecondMomentAreaProducts(out DMatrix4d dMatrix4D);
            if (result )
            {
                System.Windows.Forms.MessageBox.Show("get the SecondMomentAreaProducts successfully");
            }

        }

ComputeSecondMomentWireProducts ()
功能说明:返回面积、质心、方向和主要力矩,计算时将其视为一条线
代码示例:

 public void ComputeSecondMomentWireProductsTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0.3 * UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0.8 * UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 1.3 * UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //转化为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();
            // 获取返回曲线的面积、质心、方向和主力矩,存在矩阵中
            bool result = curvePrimitives.ComputeSecondMomentWireProducts(out DMatrix4d dMatrix4D);
            if (result)
            {
                System.Windows.Forms.MessageBox.Show("get the SecondMomentWireProducts successfully");
            }

        }

ConsolidateAdjacentPrimitives ()
功能说明:合并更新相邻的部件;相邻的线和线串会变成单个线串;消除线串内部的公众点;相邻和兼容的弧会变成单弧
代码示例:

public void ConsolidateAdjacentPrimitivesTest1()
        {

            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0.3 * UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0.8 * UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //转化为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            DSegment3d dSegment3D = new DSegment3d(dPoint3Ds[2], new DPoint3d(3*UorPerMas, 6*UorPerMas, UorPerMas));
            CurvePrimitive curvePrimitive = CurvePrimitive.CreateLine(dSegment3D);

            curvePrimitives.Add(curvePrimitive);
            //合并相邻的部件
            curvePrimitives.ConsolidateAdjacentPrimitives();
            //转化为element,添加到model中
            Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element1.AddToModel();
        }

CountPrimitivesOfType ()
功能说明:获取曲线中某种类型曲线的数量
代码示例:

public void CountPrimitivesOfTypeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0.3 * UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0.8 * UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //转化为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();
            //获取曲线中某种类型曲线的数量
            int res = curvePrimitives.CountPrimitivesOfType(CurvePrimitive.CurvePrimitiveType.LineString);
            System.Windows.Forms.MessageBox.Show("the count of LineString in this curve vector is " + res.ToString());
        }

Create ()
功能说明:创建一个特定类型的空的曲线对象
代码示例:

             double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //创建一个特定类型的空的曲线对象
            CurveVector curvePrimitives = CurveVector.Create(CurveVector.BoundaryType.Inner);

CreateDisk ()
功能说明:静态方法,创建圆弧
代码示例:

             double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            DVector3d dVector3D = new DVector3d(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 3 * UorPerMas, dVector3D);
            CurveVector curvePrimitives = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);

            //将平面上方的曲线转化为element,并添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

CreateFromNative ()
功能说明:从指针创建曲线
代码示例:

public void CreateFromNativeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            DEllipse3d dEllipse3D = new DEllipse3d(0 * UorPerMas, 5 * UorPerMas, 0 * UorPerMas, 10 * UorPerMas, 10 * UorPerMas, 0 * UorPerMas); //创建DEllipse3d
            //新建一个 CurvePrimitive
            CurvePrimitive curvePrimitive = CurvePrimitive.CreateArc(dEllipse3D);
            // 获取指针
            IntPtr intPtr = CurvePrimitive.DereferenceToNative(curvePrimitive, false);
            // 从指针创建曲线
            CurveVector curvePrimitives = CurveVector.CreateFromNative(intPtr);

            //将平面上方的曲线转化为element,并添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();
        }

CreateLinear ()
功能说明:创建线串曲线
代码示例:

public void CreateLinearTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建两个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 0));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);
            //将平面上方的曲线转化为element,并添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();
        }

CreateStrongTypeFromNativeCurveVector ()
功能说明:使用指针创建新的曲线
代码示例:

 public void CreateStrongTypeFromNativeCurveVectorTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            DEllipse3d dEllipse3D = new DEllipse3d(0 * UorPerMas, 5 * UorPerMas, 0 * UorPerMas, 10 * UorPerMas, 10 * UorPerMas, 0 * UorPerMas); //创建DEllipse3d
            //新建一个 CurvePrimitive
            CurvePrimitive curvePrimitive = CurvePrimitive.CreateArc(dEllipse3D);
            // 获取指针
            IntPtr intPtr = CurvePrimitive.DereferenceToNative(curvePrimitive, false);
            // 从指针创建曲线
            CurveVector curvePrimitives = CurveVector.CreateStrongTypeFromNativeCurveVector(intPtr,CreateAction.Clone);

            //将平面上方的曲线转化为element,并添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();
        }

CreateXYHatch ()
功能说明:返回一个边界类型为None的曲线,其中包含线段的网格线。
代码示例:

 public void CreateXYHatchTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();
            // 创建新的CurveVector,转化为element并添加到model中
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, 0));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, 0));
            CurveVector curvePrimitives0 = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives0, null);
            element.AddToModel();

            //返回一个边界类型为None的曲线,其中包含线段的网格线,转化为element并添加到model中
            CurveVector curvePrimitives = CurveVector.CreateXYHatch(curvePrimitives0, DPoint3d.Zero, UorPerMas, 0.25 * UorPerMas);

            Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element1.AddToModel();
        }

CurveLocationDetailCompare ()
功能说明:如果位置0等于位置1,则返回0;位置0小于位置1则返回-1;位置0大于位置1则返回1。仅使用位置的索引和fraction来进行比较
代码示例:

public void CurveLocationDetailCompareTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            // 获取曲线的两个位置信息
            CurveLocationDetail curveLocationDetail = curvePrimitives.ClosestPointBounded(DPoint3d.Zero);
            CurveLocationDetail curveLocationDetail2 = curvePrimitives.ClosestPointBoundedXY(DPoint3d.Zero);

            //比较两个位置,将结果打印出来
             int rees = curvePrimitives.CurveLocationDetailCompare(curveLocationDetail, curveLocationDetail2);

            System.Windows.Forms.MessageBox.Show("the compare result is " + rees.ToString());
        }

CurveLocationDetailIndex ()
功能说明:获取曲线位置索引(仅对单个开放或者封闭的向量有效);如果没有找到则返回SIZE_MAX
代码示例:

public void CurveLocationDetailIndexTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);
            // 获取一个位置信息
            CurveLocationDetail curveLocationDetail = curvePrimitives.ClosestPointBounded(DPoint3d.Zero);
            // 获取索引值,显示在消息窗口中
            uint res = curvePrimitives.CurveLocationDetailIndex(curveLocationDetail);

            System.Windows.Forms.MessageBox.Show("the locarion index result is " + res.ToString());

        }

CyclicIndex ()
功能说明:
代码示例:
DereferenceToNative ()
功能说明:获取指针值
代码示例:

public void DereferenceToNativeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);
            //获取曲线的指针值,并显示在消息框中
            IntPtr res = CurveVector.DereferenceToNative(curvePrimitives, true);
            System.Windows.Forms.MessageBox.Show("the locarion index result is " + res.ToString());
        }

FastMaxAbs ()
功能说明:返回任意坐标中绝对值最大的估计。这将检查所有的曲线,允许返回安全的近似值,如B样条的极点坐标,而不是精确的计算值
代码示例:

public void FastMaxAbsTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            // 获取绝对值最大的坐标,打印在消息窗口中
            double res = curvePrimitives.FastMaxAbs();
            System.Windows.Forms.MessageBox.Show("the FastMaxAbs result is " + res.ToString());
        }

FixupXYOuterInner ()
功能说明:
代码示例:
GetBoundaryType ()
功能说明:获取曲线的边界类型
代码示例:

public void GetBoundaryTypeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //获取边界类型,并打印在消息框中
            var res = curvePrimitives.GetBoundaryType();

            System.Windows.Forms.MessageBox.Show("the BoundaryType  is " + res.ToString());

        }

GetPrimitive ()
功能说明:获取某个索引处的曲线
代码示例:

public void GetPrimitiveTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //转为element,添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            //获取索引为1处的曲线,转为element,添加到model中
            var res = curvePrimitives.GetPrimitive(1);
            Element element1 = DraftingElementSchema.ToElement(dgnModel, res, null);
            element1.AddToModel();

        }

GetRange ()
功能说明:获取元素的范围
代码示例:

public void GetRangeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //获取元素的范围
            bool res = curvePrimitives.GetRange(out DRange3d dRange3D);

            //将range的顶底点做成直线,添加到model中
            DSegment3d dSegment3D = new DSegment3d(dRange3D.Low, dRange3D.High);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }

GetStartEnd(DPoint3d, DPoint3d)
功能说明:获取曲线的起始点
代码示例:

public void GetStartEndTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            var res = curvePrimitives.GetStartEnd(out DPoint3d dPoint3D, out DPoint3d dPoint3DEnd);
            //将曲线的起终点做成直线,添加到model中
            DSegment3d dSegment3D = new DSegment3d(dPoint3D, dPoint3DEnd);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }

GetStartEnd(DPoint3d, DPoint3d, DVector3d, DVector3d)
功能说明:获取曲线的起始点
代码示例:

public void GetStartEndTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;
            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            var res = curvePrimitives.GetStartEnd(out DPoint3d dPoint3D, out DPoint3d dPoint3DEnd,out DVector3d dVector3DStart,out DVector3d dVector3DEnd);
            //将曲线的起终点做成直线,添加到model中
            DSegment3d dSegment3D = new DSegment3d(dPoint3D, dPoint3DEnd);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }

GetStartPoint ()
功能说明:获取曲线的起点
代码示例:

 public void GetStartPointTest1()
        {

            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            var res = curvePrimitives.GetStartPoint(out DPoint3d dPoint3D);
            //将曲线的起点和原点做成直线,添加到model中
            DSegment3d dSegment3D = new DSegment3d(dPoint3D, DPoint3d.Zero);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }
    }

IsPlanar ()
功能说明:获取曲线的变换矩阵和范围
代码示例:

public void IsPlanarTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            var res = curvePrimitives.IsPlanar(out DTransform3d localToWorld, out DTransform3d worldToLocal, out DRange3d range);
            //将曲线的起点和原点做成直线,添加到model中
            DSegment3d dSegment3D = new DSegment3d(range.Low, range.High);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }

IsSameStructure ()
功能说明:判断两个曲线是否有相同结构
代码示例:

public void IsSameStructureTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //新建一个 CurveVector
            DVector3d dVector3D = new DVector3d(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            DEllipse3d dEllipse3D = DEllipse3d.FromCenterRadiusNormal(DPoint3d.Zero, 3 * UorPerMas, dVector3D);
            CurveVector curvePrimitives1 = CurveVector.CreateDisk(dEllipse3D, CurveVector.BoundaryType.Outer);
            //判断两条曲线是否有相同结构,结果打印出来            
            var res  =  curvePrimitives1.IsSameStructure(curvePrimitives);
            System.Windows.Forms.MessageBox.Show("these curve is same structure or not " + res.ToString());
        }

IsSameStructureAndGeometry ()
功能说明:判断两条曲线是否有相同的几何和结构
代码示例:

  public void IsSameStructureAndGeometryTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //新建一个 CurveVector
            CurveVector curvePrimitives1 = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Outer, false);

            var res = curvePrimitives1.IsSameStructureAndGeometry(curvePrimitives,0.01*UorPerMas);
            System.Windows.Forms.MessageBox.Show("these curve is same structure and Geometry or not " + res.ToString());
        }

PointInOnOutXY ()
功能说明:当在XY面上观察点时,判断点是在曲线区域内、外、上。如果曲线不是一个区域,则返回INOUT_Unknown(例如 当曲线类型为 BOUNDARY_TYPE_Outer, BOUNDARY_TYPE_Inner, BOUNDARY_TYPE_ParityRegion, or BOUNDARY_TYPE_Union )
代码示例:

        public void PointInOnOutXYTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);


            // 判断两个点的和曲线区域的关系,将结果打印出来
            InOutClassification res = curvePrimitives.PointInOnOutXY(DPoint3d.Zero);
            InOutClassification res1 = curvePrimitives.PointInOnOutXY(new DPoint3d(0,0,UorPerMas));

            System.Windows.Forms.MessageBox.Show("the result of check point zero  is " + res.ToString()+ "\n\r  the result of check point (0,0,1) is " + res1.ToString() );
        }

ReduceToCCWAreas ()
功能说明:清除曲线中逆时针方向的曲线,返回仅顺时针的曲线
代码示例:

public void ReduceToCCWAreasTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector,顺时针
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //新建逆时针方向的曲线
            List<DPoint3d> dPoint3Dss = new List<DPoint3d>();
            dPoint3Dss.Add(new DPoint3d(2*UorPerMas, -UorPerMas, -UorPerMas));
            dPoint3Dss.Add(new DPoint3d(2 * UorPerMas, UorPerMas, UorPerMas));
            dPoint3Dss.Add(new DPoint3d(0, -UorPerMas, UorPerMas));
            dPoint3Dss.Add(new DPoint3d(0, UorPerMas, -UorPerMas));

            CurvePrimitive curve = CurvePrimitive.CreateLineString(dPoint3Dss);
            curvePrimitives.Add(curve);

            // 返回只包含顺时针方向的曲线,转成element 添加到mnodel中
            CurveVector res = CurveVector.ReduceToCCWAreas(curvePrimitives);
            Element element = DraftingElementSchema.ToElement(dgnModel, res, null);
            element.AddToModel();

        }

ResolveTolerance ()
功能说明:根据FastMasAbs的内容返回给定公差和容许误差
代码示例:

public void ResolveToleranceTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector,顺时针
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);
            //获取返回的误差,打印在窗口
            double res = curvePrimitives.ResolveTolerance(UorPerMas * 0.00001);
            System.Windows.Forms.MessageBox.Show("the returned Tolerance is " + res.ToString());
        }

Stroke ()
功能说明:将曲线深度拷贝为特定样式的线条
代码示例:

  public void StrokeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //转为element  添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 新建一个facet option
            FacetOptions facetOptions = new FacetOptions();

            facetOptions.ParamDistanceScale = 0.1 * UorPerMas;
            //将去爱你替换为特性样式的线条,转为element 添加到model中
            CurveVector curvePrimitives1 =  curvePrimitives.Stroke(facetOptions);
            Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives1, null);
            element1.AddToModel();
        }

SumOfLengths ()
功能说明:返回所有包含曲线的总长度
代码示例:

public void SumOfLengthsTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector,顺时针
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);



            //新建逆时针方向的曲线
            List<DPoint3d> dPoint3Dss = new List<DPoint3d>();
            dPoint3Dss.Add(new DPoint3d(2 * UorPerMas, -UorPerMas, -UorPerMas));
            dPoint3Dss.Add(new DPoint3d(2 * UorPerMas, UorPerMas, UorPerMas));
            dPoint3Dss.Add(new DPoint3d(0, -UorPerMas, UorPerMas));
            dPoint3Dss.Add(new DPoint3d(0, UorPerMas, -UorPerMas));

            CurvePrimitive curve = CurvePrimitive.CreateLineString(dPoint3Dss);
            curvePrimitives.Add(curve);

            //转为element  添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获得总长度 打印在消息框中
            double length = curvePrimitives.SumOfLengths();
            System.Windows.Forms.MessageBox.Show("the total length is " + (length/UorPerMas).ToString());
        }

SwapAt ()
功能说明:交换给定下标的元素。如果任何一个索引越界,返回false
代码示例:

public void SwapAtTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);


            //新建另一个曲线
            List<DPoint3d> dPoint3Dss = new List<DPoint3d>();
            dPoint3Dss.Add(new DPoint3d(2 * UorPerMas, -UorPerMas, -UorPerMas));
            dPoint3Dss.Add(new DPoint3d(2 * UorPerMas, UorPerMas, UorPerMas));
            dPoint3Dss.Add(new DPoint3d(0, -UorPerMas, UorPerMas));
            dPoint3Dss.Add(new DPoint3d(0, UorPerMas, -UorPerMas));

            CurvePrimitive curve = CurvePrimitive.CreateLineString(dPoint3Dss);
            curvePrimitives.Add(curve);

            //交换两个曲线位置
            bool res = curvePrimitives.SwapAt(1, 0);

            //将交换后的曲线转为element   添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);

        }

Transform ()
功能说明:对曲线进行变换
代码示例:

public void TransformTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //将交换后的曲线转为element   添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 对曲线进行变换
            DTransform3d dTransform3D = new DTransform3d(UorPerMas,UorPerMas,UorPerMas,2*UorPerMas, 2 * UorPerMas, 2 * UorPerMas, 3 * UorPerMas, 3 * UorPerMas, 3 * UorPerMas);
            bool res =  curvePrimitives.Transform(dTransform3D);

            //将交换后的曲线转为element   添加到model中
            Element element1 = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();
        }

WireCentroid ()
功能说明:将曲线视为导线,返回所包含曲线的质心;返回false如果曲线为空
代码示例:

 public void WireCentroidTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建一个 CurveVector
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, -UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(-UorPerMas, UorPerMas, -UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, UorPerMas, UorPerMas));
            dPoint3Ds.Add(new DPoint3d(UorPerMas, -UorPerMas, -UorPerMas));
            CurveVector curvePrimitives = CurveVector.CreateLinear(dPoint3Ds, CurveVector.BoundaryType.Inner, false);

            //将交换后的曲线转为element   添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();


            // 获取曲线的长度和终点
            bool res =  curvePrimitives.WireCentroid(out double length, out DPoint3d CenterPoint);

            string XXX = (CenterPoint.X / UorPerMas).ToString();
            string YYY = (CenterPoint.Y / UorPerMas).ToString();
            string ZZZ = (CenterPoint.Z / UorPerMas).ToString();
            // 将中点坐标打印在消息框中

            System.Windows.Forms.MessageBox.Show("the CenterPoint of this curve is " + "(" + XXX + "," + YYY + "," + ZZZ + ")");
        }

属性:

1.5.2.2.1.1 CircularDisk

说明:
方法:
属性:

1.5.2.2.1.2 CurveChain

说明:
方法:
属性:

1.5.2.2.1.3 DgnCurveVector

说明:
方法:
属性:

1.5.2.2.1.4 EllipticDisk

说明:
方法:
属性:

1.5.2.2.1.5 Polygon

说明:多边形几何相关的构造函数、方法和属性
构造函数:
Polygon()
功能说明:构造函数,创建一个新的Polygon对象
代码示例:

public void PolygonTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //使用构造函数创建一个新的Polygon对象
            Bentley.GeometryNET.Polygon curvePrimitives = new Bentley.GeometryNET.Polygon();

            //创建了点列表
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(0, 0, 0));
            dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
            dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
            dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
            dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
            dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
            dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
            // 为空的多边形对象添加点
            for (int i = 0; i < dPoint3Ds.Count; i++)
            {
                curvePrimitives.AddPoint(dPoint3Ds[i]);
            }
            // 转为element后 存储到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();
        }

Polygon(IEnumerable)
功能说明:构造函数,创建一个新的Polygon对象
代码示例:

public void PolygonTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();


            //创建了点列表
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(0, 0, 0));
            dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
            dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
            dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
            dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
            dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
            dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));

            //使用构造函数创建一个新的Polygon对象
            Bentley.GeometryNET.Polygon curvePrimitives = new Bentley.GeometryNET.Polygon(dPoint3Ds);

            // 转为element后 存储到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();
        }

方法:
AddPoint()
功能说明:为polygon添加点
代码示例:

 public void AddPointTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //使用构造函数创建一个新的CurveChain对象
            Bentley.GeometryNET.Polygon curvePrimitives = new Bentley.GeometryNET.Polygon();

            //创建了点列表
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(0, 0, 0));
            dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
            dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
            dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
            dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
            dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
            dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));
            // 为空的多边形对象添加点
            for (int i = 0; i < dPoint3Ds.Count; i++)
            {
                curvePrimitives.AddPoint(dPoint3Ds[i]);
            }

            // 转为element  添加到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();
        }

DispatchToDDHandler()
功能说明:
代码示例:
EdgeCount()
功能说明:获取多边形边的个数
代码示例:

 public void EdgeCountTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();


            //创建了点列表
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(0, 0, 0));
            dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
            dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
            dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
            dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
            dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
            dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));

            //使用构造函数创建一个新的Polygon对象
            Bentley.GeometryNET.Polygon curvePrimitives = new Bentley.GeometryNET.Polygon(dPoint3Ds);

            // 转为element后 存储到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获取多边形边的个数,打印在消息框中
             int res = curvePrimitives.EdgeCount();
            System.Windows.Forms.MessageBox.Show("the edge count of this polygon is " + res.ToString());
        }

Edges()
功能说明:获取多边形的边
代码示例:

 public void EdgesTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();


            //创建了点列表
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(0, 0, 0));
            dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
            dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
            dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
            dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
            dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
            dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));

            //使用构造函数创建一个新的Polygon对象
            Bentley.GeometryNET.Polygon curvePrimitives = new Bentley.GeometryNET.Polygon(dPoint3Ds);

            // 转为element后 存储到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获取多边形边的边
            IEnumerable<DSegment3d> dSegment3Ds =  curvePrimitives.Edges();
            // 将每条边都转化为线段,存储在model中
            foreach (var item in dSegment3Ds)
            {
                LineElement elemento = new LineElement(dgnModel, null, item);
                elemento.AddToModel();
            }
        }

GetPointCount()
功能说明:获取多边形点的个数
代码示例:

 public void GetPointCountTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();


            //创建了点列表
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(0, 0, 0));
            dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
            dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
            dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
            dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
            dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
            dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));

            //使用构造函数创建一个新的Polygon对象
            Bentley.GeometryNET.Polygon curvePrimitives = new Bentley.GeometryNET.Polygon(dPoint3Ds);

            // 转为element后 存储到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获取多边形边的个数,打印在消息框中
            int res = curvePrimitives.GetPointCount();
            System.Windows.Forms.MessageBox.Show("the points count of this polygon is " + res.ToString());
        }

PointCountNoClosure()
功能说明:获取未闭合的点的个数
代码示例:

   public void PointCountNoClosureTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();


            //创建了点列表
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(0, 0, 0));
            dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
            dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
            dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
            dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
            dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
            dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));

            //使用构造函数创建一个新的Polygon对象
            Bentley.GeometryNET.Polygon curvePrimitives = new Bentley.GeometryNET.Polygon(dPoint3Ds);

            // 转为element后 存储到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获取多边形边未闭合点的个数,打印在消息框中
            int res = curvePrimitives.PointCountNoClosure();
            System.Windows.Forms.MessageBox.Show("the PointCountNoClosure of this polygon is " + res.ToString());
        }

PointCountWithClosure()
功能说明:获取多边形闭合点的个数
代码示例:

public void PointCountWithClosureTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();


            //创建了点列表
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(0, 0, 0));
            dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
            dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
            dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
            dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
            dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
            dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));

            //使用构造函数创建一个新的Polygon对象
            Bentley.GeometryNET.Polygon curvePrimitives = new Bentley.GeometryNET.Polygon(dPoint3Ds);

            // 转为element后 存储到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获取多边形边闭合点的个数,打印在消息框中
            int res = curvePrimitives.PointCountWithClosure();
            System.Windows.Forms.MessageBox.Show("the PointCountWithClosure of this polygon is " + res.ToString());
        }

Points()
功能说明:获取多边形的点
代码示例:

        public void PointsTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();


            //创建了点列表
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(0, 0, 0));
            dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
            dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
            dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
            dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
            dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
            dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));

            //使用构造函数创建一个新的Polygon对象
            Bentley.GeometryNET.Polygon curvePrimitives = new Bentley.GeometryNET.Polygon(dPoint3Ds);

            // 转为element后 存储到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获取多边形边点,每个点和(0,0,1),做成线段 添加到model中
            IEnumerable < DPoint3d > pointssss = curvePrimitives.Points();
            foreach (var item in pointssss)
            {
                DSegment3d dSegment3D = new DSegment3d(item, new DPoint3d(0, 0, UorPerMas));

                LineElement lineElement = new LineElement(dgnModel,null,dSegment3D);
                lineElement.AddToModel();
            }
        }

PointsNoClosure()
功能说明:获取曲线没有闭合的点
代码示例:

public void PointsNoClosureTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();


            //创建了点列表
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(0, 0, 0));
            dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
            dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
            dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
            dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
            dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
            dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));

            //使用构造函数创建一个新的Polygon对象
            Bentley.GeometryNET.Polygon curvePrimitives = new Bentley.GeometryNET.Polygon(dPoint3Ds);

            // 转为element后 存储到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获取多边形没有闭合的点,
            //如果获取到的为空,则打印为空
            //若不为空,每个点和(0,0,1),做成线段 添加到model中

            IEnumerable<DPoint3d> pointssss = curvePrimitives.PointsNoClosure();
            if (pointssss == null)
            {
                System.Windows.Forms.MessageBox.Show("this polygon has no  PointsNoClosure" );
            }
            else
            {
                foreach (var item in pointssss)
                {
                    DSegment3d dSegment3D = new DSegment3d(item, new DPoint3d(0, 0, UorPerMas));

                    LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
                    lineElement.AddToModel();
                }
            }

        }

PointsWithClosure()
功能说明:获取曲线闭合的点
代码示例:

 public void PointsWithClosureTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();


            //创建了点列表
            List<DPoint3d> dPoint3Ds = new List<DPoint3d>();
            dPoint3Ds.Add(new DPoint3d(0, 0, 0));
            dPoint3Ds.Add(new DPoint3d(10000, 10000, 0));
            dPoint3Ds.Add(new DPoint3d(20000, 60000, 0));
            dPoint3Ds.Add(new DPoint3d(30000, -60000, 0));
            dPoint3Ds.Add(new DPoint3d(40000, -10000, 0));
            dPoint3Ds.Add(new DPoint3d(70000, 20000, 0));
            dPoint3Ds.Add(new DPoint3d(90000, -40000, 0));

            //使用构造函数创建一个新的Polygon对象
            Bentley.GeometryNET.Polygon curvePrimitives = new Bentley.GeometryNET.Polygon(dPoint3Ds);

            // 转为element后 存储到model中
            Element element = DraftingElementSchema.ToElement(dgnModel, curvePrimitives, null);
            element.AddToModel();

            // 获取多边形闭合的点,
            //如果获取到的为空,则打印为空
            //若不为空,每个点和(0,0,1),做成线段 添加到model中

            IEnumerable<DPoint3d> pointssss = curvePrimitives.PointsWithClosure();
            if (pointssss == null)
            {
                System.Windows.Forms.MessageBox.Show("this polygon has no  PointsWithClosure");
            }
            else
            {
                foreach (var item in pointssss)
                {
                    DSegment3d dSegment3D = new DSegment3d(item, new DPoint3d(0, 0, UorPerMas));

                    LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
                    lineElement.AddToModel();
                }
            }

        }

ValidateConstruction()
功能说明:
代码示例:
属性:
IGeometry AsIGeometry { get; }
功能说明:
代码示例:

1.5.2.2.1.6 SurfacePatch

说明:
方法:
属性:

1.5.2.2.2 SingleLoopRegion

说明:
方法:
属性:

1.5.2.3 CurvePrimitiveCollection

说明:
方法:
属性:

1.5.2.3.1 ParityRegion

说明:
方法:
属性:

1.5.3 MSBsplineSurface

说明:B样条曲面相关的方法和属性
方法:
AddKnot()
功能说明:添加新的分界点
代码示例:

public void AddKnotTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //使用B样条曲面的addKnot方法,将结果转为element,添加到model中
            surface.AddKnot(0.25, 2, 2);
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();

        }

AddTrimBoundary()
功能说明:使用添加边界剪切
代码示例:

 public void AddTrimBoundaryTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            // 新建用于剪切的UV点列表
            List<DPoint2d> dPoint2Ds = new List<DPoint2d>();
            dPoint2Ds.Add(new DPoint2d(390750.34488501, 434084.915465823));
            dPoint2Ds.Add(new DPoint2d(390295.975741524, 434498.21271185));
            dPoint2Ds.Add(new DPoint2d(390315.975989623, 434064.530627409));

            //使用添加边界剪切,转为element后添加到model中
            surface.AddTrimBoundary(dPoint2Ds);
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();
        }

CleanKnots()
功能说明:清理所有非必要的分段点
代码示例:

 public void CleanKnotsTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //清理所有不必要的分段点,然后转为element 添加到model中
            surface.CleanKnots();
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();
        }

ClosestPoint()
功能说明:返回曲面上离空间点距离最近的点
代码示例:

 public void ClosestPointTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //返回曲面上离空间点距离最近的点
            surface.ClosestPoint(out DPoint3d xyz, out DPoint2d uv, new DPoint3d(390000, 430000, 37000));

            //将曲面上离空间点最近点和空间点连起来做成线段,添加到model中
            DSegment3d dSegment3D = new DSegment3d(xyz, new DPoint3d(390000, 430000, 37000));
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }

CreateFromNative()
功能说明:从指针创建B样条曲面
代码示例:
CreateFromPoles(IList pointVector, IList weightVector, IList
knotVectorU, int orderU, int poleCountU, bool closedU, IList knotVectorV, int orderV, int poleCountV, bool closedV, bool weightsAlreadyApplied)
功能说明:从关键点创建曲面
代码示例:

 public void CreateFromPolesTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();
        }

CreateFromPoles(IList pointVector, IList knotVectorU, int orderU, int poleCountU, bool closedU, IList knotVectorV, int orderV, int poleCountV, bool closedV)
功能说明:从关键点创建曲面
代码示例:
DereferenceToNative()
功能说明:获取曲面的指针
代码示例:

public void DereferenceToNativeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            // 获取曲面对象的指针, 将指针值打印在消息框中
            IntPtr intPtr = MSBsplineSurface.DereferenceToNative(surface, true);
            System.Windows.Forms.MessageBox.Show("IntPtr of this MSBsplineSurface is " + intPtr.ToString());
        }

Dispose()
功能说明:释放内存
代码示例:

public void DisposeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //释放surface 占有的内存
            surface.Dispose();

            if (surface == null)
            {
                System.Windows.Forms.MessageBox.Show("the surface has been disposed");
            }
        }

ElevateDegree()
功能说明:在给定方向上增加曲面的度
代码示例:

public void ElevateDegreeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //在给定方向上增加曲面的度,将新的B样条曲面转为element,添加到model中
            surface.ElevateDegree(3, 2);
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();
        }

FractionToKnot()
功能说明:返回指定方向上fraction值对应的knot值
代码示例:

public void FractionToKnotTest1()
        {

                double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

                DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
                ModelInfo modelInfo = dgnModel.GetModelInfo();



                //新建点列表
                DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
                //新建曲面的weight列表
                List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
                //新建曲面U方向的分段点列表
                List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
                //新建曲面V方向的分段点列表
                List<double> vknots = new List<double>() { 0, 0, 1, 1, };

                //使用静态方法创建曲面
                MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
                points,
                weights,
                uknots,
                uknots.Count - 9,
                9,
                false,
                vknots,
                vknots.Count - 2,
                2,
                false,
                false);

                //将B样条曲面转为element,添加到model中
                BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
                element.AddToModel();
                // 返回指定方向上fraction值对应的knot值,打印在消息框中
                double knot = surface.FractionToKnot(0.1, 2);
                System.Windows.Forms.MessageBox.Show(" the knot value corresponding to 0.1 fraction and 2 direction is " + knot.ToString());
        }

FractionToPoint(out DPoint3d xyz, double u, double v);
功能说明:返回曲面上的某点
代码示例:

 public class FractionToPoint1
    {

        [EditorInfo("paddy wang", "2022.6.29")]
        public void FractionToPointTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();
            // 返回曲面上的某点,将该点和原点连线,做成线段,添加到model中
            surface.FractionToPoint(out DPoint3d dPoint3D, 0.1,0.1);
            DSegment3d dSegment3D = new DSegment3d(dPoint3D, DPoint3d.Zero);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }

FractionToPoint(out DPoint3d xyz, out DVector3d dPdU, out DVector3d dPdV, double u, double v);
功能说明:返回曲面上的某点和U V对应方向上的向量
代码示例:

 public void FractionToPointTest2()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();
            // 返回曲面上的某点和U V对应方向上的向量,将该点和原点连线,做成线段,添加到model中
            surface.FractionToPoint(out DPoint3d dPoint3D, out DVector3d dPdU, out DVector3d dPdV, 0.1, 0.1);
            DSegment3d dSegment3D = new DSegment3d(dPoint3D, DPoint3d.Zero);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }

FractionToPoint(out DPoint3d xyz, out DVector3d dPdU, out DVector3d dPdV, out DVector3d dPdUU, out DVector3d dPdVV, out DVector3d dPdUv, out DVector3d norm, double u, double v);
功能说明:返回曲面上的某点和U V对应方向上的向量,U V对应方向上的二阶向量和曲面上该点处的法向量
代码示例:

public void FractionToPointTest3()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();
            // 返回曲面上的某点和U V对应方向上的向量,U V对应方向上的二阶向量和曲面上该点处的法向量,将该点和原点连线,做成线段,添加到model中
            surface.FractionToPoint(out DPoint3d dPoint3D, out DVector3d dPdU, out DVector3d dPdV, out DVector3d dPdUU, out DVector3d dPdVV, out DVector3d dPdUv, out DVector3d norm, 0.1, 0.1);
            DSegment3d dSegment3D = new DSegment3d(dPoint3D, DPoint3d.Zero);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }

GetKnotRange()
功能说明:返回指定方向上从fraction 0 到fraction 1之间最大和最小的knot值
代码示例:

public void GetKnotRangeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            surface.GetKnotRange(out double min, out double max, 2);
            System.Windows.Forms.MessageBox.Show(" the min and max knot of the direction 2 is " + min.ToString()+ "  " + max.ToString());
        }

GetParameterRegion()
功能说明:返回b样条曲面的参数区域
代码示例:

 public void GetParameterRegionTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //返回b样条曲面的参数区域,将获取到的参数化区域打印在消息框中
            surface.GetParameterRegion(out double uMin, out double uMax, out double vMin, out double vMax);
            System.Windows.Forms.MessageBox.Show(" the GetParameterRegion of this MSBsplineSurface is uMin " + uMin.ToString() + " uMax " + uMax.ToString()+ " vMin " + vMin.ToString()+ " vMax " + vMax.ToString());
        }

GetPoleRange()
功能说明:返回曲面极点的范围
代码示例:

public void GetPoleRangeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            // 获取曲面极点的范围,将范围的低点、高点连起来,做成线段,添加到model中
            DRange3d dRange3D = surface.GetPoleRange();
            DSegment3d dSegment3D = new DSegment3d(dRange3D.High, dRange3D.Low);
            LineElement lineElement = new LineElement(dgnModel, null, dSegment3D);
            lineElement.AddToModel();
        }

IsDegenerateEdge()
功能说明:检查曲面的边缘是否为单点
代码示例:

 public void IsDegenerateEdgeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //判断曲面的第2个边界是否为单点,结果打印在消息框中
            bool res = surface.IsDegenerateEdge(1, UorPerMas * 0.01);
            System.Windows.Forms.MessageBox.Show("this edge of surface Is DegenerateEdge? " + res.ToString());
        }

IsPhysicallyClosed()
功能说明:检查b样条曲面在任意一个参数方向上是否物理封闭。b样条曲面可能是非周期的,但如果它的第一行和最后一行 / 列极点重合,它仍然在v / u方向闭合。
代码示例:

 public void IsPhysicallyClosedTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //检查b样条曲面在任意一个参数方向上是否物理封闭,将结果打印在消息框中
            surface.IsPhysicallyClosed(out bool closedU, out bool closedV);
            System.Windows.Forms.MessageBox.Show("the surface IsPhysicallyClosed on the U direction? " + closedU.ToString() +
                                                    "\n\r the surface IsPhysicallyClosed on the V direction? " + closedV.ToString());
        }

KnotToFraction()
功能说明:返回曲面上与knot相对应的fraction值
代码示例:

public void KnotToFractionTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            // 返回曲面上与knot相对应的fraction值,将结果打印在消息框中
            double fraction = surface.KnotToFraction(0.466458403726642, 1);
            System.Windows.Forms.MessageBox.Show("the fraction is " + fraction.ToString());
        }

MakeBezier()
功能说明:生成等效的贝塞尔曲面
代码示例:

  public void MakeBezierTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();


            //生成等效的贝塞尔曲面,如果成功,将新的曲面转为element,添加到model中
            bool res = surface.MakeBezier(surface);
            if (res)
            {
                BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
                element1.AddToModel();
            }
        }

MakeClosed()
功能说明:设置曲面闭合
代码示例:

public void MakeClosedTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //设置曲面闭合
            bool res  = surface.MakeClosed(1);
            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();
        }

MakeOpen()
功能说明:设置曲面不闭合
代码示例:
MakeRational()
功能说明:生成一个等价的有理b样条曲面
代码示例:

public void MakeRationalTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();



            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //生成一个等价的有理b样条曲面
            bool res = surface.MakeRational();
            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();
        }

MakeReversed()
功能说明:反向给定曲面的方向
代码示例:

public void MakeReversedTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //反向给定曲面的方向
            surface.MakeReversed(1);
            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();
        }

NormalizeKnotRange()
功能说明:缩放和转换曲面及其边界循环的参数范围,使所有参数都在0到1之间
代码示例:

 public void NormalizeKnotRangeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //缩放和转换曲面及其边界循环的参数范围,使所有参数都在0到1之间。
            surface.NormalizeKnotRange();
            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();

        }

RemoveKnotsBounded()
功能说明:在容许误差范围内,移除所有可移除的knot
代码示例:

 public void RemoveKnotsBoundedTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //在容许误差范围内,移除所有可移除的knot
            surface.RemoveKnotsBounded(1,0.001*UorPerMas);
            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();
        }

Resolution()
功能说明:得到b样条曲面的分辨率
代码示例:

public void ResolutionTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //得到b样条曲面的分辨率,打印在消息框中
             double res =  surface.Resolution();
            System.Windows.Forms.MessageBox.Show("the resolution of this surface is " + res.ToString());

        }

SetOuterBoundaryActive()
功能说明:将曲面的外部剪切边界设置为激活
代码示例:

 public void SetOuterBoundaryActiveTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //设为true
            surface.SetOuterBoundaryActive(true);
            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();

            //设为false
            surface.SetOuterBoundaryActive(false);
            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element2 = new BSplineSurfaceElement(dgnModel, null, surface);
            element2.AddToModel();
        }

SwapUV()
功能说明:交换曲面的U/V方向。
代码示例:

 public void SetOuterBoundaryActiveTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //交换曲面的U / V方向。
            surface.SwapUV();
            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();
        }

Transform()
功能说明:曲面变换
代码示例:

 public void TransformTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //曲面变换
            DTransform3d dTransform3D = new DTransform3d(390750.34488501, 434084.915465823, 37030, 390956.642005217, 434312.083327423, 37029.9999999999, 390749.674146261, 434084.179271577, 37130);
            surface.Transform(ref dTransform3D);
            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element1 = new BSplineSurfaceElement(dgnModel, null, surface);
            element1.AddToModel();
        }

属性:
IsPlane { get; }
功能说明:判断曲面是否在某个平面内
代码示例:

 public void IsPlaneTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 判断曲面是否在某个平面内
            bool res = surface.IsPlane;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the surface  is entirely within a plane  " + res.ToString());
        }

IsRational { get; }
功能说明:查询曲面是否有权重
代码示例:

 public void IsRationalTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面是否有权重
            bool res = surface.IsRational;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the surface  is rational or not   " + res.ToString());
        }

PoleCount { get; }
功能说明:查询曲面控制点的数量
代码示例:

public void PoleCountTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面控制点的数量
            int res = surface.PoleCount;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the pole count of this surface  is   " + res.ToString());
        }

VKnotRange { get; }
功能说明:查询曲面V方向knot的范围
代码示例:

public void VKnotRangeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面V方向knot的范围
            DRange1d res = surface.VKnotRange;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the VKnotRange of this surface  is  :High  " + res.High.ToString() + "Low " + res.Low.ToString());

        }

VKnotCount { get; }
功能说明:查询曲面上V方向的knot数量
代码示例:

 public void VKnotCountTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面上V方向的knot数量
            int res = surface.VKnotCount;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the VKnotCount of this surface  is    " + res.ToString());
        }

VOrder { get; }
功能说明:查询曲面V方向的阶数
代码示例:

 public void VOrderTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面V方向的阶数
            int res = surface.VOrder;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the VOrder of this surface  is   " + res.ToString());
        }

VPoleCount { get; }
功能说明:查询曲面V方向的控制点个数
代码示例:

 public void VPoleCountTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面V方向的控制点个数
            int res = surface.VPoleCount;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the VPoleCount os this surface  is    " + res.ToString());
        }

IsVClosed { get; }
功能说明:查询曲面V方向是否闭合
代码示例:

public void IsVClosedTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面V方向是否闭合
            bool res = surface.IsVClosed;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the surface  is VClosed or not   " + res.ToString());
        }

UKnotRange { get; }
功能说明:查询曲面U方向knot的范围
代码示例:

public void UKnotRangeTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面U方向knot的范围
            DRange1d res = surface.UKnotRange;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the UKnotRange of this surface  is  :High  " + res.High.ToString() + "Low " + res.Low.ToString());
        }

UKnotCount { get; }
功能说明:查询曲面上U方向的knot数量
代码示例:

 public void UKnotCountTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面上U方向的knot数量
            int res = surface.UKnotCount;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the UKnotCount of this surface  is    " + res.ToString());
        }

UOrder { get; }
功能说明:查询曲面上U方向的阶数
代码示例:

  public void UOrderTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面上U方向的阶数
            int res = surface.UOrder;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the UOrder of this surface  is    " + res.ToString());
        }

UPoleCount { get; }
功能说明:查询曲面上U方向控制点个数
代码示例:

 public void UPoleCountTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面上U方向控制点个数
            int res = surface.UPoleCount;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the UPoleCount of this surface  is    " + res.ToString());
        }

IsUClosed { get; }
功能说明:查询曲面U方向是否闭合
代码示例:

public void IsUClosedTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 查询曲面U方向是否闭合
            bool res = surface.IsUClosed;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the surface  is UClosed or not   " + res.ToString());
        }

HoleOrigin { get; }
功能说明:查询B样条曲面参数边界是否参与剪切操作。返回值为true,表示曲面边界不是剪切边界;返回false,表示边界是剪切边界
代码示例:

public void HoleOriginTest1()
        {
            double UorPerMas = Session.Instance.GetActiveDgnModel().GetModelInfo().UorPerMaster;

            DgnModel dgnModel = Session.Instance.GetActiveDgnModel();//获取当前激活的model
            ModelInfo modelInfo = dgnModel.GetModelInfo();

            //新建点列表
            DPoint3d[] points = { new DPoint3d(390750.34488501, 434084.915465823, 37030), new DPoint3d(390956.642005217, 434312.083327423, 37029.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37029.9999999999), new DPoint3d(390502.640932221, 434725.045774041, 37029.9999999997), new DPoint3d(390295.975741524, 434498.21271185, 37029.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37029.9999999997), new DPoint3d(390315.975989623, 434064.530627409, 37029.9999999999), new DPoint3d(390542.641428419, 433857.68160516, 37030), new DPoint3d(390749.674146261, 434084.179271577, 37030), new DPoint3d(390750.34488501, 434084.915465823, 37130), new DPoint3d(390956.642005217, 434312.083327423, 37129.9999999999), new DPoint3d(390729.641468719, 434518.564550733, 37129.9999999999), new DPoint3d(390502.640932221, 434725.045774042, 37129.9999999996), new DPoint3d(390295.975741524, 434498.21271185, 37129.9999999997), new DPoint3d(390089.310550827, 434271.379649656, 37129.9999999996), new DPoint3d(390315.975989623, 434064.530627409, 37129.9999999999), new DPoint3d(390542.641428418, 433857.68160516, 37130), new DPoint3d(390749.674146261, 434084.179271577, 37130), };
            //新建曲面的weight列表
            List<double> weights = new List<double>() { 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, 1, 0.707393358053418, 1, 0.707393358053102, 1, 0.707393358053522, 1, 0.707393358053603, 1, };
            //新建曲面U方向的分段点列表
            List<double> uknots = new List<double>() { 0, 0, 0, 0.466458403726642, 0.466458403726642, 0.932916807453306, 0.932916807453306, 1.39937521117992, 1.39937521117992, 1.86583361490651, 1.86583361490651, 1.86583361490651, };
            //新建曲面V方向的分段点列表
            List<double> vknots = new List<double>() { 0, 0, 1, 1, };

            //使用静态方法创建曲面
            MSBsplineSurface surface = MSBsplineSurface.CreateFromPoles(
            points,
            weights,
            uknots,
            uknots.Count - 9,
            9,
            false,
            vknots,
            vknots.Count - 2,
            2,
            false,
            false);

            // 获取曲面边界是否参与剪切的属性
            bool res = surface.HoleOrigin;


            //将B样条曲面转为element,添加到model中
            BSplineSurfaceElement element = new BSplineSurfaceElement(dgnModel, null, surface);
            element.AddToModel();

            //将结果打印在窗口中
            System.Windows.Forms.MessageBox.Show("the surface  parametric boundary in trim operations is  " + res.ToString());
        }

1.6 PolyfaceHeader

说明:
方法:
属性:

1.6.1 IndexedMesh

说明:
方法:
属性:

1.7 SingleLineText

说明:
方法:
属性: