当前位置:网站首页>Revit secondary development - operation family documents

Revit secondary development - operation family documents

2022-07-07 22:22:00 Hey, hey, hey, hey, hey

 

note

// Open the family document through the family file path 
Document fDoc = doc.Application.OpenDocumentFile(@"d:\xxx.rfa");
// Open the family document directly from the project 
Document fDoc = doc.EditFamily(family);
// Get the family document FamilyManager
FamilyManager fm = fDoc.FamilyManager;
// Switch family types 
using(Transaction trans = new Transaction(fDoc,"changeType"))
{
    trans.Start();
    foreach(FamilyType ft in fm.Types)
    {
        if(ft.Name == " type 2")
        {
            fm.CurrentType = ft;
            break;
        }
    }
}
// Get family parameters 
FamilyParameter fParameter = fm.get_Parameter(" Parameter name ");
// Get parameter value 
double fValue = fm.CurrentType.AsDouble(fParameter).Value;
// Get parameter formula 
string formula = fParameter.Formula;

// The modification should be in the transaction 

// Modify parameter value 
fm.Set(fParameter,10.5);
// Modify parameter formula 
fm.Set(fParameter," Long * wide ");
// Add parameter 
fm.AddParameter(" Custom parameters ",BuiltInParameterGroup.PG_GENERAL,ParameterType.Integer,true);
原网站

版权声明
本文为[Hey, hey, hey, hey, hey]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130606207118.html