コード例 #1
0
ファイル: MyBar.cs プロジェクト: Tereami/RebarVisibility
 public void SetSolidInView(View3D v, bool AsBody)
 {
     if (RevitBar is Rebar)
     {
         Rebar bar = RevitBar as Rebar;
         bar.SetSolidInView(v, AsBody);
     }
     if (RevitBar is RebarInSystem)
     {
         RebarInSystem bar = RevitBar as RebarInSystem;
         bar.SetSolidInView(v, AsBody);
     }
 }
コード例 #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);
        }