本次学习如何通过C#代码在CAD中创建直线,直线虽然是最简单的图形,但是对于初学者而言,这是学习的一小步,却是人生的一大步。
(1)搭建配置环境
引用CAD2016中的库文件,启动外部调试等
(2)CAD2016中提供的Line简介
如下代码是CAD2016中line的封装代码(部分),两个构造方法和一些属性
public Line(Point3d pointer1, Point3d pointer2);
[UnitType(UnitType.Angle)]
public double Angle { get; }
public Vector3d Delta { get; }
public override Point3d EndPoint { get; set; }
[UnitType(UnitType.Distance)]
public double Length { get; }
public Vector3d Normal { get; set; }
public override Point3d StartPoint { get; set; }
[UnitType(UnitType.Distance)]
public double Thickness { get; set; }
(3)创建直线line1(100,100,0)
Line line1 = new Line();
Point3d startPoint = new Point3d(0,0,0);
Point3d end