Calling a DLL from AutoLisp

Calling a DLL from AutoLisp

GeeHaa
Collaborator Collaborator
3,269 Views
8 Replies
Message 1 of 9

Calling a DLL from AutoLisp

GeeHaa
Collaborator
Collaborator

Hi,

 

Im trying to Call a DLL from autolisp. The DLL is supposed to draw some plines. The program works if it is called from the toolbar. But If I try to define a function with a 3 letter command to run it. It runs and asks for the selection sets but does not draw anything. all the  windows pop up as expected and the program finishes with no apparent errors. I know I could take an easy way out and just name my dll the two letter command but I'm curious as to why this doesn't work. I call other dll's from the S::startup  and they work fine but none of them are required to draw anything. Can anyone shed some light on this.

 

Thanks,

0 Likes
Accepted solutions (1)
3,270 Views
8 Replies
Replies (8)
Message 2 of 9

DannyNL
Advisor
Advisor

What is the macro syntax behind the button in your toolbar/ribbon?

You can check this in the CUI and see how the command is run by pressing the button.

0 Likes
Message 3 of 9

GeeHaa
Collaborator
Collaborator

Thanks for the response.

 

Here is the Syntax from the CUI

 ^C^C(Command "NetLoad"(STRCAT(GETENV "ProgramData")"/Autodesk/ApplicationPlugins/TBars.Bundle/Contents/DotNet/DLINE.dll" ));DLine;

 

The program to create the Shortcut Looks Like this.

(defun c:DL ()
(Command "NetLoad"(STRCAT(GETENV "ProgramData")"/Autodesk/ApplicationPlugins/TBars.Bundle/Contents/DotNet/DLINE.dll" ))
(command "DLINE")
)

Note for Others: When NetLoading DLLs like this It doesn't like spaces in the program Name

0 Likes
Message 4 of 9

_gile
Consultant
Consultant

Hi,

 

There's something I do not understand: why do you need to NETLOAD a DLL from a bundle folder?

Won't it be automatically loaded according to the PackageContents.xml LoadReasons (LoadOnAutoCADStartup="True")? If so, the commands defined in the DLL can be used as native commands in the whole AutoCAD session.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 5 of 9

GeeHaa
Collaborator
Collaborator

I know this is possible. I have other programs being loaded this way along with a CUIX file,But I haven't taken the time to decipher XML plus I don't know where to find a good book on it. It seems every time I mess with PackageContents.XML something goes wrong and it doesn't load. Do you by chance know a good book on the subject that could show me the does and don'ts of the syntax.

 

Thanks for your response

0 Likes
Message 6 of 9

_gile
Consultant
Consultant
Accepted solution

You can have a look at the Autodesk Autoloader White Paper.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 7 of 9

GeeHaa
Collaborator
Collaborator

Thanks Again This should do fine.

0 Likes
Message 8 of 9

dgorsman
Consultant
Consultant

@GeeHaa - here's a handy link for general XML (along with XSL, XSD, and a host of other stuff):

 

https://www.w3schools.com/

 

These days, knowing the basics of XML is pretty much a requirement for anyone dealing with program configuration, data exchange, and programming in general.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 9 of 9

GeeHaa
Collaborator
Collaborator

This explanation is awesome I thought it was some kind of programming language. Instead its just a way to structure data for a program to read. This explains the syntax and everything. Thank You Very Much!

0 Likes