pinkguju Posted September 28, 2010 Author Share Posted September 28, 2010 (edited) That works. I added the output file part. I get "malformed list on input". I don't know how to fix it. I've tried a space between lines 3 and 4 as well as putting it in other locations. What am i missing? (defun c:Test (/ ss) (vl-load-com) (if (setq f (getfiled "Output File" "" "xls" 1)) (if (setq ss (ssget "_X" '((0 . "DIMENSION") (-4 . "<NOT") (1 . "") (-4 . "NOT>")))) ((lambda (i n / lst e) (while (> (setq n (1- n)) 0) (setq lst (cons n lst))) (while (setq e (ssname ss (setq i (1+ i)))) (setq lst (vl-remove (atoi (vl-list->string (vl-remove 34 (vl-string->list (cdr (assoc 1 (entget e))))) ) ) lst ) ) ) (cond (lst (print lst))) ) -1 211 ) ) (princ) ) Edited September 28, 2010 by pinkguju Forgot the # for the code. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted September 28, 2010 Share Posted September 28, 2010 For starters, you were missing a paren. Are you using the VLIDE to check your code? I just glanced at your code, and here's a couple revisions that jumped out to me: (defun c:Test (/ f ss) (vl-load-com) (if (and (setq f (getfiled "Output File" "" "xls" 1)) (setq ss (ssget "_X" '((0 . "DIMENSION") (-4 . "<NOT") (1 . "") (-4 . "NOT>"))))) ((lambda (i n / lst e) (while (> (setq n (1- n)) 0) (setq lst (cons n lst))) (while (setq e (ssname ss (setq i (1+ i)))) (setq lst (vl-remove (atoi (vl-list->string (vl-remove 34 (vl-string->list (cdr (assoc 1 (entget e))))))) lst))) (cond (lst (print lst)))) -1 211)) (princ)) I have not tested this, so if there's something else I've overlooked, I apologize. Quote Link to comment Share on other sites More sharing options...
alanjt Posted September 28, 2010 Share Posted September 28, 2010 (defun c:Test (/ file ss) ;; Alan J. Thompson (vl-load-com) (if (and (setq file (getfiled "Output File" "" "xls" 1)) (setq ss (ssget "_X" '((0 . "DIMENSION") (-4 . "<NOT") (1 . "") (-4 . "NOT>")))) ) ((lambda (i n / lst e) (while (> (setq n (1- n)) 0) (setq lst (cons n lst))) (while (setq e (ssname ss (setq i (1+ i)))) (setq lst (vl-remove (atoi (vl-list->string (vl-remove 34 (vl-string->list (cdr (assoc 1 (entget e))))) ) ) lst ) ) ) (cond (lst (print lst) (AT:WriteToFile file lst T))) ) -1 211 ) ) (princ) ) (defun AT:WriteToFile (file lst overwrite / fo) ;; Write list to file ;; file - file to write list to (must be in form "c:\\File.txt") ;; lst - list to write to file ;; overwrite - If T, will overwrite; nil to append ;; Alan J. Thompson, 04.28.09 (if (and (vl-consp lst) (setq fo (open file (if overwrite "W" "A" ) ) ) ) (progn (foreach x lst (write-line (vl-princ-to-string x) fo)) (close fo) file ) ) ) Quote Link to comment Share on other sites More sharing options...
alanjt Posted September 28, 2010 Share Posted September 28, 2010 ; error: no function definition: AT:WRITETOFILE Scroll down and copy everything. :wink: Quote Link to comment Share on other sites More sharing options...
BlackBox Posted September 28, 2010 Share Posted September 28, 2010 Scroll down and copy everything. :wink: I deleted the post before I got your notification... I overlooked the scrollbar handle. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.