<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: pick 2 points consecutively in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3083258#M81619</link>
    <description>&lt;P&gt;I used the two lines your provided, it work well on my side.&amp;nbsp;Probably you pressed ESC key, or you right click the view.&amp;nbsp;You can use the try and catch to handle user's&amp;nbsp;wrong interaction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My First Revit plug-in handled the wrong user interaction for PickPoint , PickObject.&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://jprdintprev-wac.autodesk.com/adsk/servlet/index?siteID=123112&amp;amp;id=16849745&amp;amp;preview=1"&gt;http://jprdintprev-wac.autodesk.com/adsk/servlet/index?siteID=123112&amp;amp;id=16849745&amp;amp;preview=1&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2011 06:10:14 GMT</pubDate>
    <dc:creator>Joe.Ye</dc:creator>
    <dc:date>2011-07-07T06:10:14Z</dc:date>
    <item>
      <title>pick 2 points consecutively</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3080474#M81618</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am using Visual Studio 2010 and I want to pick 2 points consecutively using Selection.Pickpoint.&lt;/P&gt;&lt;P&gt;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&amp;nbsp; no errors. Why is this so? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pt1 = uiDocument2.Selection.PickPoint(Autodesk.Revit.UI.Selection.ObjectSnapTypes.None, "Pick leader end...")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pt2 = uiDocument2.Selection.PickPoint(Autodesk.Revit.UI.Selection.ObjectSnapTypes.None, "Pick leader elbow...")﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do the next code, theres no error:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pt1 = uiDocument2.Selection.PickPoint(Autodesk.Revit.UI.Selection.ObjectSnapTypes.None, "Pick leader end...")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox("test")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pt2 = uiDocument2.Selection.PickPoint(Autodesk.Revit.UI.Selection.ObjectSnapTypes.None, "Pick leader elbow...")﻿&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jul 2011 19:12:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3080474#M81618</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-04T19:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: pick 2 points consecutively</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3083258#M81619</link>
      <description>&lt;P&gt;I used the two lines your provided, it work well on my side.&amp;nbsp;Probably you pressed ESC key, or you right click the view.&amp;nbsp;You can use the try and catch to handle user's&amp;nbsp;wrong interaction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My First Revit plug-in handled the wrong user interaction for PickPoint , PickObject.&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://jprdintprev-wac.autodesk.com/adsk/servlet/index?siteID=123112&amp;amp;id=16849745&amp;amp;preview=1"&gt;http://jprdintprev-wac.autodesk.com/adsk/servlet/index?siteID=123112&amp;amp;id=16849745&amp;amp;preview=1&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2011 06:10:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3083258#M81619</guid>
      <dc:creator>Joe.Ye</dc:creator>
      <dc:date>2011-07-07T06:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: pick 2 points consecutively</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3083920#M81620</link>
      <description>&lt;P&gt;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!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2011 15:03:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3083920#M81620</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-07-07T15:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: pick 2 points consecutively</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3111146#M81621</link>
      <description>&lt;P&gt;Hi a7v1n,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i tried your steps, and find it is possible to pick twice consecutively.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is my code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;using System;&lt;BR /&gt;using System.Collections.Generic;&lt;BR /&gt;using System.Text;&lt;BR /&gt;using System.Windows.Forms;&lt;/P&gt;
&lt;P&gt;using&amp;nbsp; Autodesk.Revit .DB;&lt;BR /&gt;using Autodesk.Revit.UI;&lt;BR /&gt;using Autodesk.Revit .ApplicationServices;&lt;BR /&gt;using Autodesk.Revit.Attributes ;&lt;/P&gt;
&lt;P&gt;using Template2010CS;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp; [TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]&lt;BR /&gt;&amp;nbsp; [RegenerationAttribute(Autodesk.Revit.Attributes.RegenerationOption.Manual)]&lt;BR /&gt;public class RevitCommand : IExternalCommand&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UIApplication app = commandData.Application;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Document doc = app.ActiveUIDocument.Document;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Transaction trans = new Transaction(doc, "ExComm");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; trans.Start();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Form1 myform = new Form1();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myform.Show();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XYZ pt1 = app.ActiveUIDocument.Selection.PickPoint("please pick first pt");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XYZ pt2 = app.ActiveUIDocument.Selection.PickPoint("please pick second pt");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; trans.Commit();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return Result.Succeeded ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the modless dialog , there is a button. click button to dispose the dialog.&lt;/P&gt;
&lt;P&gt;Here is the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; public partial class Form1 : Form&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Form1()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitializeComponent();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void button1_Click(object sender, EventArgs e)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Dispose();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run the command, click the button, i can consecutively pick twice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;your code maybe different with me. If this doesn't help, please let me see you code.&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2011 03:20:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3111146#M81621</guid>
      <dc:creator>Joe.Ye</dc:creator>
      <dc:date>2011-08-02T03:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: pick 2 points consecutively</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3161172#M81622</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code in the last post does not seem to respond to a button click.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you figured this out original poster?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2011 19:05:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3161172#M81622</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-16T19:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: pick 2 points consecutively</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3161186#M81623</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2011 19:20:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3161186#M81623</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-16T19:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: pick 2 points consecutively</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3181474#M81624</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2011 22:24:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/3181474#M81624</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-10-05T22:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: pick 2 points consecutively</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/5934976#M81625</link>
      <description>&lt;P&gt;I have the same problem. Been working on it for a few weeks now but I can't seem to fix it.&lt;/P&gt;&lt;P&gt;I'm using a modeless form. After pressing a button on this form the "pick two points" function is needed.&lt;/P&gt;&lt;P&gt;My form must be visible at all times (shows info from poicked points).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use the PickPoint inside my form code. That only works when I use a Msgbox between the picks.&lt;/P&gt;&lt;P&gt;Tried putting it in the main class but then the pick function is activated after showing my main form.&lt;/P&gt;&lt;P&gt;I then can pick two points without the Msgbox in between.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem is it has to be activated when I press a button on the main form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope u guys can help me out...&lt;/P&gt;&lt;P&gt;(I'm using vb.net)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Dennis&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2015 18:36:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/pick-2-points-consecutively/m-p/5934976#M81625</guid>
      <dc:creator>KE-engineering</dc:creator>
      <dc:date>2015-12-03T18:36:44Z</dc:date>
    </item>
  </channel>
</rss>

