Autodesk Revit API
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
pick 2 points consecutiv ely
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
i am using Visual Studio 2010 and I want to pick 2 points consecutively using Selection.Pickpoint.
The problem occurs after picking the first point, an error is thrown saying "The user aborted the pick operation." If I put MsgBox in between picking the first and second point, there are no errors. Why is this so? Thanks!
Code:
pt1 = uiDocument2.Selection.PickPoint(Autodesk.Revit.UI.
pt2 = uiDocument2.Selection.PickPoint(Autodesk.Revit.UI.
If I do the next code, theres no error:
pt1 = uiDocument2.Selection.PickPoint(Autodesk.Revit.UI.
MsgBox("test")
pt2 = uiDocument2.Selection.PickPoint(Autodesk.Revit.UI.
Re: pick 2 points consecutiv ely
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I used the two lines your provided, it work well on my side. Probably you pressed ESC key, or you right click the view. You can use the try and catch to handle user's wrong interaction.
My First Revit plug-in handled the wrong user interaction for PickPoint , PickObject.
http://jprdintprev-wac.autodesk.com/adsk/servlet/i
Joe Ye
Developer Technical Services
Autodesk Developer Network
Re: pick 2 points consecutiv ely
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks for the reply joe. Probably the difference between our codes is that I used a modeless dialog box. I show the dialog box and after clicking the image button, I closed the dialog box using dispose and immediately after that, I execute 2 pickpoints consecutively. I am able to pick 1 point but not the second point. Do you have this same problem? Thanks!
Re: pick 2 points consecutiv ely
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi a7v1n,
i tried your steps, and find it is possible to pick twice consecutively.
here is my code.
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit .DB;
using Autodesk.Revit.UI;
using Autodesk.Revit .ApplicationServices;
using Autodesk.Revit.Attributes ;
using Template2010CS;
[TransactionAttribute(Autodesk.Revit.Attributes.Tr
[RegenerationAttribute(Autodesk.Revit.Attributes.R
public class RevitCommand : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
{
UIApplication app = commandData.Application;
Document doc = app.ActiveUIDocument.Document;
Transaction trans = new Transaction(doc, "ExComm");
trans.Start();
Form1 myform = new Form1();
myform.Show();
XYZ pt1 = app.ActiveUIDocument.Selection.PickPoint("please pick first pt");
XYZ pt2 = app.ActiveUIDocument.Selection.PickPoint("please pick second pt");
trans.Commit();
return Result.Succeeded ;
}
}
In the modless dialog , there is a button. click button to dispose the dialog.
Here is the code.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Dispose();
}
}
Run the command, click the button, i can consecutively pick twice.
your code maybe different with me. If this doesn't help, please let me see you code.
Good luck.
Joe Ye
Developer Technical Services
Autodesk Developer Network
Re: pick 2 points consecutiv ely
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have this same problem using a modeless dialog. I have a section of code that is called when a button is pressed. Within that section of code I am trying to select 2 elements, but upon trying to select the second element I get the "User Aborted..." error.
The code in the last post does not seem to respond to a button click.
Have you figured this out original poster?
Re: pick 2 points consecutiv ely
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I should mention that I do not want to dispose of the dialog. Rather I want to leave the dialog open and display information about the 2 elements selected.
Re: pick 2 points consecutiv ely
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Yes I finally figured it out. You have to code your selection inside the class where you call the Form and not inside the Form. I did it that way and I didnt get errors while picking 2 points consecutively using a modal dialog.

