示例#1
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Document       doc    = commandData.Application.ActiveUIDocument.Document;
            UIDocument     uidoc  = commandData.Application.ActiveUIDocument;
            View           view   = doc.ActiveView;
            List <Element> rebars = RebarSelectHelper.GetSelectedOrAll(uidoc);

            using (Transaction t1 = new Transaction(doc, "Set Unobscured in View"))
            {
                t1.Start();
                foreach (Element rebar in rebars)
                {
                    if (rebar is RebarInSystem)
                    {
                        RebarInSystem r = (RebarInSystem)rebar;

                        if (!r.IsUnobscuredInView(view))
                        {
                            r.SetUnobscuredInView(view, true);
                        }
                    }
                    if (rebar is Rebar)
                    {
                        Rebar r = (Rebar)rebar;

                        if (!r.IsUnobscuredInView(view))
                        {
                            r.SetUnobscuredInView(view, true);
                        }
                    }
                }
                t1.Commit();
            }
            return(Result.Succeeded);
        }
示例#2
0
 public void SetUnobscuredInView(View v, bool IsUnobsqured)
 {
     if (RevitBar is Rebar)
     {
         Rebar bar = RevitBar as Rebar;
         bar.SetUnobscuredInView(v, IsUnobsqured);
     }
     if (RevitBar is RebarInSystem)
     {
         RebarInSystem bar = RevitBar as RebarInSystem;
         bar.SetUnobscuredInView(v, IsUnobsqured);
     }
 }