How do I get an onscreen point after/ during a VB.net dialog box is launched (as example like with Hatch add pick points.
I would like to create button for this in a vb.net dialog box?
to get the point, you use editor's method GetPoint
Dim db As Database = HostApplicationServices.WorkingDatabase() Dim ed As Editor = db.Editor Dim newPoint as Point3d = ed.GetPoint("Pick a point: ").Value
You need to hide the dialog box so that user can pick in Acad editor, and then show the dialog box back. AutoCAD API provides a class for you: EditorUserInteraction. Assume you have a button on the form btnPick:
private void btnPick_Click(....)
{
Editor ed=Application.DocumentManaer.MdiDocument.Editor;
using ed.StartUserInteraction(this) //Calling StartUserInteraction(form) will hide the form automatically
{
PromptPointResult res=ed.GetPoint("\nPick a point:");
if (res.Status==PromptStatus.OK)
{
//Populate text boxes with picked Point3d value
txtBoxPointX.Text=res.Value.X.ToString();
txtBoxPointY.Text=res.Value.Y.ToString();
txtBoxPointZ.Text=res.Value.Z.ToString();
}
}
//When the using block ends, the form shows back
}
Norman Yuan
Hi,
I tested it but get the error message that a few items are not defined eg:
type "point3d" is not defined
Im assuming that i need to refrence Autocad first however all i see is a bunch of Acblablabla type librarys which one do i need?
Hi
I was trying out your code snippet but i get the following error message which I cant figure out.
Error 7 'Editor' is not a member of 'Autodesk.AutoCAD.DatabaseServices.Database'. C:\Users\Bart van Tuyl\Desktop\VB.net insert block example\Insert block\Insert block\Class1.vb 36 28 Insert block
do you know how to fix this?
This might be related to the big split, when core components were moved to separate dll. I don't have access to any AutoCAD API solution to check it now, but try to search in object browser for Editor and see in which namespace it can be found