<?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: Can you do an APPLOAD from a C# program? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/5824185#M38713</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From .NET, you can use SendStringToExecute() to load your LISP files.&lt;/P&gt;
&lt;P&gt;SENL 1362 reply focuses on the string format of the LISP expression to pass to the SendStringToExecute() method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the same path example (C:\Temp\x.lsp), it can be written:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;doc.SendStringToExecute("(load \"C:\\\\Temp\\\\x.lsp\") ", false, false, true);&lt;/PRE&gt;
&lt;P&gt;or:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;doc.SendStringToExecute(@"(load ""C:\\Temp\\x.lsp"") ", false, false, true);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, you have to keep in mind SendStringToExecute() runs asynchronously, and a .NET app is loaded once per session while a LISP function have to be loaded in each document.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By my side I won't load LISP files from .NET but use some &lt;A href="http://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-Customization/files/GUID-FDB4038D-1620-4A56-8824-D37729D42520-htm.html" target="_blank"&gt;LISP auto loading mechanism&lt;/A&gt; instead.&lt;/P&gt;</description>
    <pubDate>Sat, 19 Sep 2015 09:01:28 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2015-09-19T09:01:28Z</dc:date>
    <item>
      <title>Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/5810305#M38710</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I have some AutoLisp functions that I use in conjunction with my .NET c# program. Is there a way to load them from the C# program. Right now I'm using APPLOAD before I run my dll, but it occurs to me that I might be able to load them from the dll. Any suggestions? Code samples?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thanks,&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~Vonnie A.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 02:37:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/5810305#M38710</guid>
      <dc:creator>ganderson</dc:creator>
      <dc:date>2015-09-10T02:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/5810421#M38711</link>
      <description>is this what you are loooking after:&lt;BR /&gt;var lispPathname="c:\temp\x.lsp".Replace('\','/');&lt;BR /&gt;var loadLispCmd=string.format("(load {0} {1}",Quote(lispPathname),Quote("Failed to load Lisp"));&lt;BR /&gt;doc.SendStringToExecute(loadLispCmd);&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;public static string Quote(string str)&lt;BR /&gt;{&lt;BR /&gt;string quoted = string.Format("\"{0}\"", str);&lt;BR /&gt;return quoted;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 10 Sep 2015 06:15:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/5810421#M38711</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2015-09-10T06:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/5824116#M38712</link>
      <description>&lt;P&gt;Not sure I understand your code. Is public static string Quote(string str) what I call to load the lisp program? I understand the var statements, I just don't see the call.&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; Thanks for the help,&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~Giovonnae&lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2015 03:53:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/5824116#M38712</guid>
      <dc:creator>ganderson</dc:creator>
      <dc:date>2015-09-19T03:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/5824185#M38713</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From .NET, you can use SendStringToExecute() to load your LISP files.&lt;/P&gt;
&lt;P&gt;SENL 1362 reply focuses on the string format of the LISP expression to pass to the SendStringToExecute() method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the same path example (C:\Temp\x.lsp), it can be written:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;doc.SendStringToExecute("(load \"C:\\\\Temp\\\\x.lsp\") ", false, false, true);&lt;/PRE&gt;
&lt;P&gt;or:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;doc.SendStringToExecute(@"(load ""C:\\Temp\\x.lsp"") ", false, false, true);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, you have to keep in mind SendStringToExecute() runs asynchronously, and a .NET app is loaded once per session while a LISP function have to be loaded in each document.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By my side I won't load LISP files from .NET but use some &lt;A href="http://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-Customization/files/GUID-FDB4038D-1620-4A56-8824-D37729D42520-htm.html" target="_blank"&gt;LISP auto loading mechanism&lt;/A&gt; instead.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2015 09:01:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/5824185#M38713</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2015-09-19T09:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12250815#M38714</link>
      <description>&lt;P&gt;Hello Folks, I swear yesterday my code was working and I was able to load .FAS files on command from my dll file. Can anyone see in my code what could be wrong I keep getting the error message VLA-OBJECT nil&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[CommandMethod("LoadFAS")]&lt;BR /&gt;public void LoadFAS()&lt;BR /&gt;{&lt;BR /&gt;Document doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;Editor ed = doc.Editor;&lt;/P&gt;&lt;P&gt;string getpathdynamically = doc.Name;&lt;BR /&gt;string FasFolder = "FAS Dateien";&lt;BR /&gt;string relativePath = Path.Combine(Path.GetDirectoryName(getpathdynamically), FasFolder);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;string[] FasFiles = new string[]&lt;BR /&gt;{&lt;BR /&gt;"KARISDAT_DB64",&lt;BR /&gt;"KARISDAT_INF64",&lt;BR /&gt;"KARISDAT_DB64",&lt;BR /&gt;"KARISDAT_INF64",&lt;BR /&gt;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;foreach (string fileName in FasFiles)&lt;BR /&gt;{&lt;BR /&gt;string filePath = Path.Combine(relativePath, fileName + ".FAS");&lt;/P&gt;&lt;P&gt;ed.WriteMessage("\nFILEPATH: " + filePath);&lt;/P&gt;&lt;P&gt;if (File.Exists(filePath))&lt;BR /&gt;{&lt;BR /&gt;filePath = ReplaceBackslashes(filePath);&lt;BR /&gt;doc.SendStringToExecute($"(load \"{filePath}\") ", false, false, true);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;ed.WriteMessage("\nThe file does not exist.");&lt;BR /&gt;Application.ShowAlertDialog($"The file '{filePath}' does not exist.");&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 12:49:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12250815#M38714</guid>
      <dc:creator>erdem_babayigit</dc:creator>
      <dc:date>2023-09-19T12:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12250819#M38715</link>
      <description>string ReplaceBackslashes(string input)&lt;BR /&gt;{&lt;BR /&gt;return input.Replace("\\", "\\\\");&lt;BR /&gt;}</description>
      <pubDate>Tue, 19 Sep 2023 12:50:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12250819#M38715</guid>
      <dc:creator>erdem_babayigit</dc:creator>
      <dc:date>2023-09-19T12:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12251160#M38716</link>
      <description>&lt;P&gt;The SendStringToExecute() is executed asyncly, as&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;mentioned in previous reply. That means, it only gets called AFTER your command method ends, thus, only one of the *.FAS file is loaded. That is, you CANNOT run SendStringToExecye() inside a "for/do/while" loop, unless there is only one loop and the loop is the LAST statement of your command method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 15:08:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12251160#M38716</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-09-19T15:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12251238#M38717</link>
      <description>&lt;P&gt;nicely explained!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 15:35:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12251238#M38717</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-09-19T15:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12252743#M38718</link>
      <description>&lt;P&gt;I must say I am very surprised and very happy that we do get such a quick response to a question to a post thats 8 years old, for me it was just a shot into the blue, but here we go! I shall edit the code and report here soon! Best wishes, from Germany, Erdem.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 06:59:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12252743#M38718</guid>
      <dc:creator>erdem_babayigit</dc:creator>
      <dc:date>2023-09-20T06:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12252787#M38719</link>
      <description>&lt;P&gt;Dismissing the loop for now or dll script for now, when I simply put the command (load "C:\\Karisdat\\FAS Dateien\\Karisdat_db64.fas") into the autocad command line; I get following ERROR message:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Command: (load "C:\\Karisdat\\FAS Dateien\\Karisdat_db64.fas")&lt;BR /&gt;; Error: ActiveX-Server returns: Error loading type library/DLL&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 07:18:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12252787#M38719</guid>
      <dc:creator>erdem_babayigit</dc:creator>
      <dc:date>2023-09-20T07:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12252790#M38720</link>
      <description>&lt;P&gt;the file definitely exist btw&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 07:19:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12252790#M38720</guid>
      <dc:creator>erdem_babayigit</dc:creator>
      <dc:date>2023-09-20T07:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can you do an APPLOAD from a C# program?</title>
      <link>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12252998#M38721</link>
      <description>&lt;P&gt;Okay it seems I found out why, when opening another version of autocad ( MAP 2020 ) it does work and asks me if I want to load it. So now I wonder if there is purge feature, or some other debugging issues, or perhaps it has to do with which drawing I'm loading?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 08:53:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/can-you-do-an-appload-from-a-c-program/m-p/12252998#M38721</guid>
      <dc:creator>erdem_babayigit</dc:creator>
      <dc:date>2023-09-20T08:53:10Z</dc:date>
    </item>
  </channel>
</rss>

