0

選択した要素をファミリ別にフィルタリングする必要があります。

木材梁ファミリがあり、木材ファミリの一部である選択した要素のみを修正する必要があります。オンラインで調べましたが、その方法を示すものは何も見つかりません。リビット初心者です。

//get all instaces if family objects
FilteredElementCollector familyInstanceCollector = 
  new FilteredElementCollector(doc);

familyInstanceCollector.OfClass(typeof(FamilyInstance))
  .WherePasses(new FamilySymbolFilter(new ElementId(140519)));

MessageBox.Show(familyInstanceCollector.Count<Element>().ToString());

foreach (Element element in familyInstanceCollector)
  MessageBox.Show(element.Name);
4

1 に答える 1

3

そのような新しい ElementId の作成が機能するかどうかはわかりません。また、プロジェクト全体で ElementId を予測できるかどうかもわかりません。最初に探しているファミリ シンボルを検索するフィルタを実行するのが最善の方法です。 、その結果を使用してインスタンスを見つけます。

SDK に含まれている .chm ファイルを確認してください。サンプルは次のとおりです。

// Creates a FamilyInstance filter for elements that are family instances of the given    family symbol in the document

// Find all family symbols whose name is "W10X49"
FilteredElementCollector collector = new FilteredElementCollector(document);
collector = collector.OfClass(typeof(FamilySymbol));

// Get Element Id for family symbol which will be used to find family instances
var query = from element in collector where element.Name == "W10X49" select element;
List<Element> famSyms = query.ToList<Element>();
ElementId symbolId = famSyms[0].Id;

// Create a FamilyInstance filter with the FamilySymbol Id
FamilyInstanceFilter filter = new FamilyInstanceFilter(document, symbolId);

// Apply the filter to the elements in the active document
collector = new FilteredElementCollector(document);
ICollection<Element> familyInstances = collector.WherePasses(filter).ToElements();
于 2011-07-04T07:30:08.063 に答える