当前位置: 首页>>代码示例>>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;未经允许,请勿转载。