.NET

Reply
Active Contributor
jimmie_fulton
Posts: 44
Registered: ‎04-06-2005
Message 1 of 6 (674 Views)

acedPostCommand

674 Views, 5 Replies
02-13-2006 08:20 AM
Does anyone have any pointers on exposing acedPostCommand? I'm not very pinvoke savy, but it seems like it should be straight forward. Here's what I've got (but AutoCAD dies when I use it):

[DllImport(@"C:\ObjectARX 2006\lib\acad.lib", CallingConvention = CallingConvention.Cdecl,EntryPoint="acedPostCommand")]
public extern static bool PostCommand(String command);
*Tony Tanzillo
Message 2 of 6 (674 Views)

Re: acedPostCommand

02-13-2006 08:39 AM in reply to: jimmie_fulton
Well, you're importing from a static library (acad.lib).

Try importing from acad.exe

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

wrote in message news:5084540@discussion.autodesk.com...
Does anyone have any pointers on exposing acedPostCommand? I'm not very pinvoke savy, but it seems like it should be straight forward. Here's what I've got (but AutoCAD dies when I use it):

[DllImport(@"C:\ObjectARX 2006\lib\acad.lib", CallingConvention = CallingConvention.Cdecl,EntryPoint="acedPostCommand")]
public extern static bool PostCommand(String command);
Active Contributor
jimmie_fulton
Posts: 44
Registered: ‎04-06-2005
Message 3 of 6 (674 Views)

Re: acedPostCommand

02-13-2006 09:13 AM in reply to: jimmie_fulton
That was the first thing I tried, which also caused AutoCAD to puke.

[DllImport(@"acad.exe", CallingConvention = CallingConvention.Cdecl,EntryPoint="acedPostCommand")]
public extern static int PostCommand(String command);

Is this function in acad.exe? A previous post that you made to the ARX group is where I got the idea to try the .lib file (I'm not a c++ programmmer, so I don't know anything about those; thought they were kinda close to a .dll).

What I'm trying to do is evaluate lisp expressions from within .Net, in case you have any other suggestions. SendStringToExecute won't work, as my app runs several expressions in a loop (loading lisp files). This causes the command buffer to be exceeded. My next option is to try ads_queueexpr.
*Tony Tanzillo
Message 4 of 6 (674 Views)

Re: acedPostCommand

02-13-2006 11:33 AM in reply to: jimmie_fulton
> What I'm trying to do is evaluate lisp expressions from within .Net

Why? What can't you do in .NET that you need to use LISP for?

acedPostCommand() is not going to help you because it is also
asynchronus (e.g., just like SendStringToExecute() ).

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

wrote in message news:5084638@discussion.autodesk.com...
That was the first thing I tried, which also caused AutoCAD to puke.

[DllImport(@"acad.exe", CallingConvention = CallingConvention.Cdecl,EntryPoint="acedPostCommand")]
public extern static int PostCommand(String command);

Is this function in acad.exe? A previous post that you made to the ARX group is where I got the idea to try the .lib file (I'm not a c++ programmmer, so I don't know anything about those; thought they were kinda close to a .dll).

What I'm trying to do is evaluate lisp expressions from within .Net, in case you have any other suggestions. SendStringToExecute won't work, as my app runs several expressions in a loop (loading lisp files). This causes the command buffer to be exceeded. My next option is to try ads_queueexpr.
Active Contributor
jimmie_fulton
Posts: 44
Registered: ‎04-06-2005
Message 5 of 6 (674 Views)

Re: acedPostCommand

02-13-2006 02:34 PM in reply to: jimmie_fulton
Why? You asked...

I work at a very large architecture firm and we have lots of custom tools and scripts (old, new, third party, etc). All of our tools and scripts are located on a central file server in each office. We wanted a consistent way of loading them into AutoCAD, and we also wanted to be able to update them across multiple offices even while the tools are in use. I've developed a tool that autoloads the latest version of a tool, reguardless of whether its VBA, ARX, .Net, EXE, or LSP. We can deploy the latest version of a tool into a new versioned folder without worrying about locked file issues. The next time the user loads AutoCAD, they get the latest version or each tool loaded. This enables drag and drop deployment of any type of autocad custom tool. I can also disable a specific tool version, rollback to a previous version, or load a specific version. CAD managers don't need to rewrite menu files, update the registry, update acad.lsp, or wait until architects go home at one in the morning so they can get past locked file issues.

I've got everything working great with the exception of Lisp files (I'm using acedCmd). Obviously, lisp files don't have the locking issue, but it would be nice if I can load them with the same versioning mechanism. I wrote a simple version of this in lisp to load lisp files (once again, drag and drop deployment), but I wanted to expand on this and I much prefer .Net to do this.

So, examples of using this tool:
netload "S:\CAD\MyCompany.AutoCAD.AutoLoader.dll"
autoload ADDpath "S:\CAD\CustomTools"
autoload ALL
autoload ARX ALL
autoload EXE SampleUtility
autoload ARX SampleTool/01.00
autoload NET SampleDotNetTool

So what can't .Net do??? From what I can tell, it can't load a list of lisp files without crashing autocad do to SendStringToExecute behavior.

Thanks for the info on acedPostCommand. It looks like I might be stuck with having an independant lisp loader written in lisp.
*Tony Tanzillo
Message 6 of 6 (674 Views)

Re: acedPostCommand

02-13-2006 08:18 PM in reply to: jimmie_fulton
Loading LISP from an ARX (native or .NET) does not work
universally, because the LSP file that's loaded can do just
about anything, for example (command "._undefine" ...),
which would fail in that case.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

wrote in message news:5085091@discussion.autodesk.com...
Why? You asked...
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.