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);
        }
Exemple #2
0
        /// <summary>
        /// Show the given rebar as solid in 3d view.
        /// </summary>
        /// <param name="rebar">Rebar to show in 3d view as solid</param>
        private void ShowRebar3d(Rebar rebar)
        {
            var filter = new FilteredElementCollector(rebar.Document)
                         .OfClass(typeof(View3D));

            foreach (View3D view in filter)
            {
                rebar.IsUnobscuredInView(view);
                rebar.SetSolidInView(view, true);
            }
        }
Exemple #3
0
        /// <summary>
        /// Show the given rebar as solid in 3d view.
        /// </summary>
        /// <param name="rebar">Rebar to show in 3d view as solid</param>
        private void ShowRebar3d(Rebar rebar)
        {
            var filter = new FilteredElementCollector(rebar.Document)
                .OfClass(typeof(View3D));

            foreach (View3D view in filter)
            {
                rebar.IsUnobscuredInView(view);
                rebar.SetSolidInView(view, true);
            }
        }