研究路线图元,再很大程度上,可以实现数字创建路线,目前,再civil 3d中存在的路线图元主要分为3类:固定图元、浮动图元、自由图元,今天再这里对固定图元接口进行简单的说明:
public AlignmentArc AddFixedCurve(Point3d centerPoint, double radius, bool isClockwise);
public AlignmentArc AddFixedCurve(int previousEntityId, Point3d startPoint, Point3d middlePoint, Point3d endPoint);
public AlignmentArc AddFixedCurve(Point3d passThroughPoint1, Vector3d directionAtPassThroughPoint1, Point3d passThroughPoint2);
public AlignmentArc AddFixedCurve(Point3d passThroughPoint1, Point3d passThroughPoint2, Vector3d directionAtPassThroughPoint2);
public AlignmentArc AddFixedCurve(Point3d passThroughPoint1, Point3d passThroughPoint2, double radius, bool isClockwise);
public AlignmentArc AddFixedCurve(int previousEntityId, Point3d passThroughPoint1, Point3d passThroughPoint2, double radius, bool isClockwise, bool isGreaterThan180);
public AlignmentArc AddFixedCurve(Point3d centerPoint, Point3d passThroughPoint, bool isClockwise);
public AlignmentArc AddFixedCurve(int previousEntityId, Point3d passThroughPoint);
public AlignmentArc AddFixedCurve(Point3d passThroughPoint1, Vector3d directionAtPassThroughPoint1, double radius, bool isClockwise);
public AlignmentLine AddFixedLine(int previousEntityId, Point3d startPoint, Point3d endPoint);
public AlignmentLine AddFixedLine(Point3d startPoint, Point3d endPoint);
public AlignmentLine AddFixedLine(int previousEntityId, double distance);
public AlignmentSpiral AddFixedSpiral(int previousEntityId, double startRadius, double endRadius, double length, SpiralType spiralDefinition);
public AlignmentSpiral AddFixedSpiral(int previousEntityId, Point3d startPoint, Point3d spiralPI, Point3d endPoint, SpiralType definitionType);
public AlignmentSpiral AddFixedSpiral(int previousEntityId, double radius, double length, SpiralCurveType spiralCurveType, SpiralType spiralDefinition);
public AlignmentSpiral AddFixedSpiral(int previousEntityId, Point3d startPoint, Point3d spiralPI, double radius, double length, SpiralCurveType spiralCurveType, bool isClockwise, SpiralType spiralDefinition);
public AlignmentSpiral AddFixedSpiral(int previousEntityId, Point3d startPoint, Point3d spiralPI, double startRadius, double endRadius, double length, bool isClockwise, SpiralType spiralDefinition);
上面为再.Net API 中civil 3d中提供所有的固定图元的接口,主要分为三类,Curve(圆弧)、Line(直线)、Spiral(缓和曲线)。
Curve(圆弧)这里主要介绍下面的几个重载接口:
public AlignmentArc AddFixedCurve(Point3d centerPoint, double radius, bool isClockwise);
public AlignmentArc AddFixedCurve(Point3d centerPoint, Point3d passThroughPoint, bool isClockwise);
这两个类似,结果都是圆,centerPoint 为圆心,radius为半径,isClockwise是否顺时针,passThroughPoint 为经过的点(centerPoint和passThroughPoint的距离就是半径);
public AlignmentArc AddFixedCurve(Point3d passThroughPoint1, Vector3d directionAtPassThroughPoint1, Point3d passThroughPoint2);
public AlignmentArc AddFixedCurve(Point3d passThroughPoint1, Point3d passThroughPoint2, Vector3d directionAtPassThroughPoint2);
这两个有相似的地方,passThroughPoint1和passThroughPoint2 为经过的点,directionAtPassThroughPoint1和directionAtPassThroughPoint2分别的两个点的方向;
public AlignmentArc AddFixedCurve(Point3d passThroughPoint1, Vector3d directionAtPassThroughPoint1, double radius, bool isClockwise);
passThroughPoint1为经过的点,directionAtPassThroughPoint1经过的点的切线方向,radius为半径,最后为圆;
public AlignmentArc AddFixedCurve(int previousEntityId, Point3d passThroughPoint1, Point3d passThroughPoint2, double radius, bool isClockwise, bool isGreaterThan180);
previousEntityId前一个图元,passThroughPoint1是开始的点,passThroughPoint2曲线的终点点,radius为半径,isClockwise是否顺时针,isGreaterThan180是否大于180度,
其他的,只要理解了passThrough的含义,previousEntityId的含义(注意,路线的previousEntityId都是默认从1开始,不是0开始),isClockwise和isGreaterThan180的含义即可;
下面介绍直线图元:
public AlignmentLine AddFixedLine(int previousEntityId, Point3d startPoint, Point3d endPoint);
public AlignmentLine AddFixedLine(Point3d startPoint, Point3d endPoint);
previousEntityId为指定上一图元ID,startPoint, endPoint分别为起点和终点;
public AlignmentLine AddFixedLine(int previousEntityId, double distance);
previousEntityId为指定上一图元ID,distance为沿当前方向的距离;
最后介绍五中固定缓和曲线的图元:
public AlignmentSpiral AddFixedSpiral(int previousEntityId, double startRadius, double endRadius, double length, SpiralType spiralDefinition);
previousEntityId为指定上一图元ID,startRadius和endRadius分别为缓和曲线的起点半径和终点半径,length缓和曲线的总长度;spiralDefinition缓和曲线的类型(注,类型选择可以参考本人另外一篇博客“https://blog.csdn.net/chenjiang0611/article/details/120350570”);
public AlignmentSpiral AddFixedSpiral(int previousEntityId, Point3d startPoint, Point3d spiralPI, Point3d endPoint, SpiralType definitionType);
previousEntityId为指定上一图元ID,startPoint决定缓和曲线的起点,startPoint和spiralPI决定缓和曲线开始的切线方向,endPoint为缓和曲线的终点, spiralDefinition缓和曲线的类型(注,类型选择可以参考本人另外一篇博客“https://blog.csdn.net/chenjiang0611/article/details/120350570”);
public AlignmentSpiral AddFixedSpiral(int previousEntityId, double radius, double length, SpiralCurveType spiralCurveType, SpiralType spiralDefinition);
previousEntityId为指定上一图元ID,radius为终点的半径, length为缓和曲线的长度,spiralCurveType有两种选择,进(前)、出(后)缓和曲线,spiralDefinition缓和曲线的类型。
public AlignmentSpiral AddFixedSpiral(int previousEntityId, Point3d startPoint, Point3d spiralPI, double radius, double length, SpiralCurveType spiralCurveType, bool isClockwise, SpiralType spiralDefinition);
previousEntityId为指定上一图元ID,startPoint为起点,startPoint和spiralPI起点切线方向,radius为终点半径(起点半径为无穷大), length为长度,spiralCurveType有两种选择,进(前)、出(后)缓和曲线,isClockwise是否为顺时针,spiralDefinition缓和曲线的类型。
public AlignmentSpiral AddFixedSpiral(int previousEntityId, Point3d startPoint, Point3d spiralPI, double startRadius, double endRadius, double length, bool isClockwise, SpiralType spiralDefinition);
与上一个的区别在于,多一个startRadius半径,指定起点的半径。
今天到此为止,后期将陆续更新浮动图元和自由图元,给自己增强记忆,给他人提供方便。