本文整理汇总了C#中FilteredElementCollector.Excluding方法的典型用法代码示例。如果您正苦于以下问题:C# FilteredElementCollector.Excluding方法的具体用法?C# FilteredElementCollector.Excluding怎么用?C# FilteredElementCollector.Excluding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilteredElementCollector
的用法示例。
在下文中一共展示了FilteredElementCollector.Excluding方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUnusedTextNoteTypesExcluding
/// <summary>
/// Return all unused text note types by first
/// determining all text note types in use and
/// then collecting all the others using an
/// exclusion filter.
/// </summary>
ICollection<ElementId> GetUnusedTextNoteTypesExcluding(
Document doc)
{
ICollection<ElementId> usedTextNotesTypeIds
= new Collection<ElementId>();
FilteredElementCollector textNotes
= new FilteredElementCollector( doc )
.OfClass( typeof( TextNote ) );
foreach( TextNote textNote in textNotes )
{
usedTextNotesTypeIds.Add(
textNote.TextNoteType.Id );
}
FilteredElementCollector unusedTypeCollector
= new FilteredElementCollector( doc )
.OfClass( typeof( TextNoteType ) );
if( 0 < usedTextNotesTypeIds.Count )
{
unusedTypeCollector.Excluding(
usedTextNotesTypeIds );
}
ICollection<ElementId> unusedTypes
= unusedTypeCollector.ToElementIds();
return unusedTypes;
}
示例2: findBlockingElements
/// <summary>
/// Find elements blocking egress
/// </summary>
/// <param name="egresses">The egresses to be detected</param>
/// <returns>The detection result</returns>
public XElement findBlockingElements(ICollection<Element> egresses)
{
// create a node that place all egresses.
XElement egressesNode = new XElement("Egresses", new XAttribute("Name", "Egresses"));
try
{
// find the elements blocking egress
foreach (Element egressElement in egresses)
{
XElement egressNode = new XElement("Egress",
new XAttribute("Name", egressElement.Name));
int count = 1;
foreach (GeometryObject egressGObj in
(egressElement.get_Geometry(new Autodesk.Revit.DB.Options()).Objects.get_Item(0) as GeometryInstance).GetInstanceGeometry().Objects)
{
if (egressGObj is Solid)
{
Solid egressVolume = egressGObj as Solid; //calculated from shape and location of a given door
XElement solidNode = new XElement("ElementSolid" + count.ToString());
// Iterate to find all instance types
FilteredElementCollector blockingcollector = new FilteredElementCollector(m_doc);
blockingcollector.WhereElementIsNotElementType();
// Apply geometric filter
ElementIntersectsSolidFilter testElementIntersectsSolidFilter =
new ElementIntersectsSolidFilter(egressVolume);
blockingcollector.WherePasses(testElementIntersectsSolidFilter);
IEnumerable<Element> blockingElement = blockingcollector;
// Exclude the door itself
List<ElementId> exclusions = new List<ElementId>();
exclusions.Add(egressElement.Id);
blockingcollector.Excluding(exclusions);
XElement blockingegressNode = new XElement("blocking_egress_elements",
new XAttribute("Count", blockingElement.Count().ToString()));
foreach (Element blockingelement in blockingElement)
{
blockingegressNode.Add(new XElement("blocking_egress_element",
new XAttribute("Name", blockingelement.Name)));
}
solidNode.Add(blockingegressNode);
egressNode.Add(solidNode);
count++;
}
}
egressesNode.Add(egressNode);
}
}
catch (Exception ex)
{
egressesNode.Add(new XElement("Error", new XAttribute("Exception", ex.ToString())));
}
// return the whole Egresses Node
return egressesNode;
}