예제 #1
0
        public static void SmartBreak()
        {
            string block = TjCode.SeperationBreak;

            Point3d insertPoint = Interaction.GetPoint("\n指定插入点");

            Draw.Block(block, Services.FolderPath + "BlockLib.dwg");
            ObjectId insert = Draw.Insert(block, insertPoint);

            string style = Services.GetSeperationBreakStyle();

            TongJiCode.AddCode(insert, block);
            CADBase.SetFirstXData(insert, "长度", Convert.ToDouble(style));
        }
예제 #2
0
        public static void SmartBusStop()
        {
            string block = TjCode.BusStop;

            Point3d insertPoint = Interaction.GetPoint("\n指定插入点");

            Draw.Block(block, Services.FolderPath + "BlockLib.dwg");
            ObjectId insert = Draw.Insert(block, insertPoint);

            string[] style = Services.GetBusStopStyle().Split('|');
            TongJiCode.AddCode(insert, block);
            CADBase.SetFirstXData(insert, "长度", Convert.ToDouble(style[0]));
            CADBase.SetFirstXData(insert, "进站缓长", Convert.ToDouble(style[1]));
            CADBase.SetFirstXData(insert, "出站缓长", Convert.ToDouble(style[2]));
            CADBase.SetFirstXData(insert, "宽度", Convert.ToDouble(style[3]));
        }
예제 #3
0
        public static void MakeRoad()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            PromptSelectionResult proSelRes = ed.SelectImplied();

            if (proSelRes.Status != PromptStatus.OK)
            {
                ed.WriteMessage("\n选择道路中心线");
                proSelRes = ed.GetSelection();
                if (proSelRes.Status != PromptStatus.OK)
                {
                    return;
                }
            }
            ObjectId[] ids = proSelRes.Value.GetObjectIds();
            ids = ids.Where(x => CADBase.GetFirstXData(x, AppName.Managed) != "true").ToArray();
            string section = Services.GetSection();

            using (Transaction trans = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
            {
                foreach (ObjectId id in ids)
                {
                    Entity ent = trans.GetObject(id, OpenMode.ForWrite) as Entity;
                    if (ent is Curve)
                    {
                        TongJiCode.AddCode(id, TjCode.Road);
                        CADBase.SetFirstXData(id, AppName.Section, section);
                        CADBase.SetEntityLayer(ent, LayerName.Alignment);
                    }
                }
                trans.Commit();
            }

            Services.UpdateDrawing();
        }
예제 #4
0
        /// <summary>
        /// 清理具有Generated标记的图元
        /// </summary>
        public static void EraseGenerated()
        {
            var readyToErase = QuickSelection.SelectAll("*LINE,ARC").Where(x => CADBase.GetFirstXData(x, AppName.Generated) == "true").ToList();

            readyToErase.ForEach(x => x.Erase());
        }