Exemplo n.º 1
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIDoc       = commandData.Application.ActiveUIDocument;
            Document    = UIDoc.Document;
            Application = commandData.Application.Application;

            if (!LineStyle.IsExistLineStyle(Document, "房间边界线"))
            {
                ////生成线样式
                using (Transaction ts = new Transaction(Document, "LineStyle"))
                {
                    ts.Start();
                    Category lineCategory = Document.Settings.Categories.get_Item(BuiltInCategory.OST_Lines);
                    Category newCategory  = Document.Settings.Categories.NewSubcategory(lineCategory, "房间边界线");
                    Color    newColor     = new Color(255, 0, 0);
                    newCategory.LineColor = newColor;
                    newCategory.SetLineWeight(1, GraphicsStyleType.Projection);
                    ts.Commit();
                }
            }
            Operation();

            return(Result.Succeeded);
        }