正在瀏覽:
1 名遊客
透過Revit 2015 API 上漆模型文字問題 --- >Paint ModelText |
||
---|---|---|
註冊日期:
2016/4/22 9:00 帖子:
1
|
我嘗試透過寫一個API將模型文字ModelText上漆,但以下的code執行時卻出現如附檔之錯誤, 主要是發生在doc.Paint(modelText.Id, face, elementId)這裡!! 可我用同樣的寫法對FamilyInstance及Wall上漆都沒問題,是否是revit 2015 的ModelText目前尚無開放
Transaction的document? 是否有哪位高手能幫忙解答呢? 謝謝 // Paint the E_path's face public void PaintModelTextFaces(ModelText modelText, ElementId elementId) { Document doc = modelText.Document; Autodesk.Revit.DB.Options opt = new Options(); Autodesk.Revit.DB.GeometryElement geomElem = modelText.get_Geometry(opt); foreach (GeometryObject geomObj in geomElem) { if (geomObj is Solid) { Solid f = geomObj as Solid; foreach (Face face in f.Faces) { using (Transaction trans = new Transaction(doc)) { trans.Start("PaintModelTextFaces"); doc.Paint(modelText.Id, face, elementId); trans.Commit(); } } } } } 附件: error.jpg (145.60 KB)
2016/4/22 14:54
|
|
工具箱 |
回覆: 透過Revit 2015 API 上漆模型文字問題 --- >Paint ModelText |
||
---|---|---|
註冊日期:
2014/9/15 8:25 帖子:
87
|
在從 Solid 取出 Face 之前,先判斷
solid.GraphicsStyleId 是否為 null 如果為 null ,處理 Face 會引發異常。
2016/4/22 17:10
|
|
工具箱 |