revit添加族参数
Posted liaocheng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了revit添加族参数相关的知识,希望对你有一定的参考价值。
打开一个族文件,并为族文件添加参数
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
try
{
UIApplication uiApp = commandData.Application;
Autodesk.Revit.ApplicationServices.Application app = uiApp.Application;
Document newDoc = app.OpenDocumentFile(@"F: est.rfa");
if (newDoc != null)
{
using (Transaction trans = new Transaction(newDoc))
{
trans.Start("Add Parameter");
FamilyManager flyMgr = newDoc.FamilyManager;
string paraName = "NewParam4";
BuiltInParameterGroup paraGroup = BuiltInParameterGroup.PG_TEXT;
ParameterType paraType = ParameterType.Text;
flyMgr.AddParameter(paraName, paraGroup, paraType, false);
trans.Commit();
}
}
SaveOptions saveOpt = new SaveOptions();
saveOpt.Compact = true;
//newDoc.Save(saveOpt);
newDoc.Close();
return Result.Succeeded;
}
catch (Exception exception)
{
message = exception.Message;
return Result.Failed;
}
}
以上是关于revit添加族参数的主要内容,如果未能解决你的问题,请参考以下文章
BIM入门实战Revit 图元分类有哪三种?Revit图元分类图文详解