我正在開發一個應用程序,需要了解哪個房間邊界是其他的。在這種情況下,知道房間邊界是牆壁還是房間分隔符是相關的。如何在revit 2017中獲取房間分隔符
public FindsRoomSeperators(){
SpatialElementBoundaryOptions options = new SpatialElementBoundaryOptions();
options.SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.Finish;
foreach (IList<Autodesk.Revit.DB.BoundarySegment> boundSegList in room.GetBoundarySegments(options))
{
foreach (Autodesk.Revit.DB.BoundarySegment boundSeg in boundSegList)
if ((BuiltInCategory)el.Category.Id.IntegerValue == BuiltInCategory.OST_RoomSeparationLines)
//proccess el
}
}
然而,隨着2017年的Revit這個代碼現在拋出找不到方法: 'Autodesk.Revit.DB.Element Autodesk.Revit.DB.BoundarySegment.get_Element()'。意外提示此方法已被刪除。
var geometry = (Solid)room.get_Geometry(new Options()).First();
var faces = geometry.Faces;
雖然這並不讓我來判斷的東西像什麼或不是地板是站在一個角度它並沒有告訴我哪個邊緣來自牆壁和從房間sepeartors。
理想情況下,我將能夠拍攝我們擁有的臉並檢查臉部的任何邊緣是否爲房間分隔符。如果有幫助,我已經有了所有牆的列表。
那麼如何做到這一點在revit 2017?最好在不破壞兼容性與2015年
的GetBoundarySegments()不是從API取消了對2017年提供的,但它仍然存在(甚至沒有標記爲「過時」)。你不錯過參考嗎? –
該代碼在2017年調用時會在foreach循環中引發異常,但在2016年可以正常工作。上述方法拋出異常:未找到方法:'Autodesk.Revit.DB.Element Autodesk.Revit.DB.BoundarySegment.get_Element()'。 – Thijser