Пример #1
0
        public void TestRegion()
        {
            ObjectId id = Interaction.GetEntity("\nEntity");

            Draw.Region(id);
            Point3d point = Interaction.GetPoint("\nPick one point");

            Draw.Boundary(point, BoundaryType.Region);
        }
Пример #2
0
        public void ViewSpline()
        {
            var id         = Interaction.GetEntity("\nSelect a spline", typeof(Spline));
            var spline     = id.QOpenForRead <Spline>();
            var knots      = spline.NurbsData.GetKnots();
            var knotPoints = knots.Cast <double>().Select(k => spline.GetPointAtParam(k)).ToList();

            knotPoints.ForEach(p => Draw.Circle(p, 5));
        }
Пример #3
0
        public static void InspectObject()
        {
            var id = Interaction.GetEntity("\nSelect objects");

            if (id.IsNull)
            {
                return;
            }
            Gui.PropertyPalette(id.QOpenForRead());
        }
Пример #4
0
        public static void GetBounds()
        {
            //var p = Interaction.GetPoint("StartPoint");
            var entityId = Interaction.GetEntity("StartLine");

            if (entityId == null)
            {
                return;
            }
            var sp = entityId.ToCADShape(true);
        }
Пример #5
0
        public static void GetOneFloorWithRoot()
        {
            string txt = Interaction.GetString("输入厂区名称(默认:厂区A)");

            if (string.IsNullOrEmpty(txt))
            {
                txt = "厂区A";
            }
            var entityId = Interaction.GetEntity("选择一个机房(用来获取楼层的Layer)");
            var entity   = entityId.QOpenForRead <Entity>();

            GetCADOtherCommands.GetOneFloorWithRoot(entity.Layer, txt);
            return;
        }
Пример #6
0
        public static void GetBuildInfo()
        {
            //string txt = Interaction.GetString("输入当前图层名称");
            //if (string.IsNullOrEmpty(txt))
            //{
            //    txt = "厂区";
            //}
            var entityId = Interaction.GetEntity("选择一个大楼");
            var entity   = entityId.QOpenForRead <Entity>();

            GetCADOtherCommands.GetParkBuild(entity.Layer);

            return;
        }
Пример #7
0
        public static void GetExtentPoints()
        {
            var      objId = Interaction.GetEntity("Entity");
            CADShape shape = objId.ToCADShape(true);

            if (shape != null)
            {
                string xml = shape.ToXml();
                MyTool.TextReport("Points", xml, 700, 500);
            }
            else
            {
                MyTool.TextReport("Points", "NULL", 700, 500);
            }
        }
Пример #8
0
        public static void CopyCircle()
        {
            var entityId = Interaction.GetEntity("Circle");
            var entity   = entityId.QOpenForRead <Circle>();

            if (entity == null)
            {
                Interaction.Write("Not Circle");
                return;
            }
            var p      = entity.GetCenter();
            var radius = Interaction.GetString("Radius");
            var cid    = Draw.Circle(p, radius.ToInt());
            var zeroSp = cid.ToCADShape(true);

            Interaction.Write(zeroSp.GetPoint().ToString());
        }
Пример #9
0
        public static void ViewObjectDict()
        {
            ObjectId id = Interaction.GetEntity("\nSelect entity");

            if (id == ObjectId.Null)
            {
                return;
            }
            DictionaryViewer dv = new DictionaryViewer(  // Currying
                () => CustomObjectDictionary.GetDictionaryNames(id),
                x => CustomObjectDictionary.GetEntryNames(id, x),
                (x, y) => CustomObjectDictionary.GetValue(id, x, y),
                (x, y, z) => CustomObjectDictionary.SetValue(id, x, y, z)
                );

            Application.ShowModalWindow(dv);
        }
Пример #10
0
        public static void GetShapeInfo()
        {
            var id = Interaction.GetEntity("Select:");
            var sp = id.ToCADShape(true);

            //add by qclei 2020-04-29 判断是否是封闭的图形
            //bool bl = PulicGadget.ifColseShape(sp);
            //if (bl)
            {
                string name = PulicGadget.getShapeName(sp);
                if (name != "")
                {
                    sp.Name = name;
                }
                var xml = sp.ToXml();

                MyTool.TextReport("ShapeInfo", xml, 700, 500);
            }
        }
Пример #11
0
        /// <summary>
        /// 手动获取多个“多边型”图形
        /// </summary>
        public static void GetAllShapeByManual()
        {
            ShapesDefine shape = new ShapesDefine();

            int iCount = 1;

            while (true)
            {
                string sel = string.Format("Select {0} :", iCount.ToString());
                var    id  = Interaction.GetEntity(sel);

                if (id.Handle.Value != 0)
                {
                    var sp = id.ToCADShape(true);

                    //add by qclei 2020-04-29 判断是否是封闭的图形
                    //bool bl = PulicGadget.ifColseShape(sp);
                    //if (bl)
                    {
                        string name = PulicGadget.getShapeName(sp);
                        if (name != "")
                        {
                            sp.Name = name;
                        }
                        shape.addShape(sp);
                        iCount++;
                    }
                }
                else
                {
                    break;
                }
            }

            if (shape.shapelist.Count() > 0)
            {
                string xml = shape.toXml();
                MyTool.TextReport("ShapeInfos", xml, 700, 500);
            }
        }
Пример #12
0
        public static void PolylineInfo() // mod by WY 20130202
        {
            ObjectId id = Interaction.GetEntity("\nSpecify a polyline", typeof(Polyline));

            if (id == ObjectId.Null)
            {
                return;
            }
            Polyline poly = id.QOpenForRead <Polyline>();

            for (int i = 0; i <= poly.EndParam; i++)
            {
                Interaction.WriteLine("[Point {0}] coord: {1}; bulge: {2}", i, poly.GetPointAtParameter(i), poly.GetBulgeAt(i));
            }
            List <ObjectId> txtIds = new List <ObjectId>();
            double          height = poly.GeometricExtents.MaxPoint.DistanceTo(poly.GeometricExtents.MinPoint) / 50.0;

            for (int i = 0; i < poly.NumberOfVertices; i++)
            {
                txtIds.Add(Draw.MText(i.ToString(), height, poly.GetPointAtParameter(i), 0, true));
            }
            Interaction.GetString("\nPress ENTER to exit");
            txtIds.QForEach(x => x.Erase());
        }
Пример #13
0
        public void TestWipe()
        {
            ObjectId id = Interaction.GetEntity("\nEntity");

            Draw.Wipeout(id);
        }