Automate the Command in Autocad using Lisp

Automate the Command in Autocad using Lisp

Anonymous
Not applicable
1,452 Views
7 Replies
Message 1 of 8

Automate the Command in Autocad using Lisp

Anonymous
Not applicable
I have added the below code into the acad2007doc.lsp file . This works fine . It is taking the DLL automatically but it is not taking the command name (IMAGESAMPLE) automatically. I had to type the command name manually in the autocad, then the command works.

(defun c:IMAGESAMPLE()
(command "netload" "C:\\Documents and Settings\\skabeer\\My Documents\\Visual Studio 2005\\Projects\\Insertimage\\Insertimage\\bin\\Release\\Insertimage.dll" "IMAGESAMPLE")
(princ)
)




Can anybody please help to solve this problem...

Thanks,
0 Likes
1,453 Views
7 Replies
Replies (7)
Message 2 of 8

Hallex
Advisor
Advisor
Just add this line (c:IMAGESAMPLE) after:



(defun c:IMAGESAMPLE()(command "netload" "C:\\Documents and Settings\\skabeer\\My Documents\\Visual Studio 2005\\Projects\\Insertimage\\Insertimage\\bin\\Release\\Insertimage.dll" "IMAGESAMPLE")

(princ)

(c:IMAGESAMPLE)



~'J'~ Edited by: hallex on Jan 23, 2009 7:26 AM
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes
Message 3 of 8

Anonymous
Not applicable
I really appreciate your mentality to help others. Thanks a lot. I will try this tomorrow from the office & let u know the result...

Thanks,
0 Likes
Message 4 of 8

Anonymous
Not applicable
Thanks a lot. This is working fine... Edited by: shezak on Jan 26, 2009 8:03 AM
0 Likes
Message 5 of 8

Anonymous
Not applicable
This is working fine. Thanks a lot Edited by: shezak on Jan 26, 2009 8:02 AM
0 Likes
Message 6 of 8

Anonymous
Not applicable
Thanks for your support... Edited by: shezak on Jan 26, 2009 8:04 AM
0 Likes
Message 7 of 8

Anonymous
Not applicable
Hello,
Thanks a lot. Now this is working fine. When i am opening the autocad, i can see the command automated and it shows my image on opening itself...

But i do have another issue now, when i am trying to open the dwg file from within dotnet application using the interop namespace. The dwg file is opened and am getting the below message:
-------------------------------------------------------------------------------------------------------------------
Opening an AutoCAD 2007 format file.
Regenerating model.
AutoCAD Express Tools Copyright © 2002-2004 Autodesk, Inc.
AutoCAD menu utilities loaded.netload Assembly file name: C:\Documents and
Settings\skabeer\My Documents\Visual Studio
2005\Projects\IMAGESIZING\IMAGESIZING\bin\Release\IMAGESIZING.dll RASTINS
Unknown command "RASTINS". Press F1 for help.
Autodesk DWG. This file is a Trusted DWG last saved by an Autodesk application
or Autodesk licensed application.
-------------------------------------------------------------------------------------------------------------------------

Can you please help me to solve this issue?
Thanks...
0 Likes
Message 8 of 8

Anonymous
Not applicable
Hi Shezak

I tried the above solution and found its working but at the same time noticed that my command method is being called twice one after another.

Please do let me know if you you also face same issue.

Regards,
0 Likes