public static List <Line> CreateLines(List <Point3D> listOfPoints, bool closed = false) { var lines = new List <Line>(); for (var i = 0; i < listOfPoints.Count; i++) { var startPoint = listOfPoints[i]; if (i + 1 == listOfPoints.Count) { if (closed) { var end = listOfPoints[0]; lines.Add(new Line(startPoint, end)); } break; } var endPoint = listOfPoints[i + 1]; var line = new Line(startPoint, endPoint); lines.Add(line); } return(lines); }
public static void CloningDxf(List <Entity> entityList) { InitializeCoreComponents(); // open new file here ActiveDocument = IcadApplication.Documents.Add(); foreach (Entity entity in entityList) { if (entity is Line) { Line line = (Line)entity; var start = line.StartPoint; var end = line.EndPoint; var icadLine = ActiveDocument.ModelSpace.AddLine(new Point() { x = start.X, y = start.Y }, new Point() { x = end.X, y = end.Y }); icadLine.Update(); } else if (entity is Circle) { Circle circle = (Circle)entity; var cPoint = circle.Center; double rad = circle.Radius; var iCircle = ActiveDocument.ModelSpace.AddCircle(new Point() { x = cPoint.X, y = cPoint.Y }, rad); iCircle.Update(); } } }