<?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: WindowsForms and PickPoint in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/11090561#M20522</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/824630"&gt;@jeremy_tammik&lt;/a&gt;&amp;nbsp;Yes, exactly ! I remember looking at that ! Helps me a lot !&lt;/P&gt;</description>
    <pubDate>Thu, 07 Apr 2022 14:16:48 GMT</pubDate>
    <dc:creator>apointeau</dc:creator>
    <dc:date>2022-04-07T14:16:48Z</dc:date>
    <item>
      <title>WindowsForms and PickPoint</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/10974928#M20516</link>
      <description>&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;I'm trying to create windows form to place unplaced rooms by picking a point in the interface.&lt;/P&gt;&lt;P&gt;So, I have to create an interface with generated button (for each rooms) to which I apply a function called place_room().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the function to:&lt;/P&gt;&lt;P&gt;- hide the forms&lt;/P&gt;&lt;P&gt;- pick a point in UI&lt;/P&gt;&lt;P&gt;- place the room at the point&lt;/P&gt;&lt;P&gt;- unhide the forms&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one big problem: it seems that when the form is hidden, it's always on focus so I can't pick a point...&lt;/P&gt;&lt;P&gt;I'm aware of the external event to place a room with the help of Jeremy:&amp;nbsp;&lt;A href="https://thebuildingcoder.typepad.com/blog/2015/12/external-event-and-10-year-forum-anniversary.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2015/12/external-event-and-10-year-forum-anniversary.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the solution of Jeremy here:&amp;nbsp;&lt;A href="https://thebuildingcoder.typepad.com/blog/2015/11/pickpoint-with-wpf-and-no-threads.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2015/11/pickpoint-with-wpf-and-no-threads.html&lt;/A&gt;&amp;nbsp;But it's not working too.&lt;/P&gt;&lt;P&gt;My code now:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private void place_room()
        {
            this.Hide();
            var pt = uidoc.Selection.PickPoint("Merci de sélectionner un point");
            //do stuff to place the room at the selected point
            this.Show();
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;With this code, the form hides itself but I can't pick a point...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry if this problem was solved somewhere in the forum but I didn't find it...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a nice day&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 09:40:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/10974928#M20516</guid>
      <dc:creator>apointeau</dc:creator>
      <dc:date>2022-02-28T09:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: WindowsForms and PickPoint</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/10975155#M20517</link>
      <description>&lt;P&gt;There are various Windows API calls that you can use to set the focus back to the Revit graphics window. One example of using SetFocus is given here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2016/03/implementing-the-trackchangescloud-external-event.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2016/03/implementing-the-trackchangescloud-external-event.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;There may be other tricks that you can apply as well. Nowadays, you can use the Revit main window property instead of&amp;nbsp;ComponentManager.ApplicationWindow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 12:38:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/10975155#M20517</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-02-28T12:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: WindowsForms and PickPoint</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/10975468#M20518</link>
      <description>&lt;P&gt;Thanks for your answer!&lt;/P&gt;&lt;P&gt;I implemented the SetFocusToRevit() but my screen is always waiting for something and I can't select something.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="apointeau_0-1646057511828.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1030579i65270E8636F09D95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="apointeau_0-1646057511828.png" alt="apointeau_0-1646057511828.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But when I press the Esc I have the error message that I didn't select something...&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 14:57:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/10975468#M20518</guid>
      <dc:creator>apointeau</dc:creator>
      <dc:date>2022-02-28T14:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: WindowsForms and PickPoint</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/10975583#M20519</link>
      <description>&lt;P&gt;Is your form modeless?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2011/09/modeless-forms-in-revit.html" target="_blank" rel="noopener"&gt;https://thebuildingcoder.typepad.com/blog/2011/09/modeless-forms-in-revit.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: Nevermind... looks like it is&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 15:50:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/10975583#M20519</guid>
      <dc:creator>EATREVITPOOPCAD</dc:creator>
      <dc:date>2022-02-28T15:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: WindowsForms and PickPoint</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/11089378#M20520</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/824630"&gt;@jeremy_tammik&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10364294"&gt;@EATREVITPOOPCAD&lt;/a&gt;&amp;nbsp; and thank you for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry I didn't come back but I found the solution!&lt;/P&gt;&lt;P&gt;I didn't remenber where exactly I found the solution but probably on this forum!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The solution :&lt;/P&gt;&lt;P&gt;The main class to call the forms&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public class ManageUnplacedRooms : IExternalCommand
{

// do stuff

ManageUnPlacedRoomsForms forms = new ManageUnPlacedRoomsForms(doc, uidoc);
forms.Show();
return Result.Succeeded;

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public partial class ManageUnPlacedRoomsForms : System.Windows.Forms.Form
{
        place_rooms myplace_rooms;
        ExternalEvent placeroomcommand;

        public ManageUnPlacedRoomsForms(Document document, UIDocument uidocument)
        {
            InitializeComponent();
            myplace_rooms = new place_rooms();
            placeroomcommand = ExternalEvent.Create(myplace_rooms);
            doc = document;
            uidoc = uidocument;
        }

        //do a lot a stuff

        //private void link to a button
        private void place_room(object sender, EventArgs e)
        {
            // external command?
            placeroomcommand.Raise();
        }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public class place_rooms : IExternalEventHandler
    {
        public void Execute(UIApplication a)
        {
            UIDocument uidoc = a.ActiveUIDocument;
            Document doc = uidoc.Document;
            // do stuff again

            //Start the transaction
            Transaction transaction = new Transaction(doc);
            transaction.Start("Placement temp pièce :" + nameelem);
            // ask user to pick point
            XYZ pt = uidoc.Selection.PickPoint("Position de la pièce");
            // do stuff again
            transaction.Commit();
        }
        // public string requiered for the IExternalEventHandler  I think
        public string GetName()
        {
            return "Mise en place de pièce";
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope that help others !&lt;/P&gt;&lt;P&gt;Have a nice day !&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 05:59:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/11089378#M20520</guid>
      <dc:creator>apointeau</dc:creator>
      <dc:date>2022-04-07T05:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: WindowsForms and PickPoint</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/11089444#M20521</link>
      <description>&lt;P&gt;Brilliant! Congratulations on solving and thank you for a very nice sample!&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, have you looked at the Revit&amp;nbsp;SDK sample ModelessDialog/ModelessForm_ExternalEvent?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe it has certain similarities. Maybe it even achieves the same thing in the same way...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 06:52:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/11089444#M20521</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-04-07T06:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: WindowsForms and PickPoint</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/11090561#M20522</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/824630"&gt;@jeremy_tammik&lt;/a&gt;&amp;nbsp;Yes, exactly ! I remember looking at that ! Helps me a lot !&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 14:16:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/windowsforms-and-pickpoint/m-p/11090561#M20522</guid>
      <dc:creator>apointeau</dc:creator>
      <dc:date>2022-04-07T14:16:48Z</dc:date>
    </item>
  </channel>
</rss>

