예제 #1
0
        public void TestHatch2()
        {
            var ids = Interaction.GetSelection("\nSelect entities");

            Draw.Hatch(ids);
        }
예제 #2
0
        public void TestWipe()
        {
            var id = Interaction.GetEntity("\nEntity");

            Draw.Wipeout(id);
        }
예제 #3
0
 public void TestZoom()
 {
     Interaction.ZoomExtents();
 }
예제 #4
0
        public static void PolyTrimExtend() // mod 20130228
        {
            double epsilon = Interaction.GetValue("\nEpsilon", _polyTrimExtendEpsilon);

            if (double.IsNaN(epsilon))
            {
                return;
            }
            _polyTrimExtendEpsilon = epsilon;

            var visibleLayers = DbHelper
                                .GetAllLayerIds()
                                .QOpenForRead <LayerTableRecord>()
                                .Where(layer => !layer.IsHidden && !layer.IsFrozen && !layer.IsOff)
                                .Select(layer => layer.Name)
                                .ToList();

            var ids = Interaction
                      .GetSelection("\nSelect polyline", "LWPOLYLINE")
                      .QWhere(pline => visibleLayers.Contains(pline.Layer) && pline.Visible)
                      .ToArray(); // newly 20130729

            var pm = new ProgressMeter();

            pm.Start("Processing...");
            pm.SetLimit(ids.Length);
            ids.QOpenForWrite <Polyline>(list =>
            {
                foreach (var poly in list)
                {
                    int[] indices = { 0, poly.NumberOfVertices - 1 };
                    foreach (int index in indices)
                    {
                        var end = poly.GetPoint3dAt(index);
                        foreach (var poly1 in list)
                        {
                            if (poly1 != poly)
                            {
                                var closest  = poly1.GetClosestPointTo(end, false);
                                double dist  = closest.DistanceTo(end);
                                double dist1 = poly1.StartPoint.DistanceTo(end);
                                double dist2 = poly1.EndPoint.DistanceTo(end);

                                double distance = poly1.GetDistToPoint(end);
                                if (poly1.GetDistToPoint(end) > 0)
                                {
                                    if (dist1 <= dist2 && dist1 <= dist && dist1 < epsilon)
                                    {
                                        poly.SetPointAt(index, new Point2d(poly1.StartPoint.X, poly1.StartPoint.Y));
                                    }
                                    else if (dist2 <= dist1 && dist2 <= dist && dist2 < epsilon)
                                    {
                                        poly.SetPointAt(index, new Point2d(poly1.EndPoint.X, poly1.EndPoint.Y));
                                    }
                                    else if (dist <= dist1 && dist <= dist2 && dist < epsilon)
                                    {
                                        poly.SetPointAt(index, new Point2d(closest.X, closest.Y));
                                    }
                                }
                            }
                        }
                    }
                    pm.MeterProgress();
                }
            });
            pm.Stop();
        }
예제 #5
0
        public void TestHatch3()
        {
            var seed = Interaction.GetPoint("\nPick one point");

            Draw.Hatch("SOLID", seed);
        }
예제 #6
0
        public void TestBoundary()
        {
            var point = Interaction.GetPoint("\nPick one point");

            Draw.Boundary(point, BoundaryType.Polyline);
        }