/// <summary> /// Creates polyline interactively. /// </summary> /// <param name="message">The message.</param> /// <returns>The polyline result.</returns> public static Polyline GetPromptPolyline(string message) // newly 20130806 { var point = Interaction.GetPoint(message); if (point.IsNull()) { return(null); } var poly = NoDraw.Pline(new[] { point }); var prev = point; var tempIds = new List <ObjectId>(); while (true) { point = Interaction.GetLineEndPoint(message, prev); if (point.IsNull()) { break; } tempIds.Add(Draw.Line(prev, point)); poly.AddVertexAt(poly.NumberOfVertices, point.ToPoint2d(), 0, 0, 0); prev = point; } tempIds.QForEach(line => line.Erase()); return(poly); }
public void TestPolygon() { int n; while (true) { double d = Interaction.GetValue("\nNumber of edges"); if (double.IsNaN(d)) { return; } n = (int)d; if (n > 2) { break; } } var center = Interaction.GetPoint("\nCenter"); Draw.Circle(center, 5); var end = Interaction.GetPoint("\nOne vertex"); Draw.Circle(end, 5); Draw.Polygon(n, center, end); }
public void TestDimension() { var a = Interaction.GetPoint("\nPoint 1"); var b = Interaction.GetPoint("\nPoint 2"); var c = Interaction.GetPoint("\nPoint of label"); Draw.Dimlin(a, b, c); }
public void TestSelection() { var point = Interaction.GetPoint("\nPoint"); double value = Interaction.GetDistance("\nSize"); var size = new Vector3d(value, value, 0); var ids = Interaction.GetWindowSelection(point - size, point + size); Interaction.WriteLine("{0} entities selected.", ids.Count()); }
public void TestRegion() { var id = Interaction.GetEntity("\nEntity"); Draw.Region(id); var point = Interaction.GetPoint("\nPick one point"); Draw.Boundary(point, BoundaryType.Region); }
public void TestEllipse() { var center = Interaction.GetPoint("\nCenter"); Draw.Circle(center, 5); var endX = Interaction.GetPoint("\nEnd of one axis"); Draw.Circle(endX, 5); double radiusY = Interaction.GetValue("\nRadius of another axis"); Draw.Ellipse(center, endX, radiusY); }
public void TestArc2() { var start = Interaction.GetPoint("\nStart"); Draw.Circle(start, 5); var center = Interaction.GetPoint("\nCenter"); Draw.Circle(center, 5); double angle = Interaction.GetValue("\nAngle"); Draw.ArcSCA(start, center, angle); }
public void TestArc() { var point1 = Interaction.GetPoint("\nStart"); Draw.Circle(point1, 5); var point2 = Interaction.GetPoint("\nMid"); Draw.Circle(point2, 5); var point3 = Interaction.GetPoint("\nEnd"); Draw.Circle(point3, 5); Draw.Arc3P(point1, point2, point3); }
public void TestGraph() { var option = new GraphOption { xDelta = 20, yDelta = 0.5, yRatio = 0.5, SampleCount = 500 }; var graphPlotter = new GraphPlotter(option); graphPlotter.Plot(Math.Tanh, new Interv(5, 102)); graphPlotter.Plot(x => Math.Cos(x) + 1, new Interv(10, 90), 3); var graph = graphPlotter.GetGraphBlock(); var blockReference = new BlockReference(Point3d.Origin, graph); var first = Interaction.GetPoint("\nSpecify extent point 1"); Interaction.InsertScalingEntity(blockReference, first, "\nSpecify extent point 2"); }
public void TestSpline() { var points = new List <Point3d>(); while (true) { var point = Interaction.GetPoint("\nSpecify a point"); if (point.IsNull()) { break; } points.Add(point); Draw.Circle(point, 5); } Draw.SplineCV(points.ToArray(), true); }
public static void PolyLanding() { var ids = QuickSelection.SelectAll("*LINE,ARC").ToArray(); var landingLineIds = new List <ObjectId>(); while (true) { var p = Interaction.GetPoint("\nSpecify a point"); if (p.IsNull()) { break; } var landings = ids.QSelect(entity => (entity as Curve).GetClosestPointTo(p, false)).ToArray(); double minDist = landings.Min(point => point.DistanceTo(p)); var landing = landings.First(point => point.DistanceTo(p) == minDist); Interaction.WriteLine("Shortest landing distance of point ({0:0.00},{1:0.00}) is {2:0.00}.", p.X, p.Y, minDist); landingLineIds.Add(Draw.Line(p, landing)); } landingLineIds.QForEach(entity => entity.Erase()); }
public void TestHatch3() { var seed = Interaction.GetPoint("\nPick one point"); Draw.Hatch("SOLID", seed); }
public void TestBoundary() { var point = Interaction.GetPoint("\nPick one point"); Draw.Boundary(point, BoundaryType.Polyline); }