Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (vl-load-com)
- (defun c:writetextfile ( / des txt ) ;; Define function, declare local variables
- (if (setq txt "S:\\Projekt\\SOA-91373_Vipan, Hus C\\21 OR\\TESTA.txt") ;; Prompt user for filename/filepath
- (foreach lay (layoutlist)
- (setvar "ctab" lay)
- (setq tab (getvar "ctab"))
- (setq ss (ssget "x" '((0 . "TEXT,MTEXT")(8 . "QR"))))
- (setq text (vla-get-TextString ss))
- (if (setq des (open txt "a")) ;; Attempt to create text file with given filename/filepath
- (progn ;; Evaluate the enclose expressions as the 'then' expression for the IF statement
- (write-line text des) ;; Write line of text to text file
- (close des) ;; Close file descriptor
- ) ;; end PROGN
- (princ "\nUnable to create text file.") ;; Else the text file could not be created
- ) ;; end IF
- )
- (princ "\n*Cancel*") ;; Else the user pressed Cancel
- ) ;; end IF
- (command-s "Layout" "set" "MODEL")
- (princ) ;; Suppress the return of the last evaluated expression
- ) ;; end DEFUN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement