예제 #1
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();
        }
예제 #2
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());
        }