本帖最后由 sailorcwx 于 2011-11-10 13:02 编辑
- public void Test5()
- {
- Document doc = Application.DocumentManager.MdiActiveDocument;
- Database db = doc.Database;
- Editor ed = doc.Editor;
- PromptEntityOptions selectOptions = new PromptEntityOptions("\n选择光栅图像");
- selectOptions.SetRejectMessage("\n只能选择光栅图像");
- selectOptions.AddAllowedClass(typeof(Image),false);
- PromptEntityResult selectResult = ed.GetEntity(selectOptions);
- if (selectResult.Status != PromptStatus.OK) return;
- Transaction tr = doc.TransactionManager.StartTransaction();
- using (tr)
- {
- RasterImage imageSelected = tr.GetObject(selectResult.ObjectId, OpenMode.ForRead) as RasterImage;
- ed.WriteMessage("\n图像名称:{0}\n图像路径:{1}\n图像位置:{2},{3},{4}", imageSelected.Name, imageSelected.Path, imageSelected.Position.X.ToString(), imageSelected.Position.Y.ToString(), imageSelected.Position.Z.ToString());
- }
- }
|