當前位置: 首頁>>代碼示例>>C#>>正文


C# Autodesk.GetRibbonPanels方法代碼示例

本文整理匯總了C#中Autodesk.GetRibbonPanels方法的典型用法代碼示例。如果您正苦於以下問題:C# Autodesk.GetRibbonPanels方法的具體用法?C# Autodesk.GetRibbonPanels怎麽用?C# Autodesk.GetRibbonPanels使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Autodesk的用法示例。


在下文中一共展示了Autodesk.GetRibbonPanels方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetNewWallType

        protected WallType GetNewWallType(Autodesk.Revit.UI.UIApplication app)
        {
            RibbonPanel myPanel = app.GetRibbonPanels()[0];
            RadioButtonGroup radioGroupTypeSelector =
                GetRibbonItemByName(myPanel, "WallTypeSelector") as RadioButtonGroup;
             if (null == radioGroupTypeSelector) { throw new InvalidCastException("Cannot get Wall Type selector!"); }
             String wallTypeName = radioGroupTypeSelector.Current.ItemText;
             WallType newWallType = null;
             FilteredElementCollector collector = new FilteredElementCollector(app.ActiveUIDocument.Document);
             ICollection<Element> founds = collector.OfClass(typeof(WallType)).ToElements();
             foreach (Element elem in founds)
             {
                WallType wallType = elem as WallType;
                if (wallType.Name.StartsWith(wallTypeName))
                {
                   newWallType = wallType; break;
                }
             }

             return newWallType;
        }
開發者ID:AMEE,項目名稱:revit,代碼行數:21,代碼來源:AddInCommand.cs

示例2: GetNewWallMark

 protected String GetNewWallMark(Autodesk.Revit.UI.UIApplication app)
 {
     RibbonPanel myPanel = app.GetRibbonPanels()[0];
     Autodesk.Revit.UI.TextBox textBox =
         GetRibbonItemByName(myPanel, "WallMark") as Autodesk.Revit.UI.TextBox;
     if (null == textBox) { throw new InvalidCastException("Cannot get Wall Mark TextBox!"); }
     String newWallMark;
     int newWallIndex = 0;
     FilteredElementCollector collector = new FilteredElementCollector(app.ActiveUIDocument.Document);
     ICollection<Element> founds = collector.OfClass(typeof(Wall)).ToElements();
     foreach (Element elem in founds)
     {
         Wall wall = elem as Wall;
         string wallMark = wall.get_Parameter(BuiltInParameter.ALL_MODEL_MARK).AsString();
         if (wallMark.StartsWith(textBox.Value.ToString()) && wallMark.Contains('_'))
         {
             //get the index for new wall (wall_1, wall_2...)
             char[] chars = { '_' };
             string[] strings = wallMark.Split(chars);
             if (strings.Length >= 2)
             {
                 try
                 {
                     int index = Convert.ToInt32(strings[strings.Length - 1]);
                     if (index > newWallIndex) { newWallIndex = index; }
                 }
                 catch (System.Exception)
                 {
                     continue;
                 }
             }
         }
     }
     newWallMark = textBox.Value.ToString() + '_' + (newWallIndex + 1);
     return newWallMark;
 }
開發者ID:AMEE,項目名稱:revit,代碼行數:36,代碼來源:AddInCommand.cs

示例3: GetNewWallShape

 protected CurveArray GetNewWallShape(Autodesk.Revit.UI.UIApplication app)
 {
     RibbonPanel myPanel = app.GetRibbonPanels()[0];
     Autodesk.Revit.UI.ComboBox comboboxWallShape =
         GetRibbonItemByName(myPanel, "WallShapeComboBox") as Autodesk.Revit.UI.ComboBox;
     if (null == comboboxWallShape) { throw new InvalidCastException("Cannot get Wall Shape Gallery!"); }
     String wallShape = comboboxWallShape.Current.ItemText;
     if ("SquareWall" == wallShape) { return GetSquareWallShape(app.Application.Create); }
     else if ("CircleWall" == wallShape) { return GetCircleWallShape(app.Application.Create); }
     else if ("TriangleWall" == wallShape) { return GetTriangleWallShape(app.Application.Create); }
     else { return GetRectangleWallShape(app.Application.Create); }
 }
開發者ID:AMEE,項目名稱:revit,代碼行數:12,代碼來源:AddInCommand.cs

示例4: GetNewWallLevel

        protected Level GetNewWallLevel(Autodesk.Revit.UI.UIApplication app)
        {
            RibbonPanel myPanel = app.GetRibbonPanels()[0];
            Autodesk.Revit.UI.ComboBox comboboxLevel =
                GetRibbonItemByName(myPanel, "LevelsSelector") as Autodesk.Revit.UI.ComboBox;
            if (null == comboboxLevel) { throw new InvalidCastException("Cannot get Level selector!"); }
            String wallLevel = comboboxLevel.Current.ItemText;
            //find wall type in document
            Level newWallLevel = null;
            FilteredElementCollector collector = new FilteredElementCollector(app.ActiveUIDocument.Document);
            ICollection<Element> founds = collector.OfClass(typeof(Level)).ToElements();
            foreach (Element elem in founds)
            {
               Level level = elem as Level;
               if (level.Name.StartsWith(wallLevel))
               {
                  newWallLevel = level; break;
               }
            }

            return newWallLevel;
        }
開發者ID:AMEE,項目名稱:revit,代碼行數:22,代碼來源:AddInCommand.cs


注:本文中的Autodesk.GetRibbonPanels方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。