<?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: Load lisp app from c# code and wait until it finish in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/load-lisp-app-from-c-code-and-wait-until-it-finish/m-p/12914371#M3218</link>
    <description>&lt;P&gt;Document doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;Editor ed = doc.Editor;&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;doc.SendStringToExecute("(load \"test.lsp\") ", true, false, false);&lt;BR /&gt;doc.SendStringToExecute("test_to_start" + "\n", true, false, false);&lt;BR /&gt;doc.LispEnded += new EventHandler(OnLispEnded);&lt;/P&gt;&lt;P&gt;MessageBox.Show("it continue" );&lt;BR /&gt;}&lt;BR /&gt;catch (Autodesk.AutoCAD.Runtime.Exception ex)&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show(ex.ToString() );&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;i tried&amp;nbsp;doc.LispEnded += new EventHandler(OnLispEnded);&lt;/P&gt;&lt;P&gt;but i did not help&lt;/P&gt;&lt;P&gt;(setq JS (SSGET (LIST '(0 . "LINE,ARC,POLYLINE"))))&lt;/P&gt;&lt;P&gt;so it give the Message ("it continue" ) before ssget&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jul 2024 12:01:49 GMT</pubDate>
    <dc:creator>ashrafa33</dc:creator>
    <dc:date>2024-07-23T12:01:49Z</dc:date>
    <item>
      <title>Load lisp app from c# code and wait until it finish</title>
      <link>https://forums.autodesk.com/t5/net-forum/load-lisp-app-from-c-code-and-wait-until-it-finish/m-p/12910639#M3216</link>
      <description>&lt;P&gt;i have a lsp app that select lines and get there proerties and save them to file&lt;/P&gt;&lt;P&gt;i want to run this app from c# code&lt;/P&gt;&lt;P&gt;but when i run it from c# code the c# countine working and when it read the txt file it found it empty&amp;nbsp;&lt;/P&gt;&lt;P&gt;after while the file will have the lines properties from lisp file&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 15:59:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/load-lisp-app-from-c-code-and-wait-until-it-finish/m-p/12910639#M3216</guid>
      <dc:creator>ashrafa33</dc:creator>
      <dc:date>2024-07-21T15:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Load lisp app from c# code and wait until it finish</title>
      <link>https://forums.autodesk.com/t5/net-forum/load-lisp-app-from-c-code-and-wait-until-it-finish/m-p/12910778#M3217</link>
      <description>&lt;P&gt;Should others reading your post guess what your code does?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Post your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have to define a C:XXXX command function in your LISP file that runs the operation, and then call it from the &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_ApplicationServices_Core_Application_Invoke_ResultBuffer" target="_blank" rel="noopener"&gt;Application.Invoke()&lt;/A&gt; method. You also have to call (vl-acad-defun) to register your command function so that it can be called by Invoke().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 18:22:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/load-lisp-app-from-c-code-and-wait-until-it-finish/m-p/12910778#M3217</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-07-21T18:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Load lisp app from c# code and wait until it finish</title>
      <link>https://forums.autodesk.com/t5/net-forum/load-lisp-app-from-c-code-and-wait-until-it-finish/m-p/12914371#M3218</link>
      <description>&lt;P&gt;Document doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;Editor ed = doc.Editor;&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;doc.SendStringToExecute("(load \"test.lsp\") ", true, false, false);&lt;BR /&gt;doc.SendStringToExecute("test_to_start" + "\n", true, false, false);&lt;BR /&gt;doc.LispEnded += new EventHandler(OnLispEnded);&lt;/P&gt;&lt;P&gt;MessageBox.Show("it continue" );&lt;BR /&gt;}&lt;BR /&gt;catch (Autodesk.AutoCAD.Runtime.Exception ex)&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show(ex.ToString() );&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;i tried&amp;nbsp;doc.LispEnded += new EventHandler(OnLispEnded);&lt;/P&gt;&lt;P&gt;but i did not help&lt;/P&gt;&lt;P&gt;(setq JS (SSGET (LIST '(0 . "LINE,ARC,POLYLINE"))))&lt;/P&gt;&lt;P&gt;so it give the Message ("it continue" ) before ssget&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 12:01:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/load-lisp-app-from-c-code-and-wait-until-it-finish/m-p/12914371#M3218</guid>
      <dc:creator>ashrafa33</dc:creator>
      <dc:date>2024-07-23T12:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Load lisp app from c# code and wait until it finish</title>
      <link>https://forums.autodesk.com/t5/net-forum/load-lisp-app-from-c-code-and-wait-until-it-finish/m-p/12914980#M3219</link>
      <description>&lt;P&gt;That code will not work (post code using the insert code button on the toolbar).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SendStringToExecute() does not execute the string until after the managed code that calls it returns. You can't wait for it.&amp;nbsp; You can use Application.Invoke() to call the LISP if you define it as a C:XXXX command function and use (vl-acad-defun) to register it.&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 16:46:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/load-lisp-app-from-c-code-and-wait-until-it-finish/m-p/12914980#M3219</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-07-23T16:46:33Z</dc:date>
    </item>
  </channel>
</rss>

