SweptProfile掃掠輪廓線,在Revit二次開發中,我們經常要獲取一個拉伸體對象的輪廓信息和方向等信息,特別對於梁和柱子,我們經常可以定義為如下:

一個指定的截面,在指定的方向的延申。那么我們如何獲取這個截面和這個界面的延申距離呢,則可以通過FamilyInstance實例的GetSweptProfile函數:
public void GetProfile(Element element)
{
string messageInfo = "Profile : ";
if (element is FamilyInstance)
{
FamilyInstance beam = element as FamilyInstance;
if (beam.StructuralType == StructuralType.Beam)
{
//獲取掃掠輪廓線
Autodesk.Revit.DB.SweptProfile sweptProfile = beam.GetSweptProfile();
//獲取輪廓
Autodesk.Revit.DB.Profile profile = sweptProfile.GetSweptProfile();
//獲取掃掠線
Autodesk.Revit.DB.Curve curve= sweptProfile.GetDrivingCurve();
}
}
}
以上代碼,就是通過GetSweptProfile函數,獲取指定實例的輪廓信息和掃掠線信息。掃掠線就是當前族延申的方向和距離
