Run Lisp App After Loading Drawing Using VL-Open

Discussion in 'AutoCAD' started by Coyote, Dec 29, 2004.

  1. Coyote

    Coyote Guest

    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
     
    Coyote, Dec 29, 2004
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.