Author Topic: LISP not working, help needed  (Read 1479 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
LISP not working, help needed
« on: September 28, 2007, 01:03:32 PM »
I just cant get it to work.
this code reads a text file of previously opened dwgs.
what im looking to do is open the selected dwg.
it highlights the dwg fine and unless i specify the dwg in the code, it doesnt
work.
can someone help me get it to where it will open the dwg thats selected

thanks for any and all help

Code: [Select]
(setq DCL (load_dialog "history"))
(defun READFILE (/ FILE A)
   (setq FILE (open TXTFILE "r"))
   (while (setq A (read-line FILE)) (setq TXTLIST (cons A TXTLIST)))
  ;while
   (close FILE)
   (setq TXTLIST (reverse TXTLIST))
   (DCL_LIST)
) ;readfile

;;
(defun DCL_LIST ()
   (new_dialog "history" DCL)
   (start_list "txtlist")
   (mapcar 'add_list TXTLIST)
   (end_list)
) ;dcl_list
;;

(defun opn ()
(setq fqnName "F:\\dwgs\\job\\A-12966.dwg")  <--- this is where it needs to
read the selected dwg not a set dwg
(command "._VBAStmt" (strcat "AcadApplication.Documents.Open \"" fqnName
"\"")
)

)

(defun C:history ()

   (setvar "cmdecho" 0)
(setq fDATE (menucmd "M=$(edtime,$(getvar,date), MON DD YYYY)"))
(SETQ txtlist NIL)
(setq TxtFile (strcat "c:\\dwg-history" fdate ".txt"))
(setq Opened (open TxtFile "r"))
   (READFILE)
   (set_tile "txtlist" "0")
   (setq PICK "0")
   (set_tile "filename" TXTFILE)
   (action_tile "txtlist" "(setq pick $value)")
   (action_tile "dwg" "(done_dialog 1)")
   (action_tile "cancel" "(done_dialog 0)")
   (setq BUTTON (start_dialog))
   (cond ((= BUTTON 1) (opn))
   ) ;cond
)

(princ)

<edit: code tags added by CAB>
its not a DCL file
« Last Edit: September 28, 2007, 01:59:54 PM by andrew_nao »

JohnK

  • Administrator
  • Seagull
  • Posts: 10658
Re: advanced help needed
« Reply #1 on: September 28, 2007, 01:06:39 PM »
...help with the subject line of your post?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org