前提

C#

 

実装

選択した要素のFamilySymbol(タイプ)のパラメータを変更する。

Document document = commandData.Application.ActiveUIDocument.Document;
UIDocument uidocument = commandData.Application.ActiveUIDocument;

// 要素の取得処理の詳細は省略

ElementUtil elementUtil = new ElementUtil();
IList<Element> elements = elementUtil.GetSelectedElementsByCategoryId(document, uidocument, BuiltInCategory.OST_Doors);

Transaction transaction = new Transaction(m_data.CommandData.Application.ActiveUIDocument.Document, Guid.NewGuid().GetHashCode().ToString());
transaction.Start();

foreach (Element element in elements)
{

    //肝心のFamilySymbolの取得処理は後述
    FamilyService familyService = new FamilyService();
    FamilySymbol symbol = familyService.GetFamilySymbol(document, element);

    IList<Parameter> symbolParams = symbol.GetOrderedParameters();

    foreach (Parameter symbolParam in symbolParams)
    {
       
symbolParam.Set("value"); //とりあえず適当に変更
    }
}

transaction.Commit();

 

 

以下、FamilySymbolの取得処理。

対象の要素のFamilySymbolを取得する。

public FamilySymbol GetFamilySymbol(Document document, Element element)
{

    FilteredElementCollector familyCollector = new FilteredElementCollector(document);
    familyCollector.OfClass(typeof(FamilySymbol));

    FamilySymbol familySymbolToFind = null;
    foreach (FamilySymbol familySymbol in familyCollector)
    {
        if (familySymbol.Id == element.GetTypeId())
        {
            familySymbolToFind = familySymbol;
            break;
        }
    }
    return familySymbolToFind;
}