Think of me more like a technical adviser suggesting tweaks to improve nozzle efficiency.
Oh, That's perfectly fine.
If it wasn't for people like you, people like me wouldn't learn near as much.
Thanks again!
And just for chuckles, here's my version of the string version (subject to constructive critism of coarse!)
//select text button.
private void button2_Click(object sender, EventArgs e)
{
label2.Text = PickTextInDrawing.GetTextStringValue();
}
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
namespace DisplayTextValue
{
class PickTextInDrawing
{
public static string GetTextStringValue()
{
Document document = AcadApp.DocumentManager.MdiActiveDocument;
Editor editor = document.Editor;
Database database = HostApplicationServices.WorkingDatabase;
string TxtVal = "";
PromptEntityOptions options = new PromptEntityOptions("\nSelect Text Object: < pick > ");
options.AllowNone = false;
options.SetRejectMessage("\nMust be DBText. ");
options.AddAllowedClass(typeof(DBText), false);
Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView();
PromptEntityResult selection = editor.GetEntity(options);
if (selection.Status == PromptStatus.OK)
{
using (document.LockDocument())
{
using (Transaction trans = database.TransactionManager.StartTransaction())
{
DBText text = trans.GetObject(selection.ObjectId, OpenMode.ForRead, false, false) as DBText;
TxtVal = text.TextString;
trans.Commit();
}
}
}
return TxtVal;
}
}
}
Bill