Revit API得到系统族名称
得到类似风管或者墙的系统族的名称,是通过类型的参数得到。
from:http://revit.5d6d.com/thread-1335-1-1.html
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmdGetSysFamilyName : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string messages, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Document doc = uiDoc.Document;
Selection sel = uiDoc.Selection;
Transaction ts = new Transaction(uiDoc.Document, "风管类型");
ts.Start();
//得到风管的系统族名称
Reference refDuct = sel.PickObject(ObjectType.Element, "风管");
Duct duct = doc.GetElement(refDuct) as Duct;
TaskDialog.Show("duct", duct.DuctType.get_Parameter(BuiltInParameter.ALL_MODEL_FAMILY_NAME).AsString());
//得到墙的系统族名称
Wall wall = null;
wall.WallType.get_Parameter(BuiltInParameter.ALL_MODEL_FAMILY_NAME).AsString();
ts.Commit();
return Result.Succeeded;
}
}
[Regeneration(RegenerationOption.Manual)]
public class cmdGetSysFamilyName : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string messages, ElementSet elements)
{
UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
Document doc = uiDoc.Document;
Selection sel = uiDoc.Selection;
Transaction ts = new Transaction(uiDoc.Document, "风管类型");
ts.Start();
//得到风管的系统族名称
Reference refDuct = sel.PickObject(ObjectType.Element, "风管");
Duct duct = doc.GetElement(refDuct) as Duct;
TaskDialog.Show("duct", duct.DuctType.get_Parameter(BuiltInParameter.ALL_MODEL_FAMILY_NAME).AsString());
//得到墙的系统族名称
Wall wall = null;
wall.WallType.get_Parameter(BuiltInParameter.ALL_MODEL_FAMILY_NAME).AsString();
ts.Commit();
return Result.Succeeded;
}
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。