本文整理汇总了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;
}
示例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;
}
示例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); }
}
示例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;
}