Run Lisp App After Loading Drawing Using VL-Open
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Run Lisp App After Loading Drawing Using VL-Open

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
Coyote
Guest





Posted: Thu Dec 30, 2004 1:24 am    Post subject: Run Lisp App After Loading Drawing Using VL-Open Reply with quote

Below Is a small application I've been working on and either I'm suffering from to much hoiliday excitement or I'm just not understanding.

All I'm wanting to do is run a lisp program, (getmknums), on a series of drawings seleccted by the user. The drawings will load but I can't get the application to run on any drawing in the foreach loop. Below is my code and I'll appreciate any help you may be able to provide.

(defun C:samtest ()
(vl-load-com)
(setq FileLst (dos_getfilem "Select Connection Sheets To Retrieve" "C:\\" "Drawing Files (*.DWG)|2_*.dwg"))
;;; The line Above Prompts User to Select Dwgs To Create List (Result Ex: = "C:\\ABC-1234\\" "2_01.dwg" "2_05.dwg")
(setq ProjFldr (car Filelst)) ; Sets Variable To The Project Folder (Result Ex: "C:\\ABC-1234\\")
(setq DwgList (cdr Filelst)) ; Sets Variable for Dwg List (Result Ex: "2_01.dwg" "2_05.dwg")
(foreach d DwgList ; Create A Loop To Run The Code Below On Each Dwg In The List
(setq CurDwg (strcat ProjFldr d)) ; Sets Variable For Dwg To Be Opened (Result Ex: = "C:\\ABC-1234\\2_01.dwg")
;(Setq NextDwg (VLA-OPEN (VLA-GET-DOCUMENTS (VLAX-GET-ACAD-OBJECT)) Curdwg) ); Set Variable and Opens Dwg
;(C:getmknums)
(vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) CurDwg))
(vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) (strcat "(command \"_.OPEN\")\n" Curdwg "\n"))
(C:getmknums)
; THE LINE ABOVE IS MY PROBLEM. I HAVE A LISP FILE ALREADY LOADED THAT USES "GETMKNUMS" TO RUN IN AUTOCAD FROM THE
; COMMAND PROMPT AND WHAT I WANT TO DO IS RUN THIS LISP APPLICATION ON EVERY DWG IN MY LIST.
(vla-close CurDwg :vlax-true) ; This Saves The Drawing
); End Foreach
); End Defun

Thanks in Advance,
Coyote

Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Contact Us
Powered by phpBB