求助,文字插入问题
现在需要在一个三维的模型中插入文字说明,有些需要在侧视图中插入,有些需要在后视图中插入……。反正可能在任何一个视图里面,但程序做好后,在俯视图中可以正确插入,但在别的视图中就不行了,怎么插都在俯视图中,也就是WCS的XY平面。应该怎么解决呢,跪求高手指点。在线等真的没人知道吗??? using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
namespace UCStext
{
public class Class1
{
public void aa()
{
Database db = HostApplicationServices.WorkingDatabase;
Document doc = Application.DocumentManager.MdiActiveDocument;
PromptPointOptions op = new PromptPointOptions("insert point:");
PromptPointResult opres = doc.Editor.GetPoint(op);
Point3d pt = opres.Value;
Matrix3d mt = doc.Editor.CurrentUserCoordinateSystem;
DBText ent = new DBText();
ent.TextString = " 我是中国人";
ent.Position = pt;
ent.TransformBy(mt);
using (Transaction trans = db.TransactionManager.StartTransaction())
{
BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord btrec = trans.GetObject(bt, OpenMode.ForWrite) as BlockTableRecord;
btrec.AppendEntity(ent);
trans.AddNewlyCreatedDBObject(ent, true);
trans.Commit();
}
}
}
}终于解决了
页:
[1]