Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Document   doc   = commandData.Application.ActiveUIDocument.Document;
            UIDocument uidoc = commandData.Application.ActiveUIDocument;

            View3D view = doc.ActiveView as View3D;

            if (view == null)
            {
                TaskDialog.Show("Warning", "Active view must be a 3D view.");
                return(Result.Failed);
            }


            List <Element> rebars = RebarSelectHelper.GetSelectedOrAll(uidoc);

            using (Transaction t3 = new Transaction(doc, "Set Solid in View"))
            {
                t3.Start();
                foreach (Element rebar in rebars)
                {
                    if (rebar is RebarInSystem)
                    {
                        RebarInSystem r = (RebarInSystem)rebar;
                        if (!r.IsSolidInView(view))
                        {
                            r.SetSolidInView(view, true);
                        }
                    }
                    else if (rebar is Rebar)
                    {
                        Rebar r = (Rebar)rebar;
                        if (!r.IsSolidInView(view))
                        {
                            r.SetSolidInView(view, true);
                        }
                    }
                }
                t3.Commit();
            }
            return(Result.Succeeded);
        }