<?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: Loop for Getpoint in a WPF Modal form in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12852488#M3581</link>
    <description>&lt;P&gt;What is this? Why do not need to create an instance of WPF window and pass it to SelectPointInMidDocument()?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;var modalUi = new WpfModalForm();&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume the "Ok" button that is clicked is on a &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;modal UI (WPF, or Win Form)&lt;/STRONG&gt;&lt;FONT color="#000000"&gt;, which should be the one being passed to SelectPointInMidDocument() method, that is:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;var selectedPt = JigManager.TheUtilityClass.SelectPointInMidDocument(this);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, the error you get is because you pass in a non-displayed, non-modal window to the StartUserInteraction()!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jun 2024 20:57:27 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2024-06-20T20:57:27Z</dc:date>
    <item>
      <title>Loop for Getpoint in a WPF Modal form</title>
      <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12845084#M3574</link>
      <description>&lt;P&gt;I need to create a loop for inserting blocks from a WPF MODAL form.&lt;BR /&gt;But I'm not getting it with my code using PromptPointOptions, I have a Flash of the form every time I enter a point.&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;How can I fix my code?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Thanks&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// This is the code that displays the modal form
public class Commands
{
    [CommandMethod("ModalForm")]
    public static void ModalForm()
    {
        var dialog = new WpfModalForm();
        // carrega o formulario
        var result = AcAp.ShowModalWindow(AcAp.MainWindow.Handle, dialog, false);
    }
}

// This is the code for the button that asks you to select points

private void OkButtonName_Click(object sender, RoutedEventArgs e)
  {
      var ed = AcAp.DocumentManager.MdiActiveDocument.Editor;
      var ppo = new PromptPointOptions("\nSpecify insertion point: ");
      ppo.AllowNone = true; // allows a null value

      while (true)
      {
          var ppr = ed.GetPoint(ppo);
          if (ppr.Status == PromptStatus.OK)
          {
              ed.WriteMessage("\nInsert and process the block at the point: " + ppr.Value.ToString());
          }
          else 
          {
              ed.WriteMessage("\nNo points specified, the form will be reopened");
              break;
          }
      }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 19:48:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12845084#M3574</guid>
      <dc:creator>s_velasquez</dc:creator>
      <dc:date>2024-06-17T19:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for Getpoint in a WPF Modal form</title>
      <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12845142#M3575</link>
      <description>&lt;P&gt;When a modal form (dialog box) is shown, in order to hide the form for user to interact with the Editor (picking point, in your case) and then back to the modal form, you call Editor.StartUserInteraction(), which hide the form and then shows it back:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;private void OkButtonName_Click(object sender, RoutedEventArgs e)
  {
      var ed = AcAp.DocumentManager.MdiActiveDocument.Editor;
      using (ed.StartUserInteraction(this))
      {
         var ppo = new PromptPointOptions("\nSpecify insertion point: ");
         ppo.AllowNone = true; // allows a null value
         while (true)
         {
           var ppr = ed.GetPoint(ppo);
           if (ppr.Status == PromptStatus.OK)
           {
              ed.WriteMessage("\nInsert and process the block at the point: " + ppr.Value.ToString());
           }
           else 
           {
              ed.WriteMessage("\nNo points specified, the form will be reopened");
              break;
           }
         }
      }
  }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 20:17:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12845142#M3575</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-06-17T20:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for Getpoint in a WPF Modal form</title>
      <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12845145#M3576</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You can try using Editor.StartUserInteraction method.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;private void Button_Click(object sender, RoutedEventArgs e)
{
    var ed = AcAp.DocumentManager.MdiActiveDocument.Editor;
    var ppo = new PromptPointOptions("\nSpecify insertion point: ");
    ppo.AllowNone = true; // allows a null value

    using (ed.StartUserInteraction(this))
    {
        while (true)
        {
            var ppr = ed.GetPoint(ppo);
            if (ppr.Status == PromptStatus.OK)
            {
                ed.WriteMessage("\nInsert and process the block at the point: " + ppr.Value.ToString());
            }
            else
            {
                ed.WriteMessage("\nNo points specified, the form will be reopened");
                break;
            }
        }
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 20:16:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12845145#M3576</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-06-17T20:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for Getpoint in a WPF Modal form</title>
      <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12845655#M3577</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Thanks to Norman and Gile for the response&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;.&lt;BR /&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Using Editor.StartUserInteraction method solved my problem.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 03:15:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12845655#M3577</guid>
      <dc:creator>s_velasquez</dc:creator>
      <dc:date>2024-06-18T03:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for Getpoint in a WPF Modal form</title>
      <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12851690#M3578</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Does anyone know of a way to use 'using '(ed.StartUserInteraction(...)' or something similar in a class or static method?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 14:07:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12851690#M3578</guid>
      <dc:creator>s_velasquez</dc:creator>
      <dc:date>2024-06-20T14:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for Getpoint in a WPF Modal form</title>
      <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12851868#M3579</link>
      <description>&lt;P&gt;I assume that you want to place the code of user interacting with Editor (e.g. calling Editor.GetXxxx() in a shared utility class as static methods and then call these static methods in the UI's code behind (yes, that is good practice of separating CAD dealing code with UI code).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can wrap your static methods, which call Editor.GetXxx() inside, with overloaded method that accepts either IWin32Window (for Win Form UI), or System.Windows.Window (for WPF UI) as input. Something like:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;public static Point3d? SelectPointInMdiDocument(Editor ed)
{
  var res=ed.GetPoint("\nSelect point:");
  if (res.Status==PromptStatus.OK)
  {
    return res.Value;
  }
  else
  {
	return null;
  }
}

public static Point3d? SelectPointInMidDocument(System.Windows.Window modalUi)
{
	var dwg=Application.DocumentManager.MdiActiveDocument;
	var ed=dwg.Editor;
	using (ed.StartUserInteraction(modalUi)
	{
		return SelectPointInMdiDocument(ed);
	}
}
public static Point3d? SelectPointInMidDocument(Form modalUi)
{
	var dwg=Application.DocumentManager.MdiActiveDocument;
	var ed=dwg.Editor;
	using (ed.StartUserInteraction(modalUi)
	{
		return SelectPointInMdiDocument(ed);
	}
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, in your modal dialog's code behind, you can do:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;private void Button_Click(...)
{
        // the form's code really does not need to know
        // when/how to hide the form and get user input from Editor
	var selectedPt=TheUtilityClass.SelectPointInMdiDocument(this);
	if (selectedPt.HasValue)
	{
		// Show the point coordinate on the modal UI
	}
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 15:38:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12851868#M3579</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-06-20T15:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for Getpoint in a WPF Modal form</title>
      <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12852336#M3580</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Thanks for the answer Norman, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;See the tests I did in my project trabalhando com o AutoCAD 2025: &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;1 - 'SelectPointInMdiDocument' I changed the argument 'this' to 'ed' and it worked without problems.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;2- the methods 'SelectPointInMidDocument(System.Windows.Window modalUi)' and 'SelectPointInMidDocument(Form modalUi)' showed the error below:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Exception thrown: 'System.ArgumentException' in accoremgd.dll&lt;BR /&gt;An exception of type 'System.ArgumentException' occurred in accoremgd.dll but was not handled in user code&lt;BR /&gt;Window is not active:"&lt;BR /&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Please tell me where my mistake is&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt; private void OkButtonName_Click(object sender, RoutedEventArgs e)
 {
     var doc = AcAp.DocumentManager.MdiActiveDocument;
     var ed = doc.Editor;
 
     var modalUi = new WpfModalForm();

     var selectedPt = JigManager.TheUtilityClass.SelectPointInMidDocument(modalUi);
     NameBox.Text = selectedPt.ToString();
 }&lt;/LI-CODE&gt;&lt;P&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, 20 Jun 2024 19:14:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12852336#M3580</guid>
      <dc:creator>s_velasquez</dc:creator>
      <dc:date>2024-06-20T19:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for Getpoint in a WPF Modal form</title>
      <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12852488#M3581</link>
      <description>&lt;P&gt;What is this? Why do not need to create an instance of WPF window and pass it to SelectPointInMidDocument()?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;var modalUi = new WpfModalForm();&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume the "Ok" button that is clicked is on a &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;modal UI (WPF, or Win Form)&lt;/STRONG&gt;&lt;FONT color="#000000"&gt;, which should be the one being passed to SelectPointInMidDocument() method, that is:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;var selectedPt = JigManager.TheUtilityClass.SelectPointInMidDocument(this);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, the error you get is because you pass in a non-displayed, non-modal window to the StartUserInteraction()!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 20:57:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12852488#M3581</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-06-20T20:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for Getpoint in a WPF Modal form</title>
      <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12853246#M3582</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Hi Norman, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;You are right, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;By the way, the error you get is because you pass in a non-displayed, non-modal window to the StartUserInteraction()!&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;That is my mistake.&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I am calling your method in a static class so it does not work.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt; I have 13 WPF windows in my project and I thought about using a single function to handle the insertion of blocks using. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;The 'Block Insertion' class handles the insertion of blocks using 'Jig'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;private void GetPointButton_Click(object sender, RoutedEventArgs e)
{
	// Calling a static class
    BlockInsertion.Insert("BlockTest");
}

//My static class
public static class BlockInsertion
{
    public static void Insert(string blockName)
    {
        var doc = AcAp.DocumentManager.MdiActiveDocument;
        var db = doc.Database;
        var ed = doc.Editor;
		
        // Collect insertion point here
        var selectedPt = JigManager.TheUtilityClass.SelectPointInMdiDocument(WpfModalForm);
        if (selectedPt.HasValue)
        {
            ed.WriteMessage("/nslectedPT: " + selectedPt.ToString());
        }
	// ...	
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 09:16:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12853246#M3582</guid>
      <dc:creator>s_velasquez</dc:creator>
      <dc:date>2024-06-21T09:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for Getpoint in a WPF Modal form</title>
      <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12853658#M3583</link>
      <description>&lt;LI-CODE lang="general"&gt;var selectedPt = JigManager.TheUtilityClass.SelectPointInMdiDocument(WpfModalForm);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is &lt;FONT color="#FF0000"&gt;&lt;EM&gt;WpfModalForm&lt;/EM&gt;&lt;/FONT&gt;? Where is it declared and the modal form is instantiated and displayed? If it is indeed a modal form that is shown as modal form, how can your code reaches it in a static class/method without passing it in as a parameter? It looks to me, the code is not well structured even you managed to compile it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, the &lt;EM&gt;JigManager&lt;/EM&gt; used inside implies that AFTER selecting a point, the block would be inserted in the "Jig" style, which means the user would continue to interacting with the Editor. So, it does not make sense to only call Editor.StartUserInteraction() inside the SelectPointInMdiDocument() method - you should hide the modal form in the whole process of block insertion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, since you want the block insertion is done in a re-usable static method, meaning, it could be called from, or not from a modal UI. Obviously, when called from modal UI, you want to hide the UI first and show it back after. The simplest way is the same as I showed in previous reply: just add another OVERLOAD Insert() method that take either Win Form, or WPF Window as input:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;private void GetPointButton_Click(object sender, RoutedEventArgs e)
{
	// Calling a static class
    BlockInsertion.Insert("BlockTest", this);
}

//My static class
public static class BlockInsertion
{
    public static void Insert(string blockName)
    {
        var doc = AcAp.DocumentManager.MdiActiveDocument;
        var db = doc.Database;
        var ed = doc.Editor;
		
        // Collect insertion point here
        var selectedPt = JigManager.TheUtilityClass.SelectPointInMdiDocument();
        if (selectedPt.HasValue)
        {
            ed.WriteMessage("/nslectedPT: " + selectedPt.ToString());
        }
		// ...	
    }
	
	public static void Insert(string blockName, System.Windows.Window modalWindow)
    {
        var doc = AcAp.DocumentManager.MdiActiveDocument;
        var db = doc.Database;
        var ed = doc.Editor;
		
        using (ed.StartUserInteraction(modalWindow)
		{
			Insert(blockName);
		}
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;In this case, you want to relabel/rename the button on the form from "Point &amp;gt;" to "Insert &amp;gt;" and from "GetPointButton" to "InsertBlockButton", not because you have to, but for code's easy readability&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 12:59:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12853658#M3583</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2024-06-21T12:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Loop for Getpoint in a WPF Modal form</title>
      <link>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12854544#M3584</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Thank you very much Norman, Your code worked perfectly, I have a lot to learn from it.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 21:37:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/loop-for-getpoint-in-a-wpf-modal-form/m-p/12854544#M3584</guid>
      <dc:creator>s_velasquez</dc:creator>
      <dc:date>2024-06-21T21:37:57Z</dc:date>
    </item>
  </channel>
</rss>

