本文整理汇总了C#中FilteredElementCollector.Any方法的典型用法代码示例。如果您正苦于以下问题:C# FilteredElementCollector.Any方法的具体用法?C# FilteredElementCollector.Any怎么用?C# FilteredElementCollector.Any使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilteredElementCollector
的用法示例。
在下文中一共展示了FilteredElementCollector.Any方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
Transaction t = new Transaction( doc );
t.Start( "Create Steel Stair Beams" );
// Check whether the required family is loaded:
FilteredElementCollector collector
= new FilteredElementCollector( doc )
.OfClass( typeof( Family ) );
// If the family is not already loaded, do so:
if( !collector.Any<Element>(
e => e.Name.Equals( FamilyName ) ) )
{
FamilySymbol symbol;
if( !doc.LoadFamilySymbol(
_family_path, SymbolName, out symbol ) )
{
message = string.Format(
"Unable to load '{0}' from '{1}'.",
SymbolName, _family_path );
t.RollBack();
return Result.Failed;
}
}
try
{
// Create a couple of connected beams:
SteelStairs s = new SteelStairs( doc );
s.Run();
t.Commit();
return Result.Succeeded;
}
catch( Exception ex )
{
message = ex.Message;
t.RollBack();
return Result.Failed;
}
}