我嘗試透過寫一個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();
}
}
}
}
}