Jump to content
arunr_18

Error: too few arguments

Recommended Posts

Consider this modification on this code for the rest of your routines .

 

(defun c:wtt (/ p1 p2 ss f l a b c d c1 t1 d1 t2 t3 txt)
 (if (and (setq p1 (getpoint "Point :\n:"))
          (setq p2 (getcorner p1 "Other corner :\n:"))
          (setq ss (ssget "_W" p1 p2 '((0 . "*TEXT"))))
          (if (not (setq f (open "d:\\coords.csv" "w")))
            (progn (alert "Can not open Excel file !!") nil)
            t
          )
     )
   (repeat (setq l (sslength ss))
     (setq a   (ssname ss (setq l (1- l)))
           b   (entget a)
           c   (assoc 10 b)
           d   (assoc 1 b)
           c1  (cdr c)
           t1  (rtos (car c1) 2 3)
           d1  (cdr d)
           t2  (rtos (cadr c1) 2 3)
           t3  (rtos (caddr c1) 2 3)
           txt (strcat t1 "," t2 "," t3 "," d1)
     )
     (write-line txt f)
   )
 )
 (if f
   (close f)
 )
 (princ)
)

Share this post


Link to post
Share on other sites
Sorry sir but i didnt get u ...wat u want to say..

 

That is the reason why you get the error message .. too few arguments.

 

Consider this

 

(defun c:wtx()
(if  (and
          (setq p1 (getpoint "\nFirst corner :"))
          (setq p2 (getcorner p1 "\n: Other corner :"))
          (setq ss (ssget "w" p1 p2 [b][color="#4169e1"]'((0 . "INSERT")[/color][/b])))
          (setq l (sslength ss)  n 0)
         [b][color="#4169e1"] (setq fto (findfile "coords.csv"))[/color][/b]
          (print l)
          )
           (progn
                 (setq f (open fto "w"))
                 (repeat l
                       (setq a   (ssname ss n)
                             b   (entget a)
                             c   (assoc 10 b)
                             d   (assoc 2 b)
                             c1  (cdr c)
                             t1  (rtos (car c1) 2 3)
                             d1  (cdr d)
                             t2  (rtos (cadr c1) 2 3)
                             t3  (rtos (caddr c1) 2 3)
                             txt (strcat t1 "," t2 "," t3 "," d1)
                             n   (+ n 1)
                             )
                       (write-line txt f)
                       )
                 [b][color="#4169e1"](close f)[/color][/b]);<--- your error fix
           )
     [b](startapp "Notepad" fto)[/b]
     (princ)
)

Share this post


Link to post
Share on other sites
Thank you sir..:)

 

Sir can u give me a lisp for preparing Longitudinal section

 

Ehh... are your replying to me or Tharwat?

Share this post


Link to post
Share on other sites
You are opening the .csv file with notepad ;)

 

Yes, its still basically a text file.

Share this post


Link to post
Share on other sites
Sir can u give me a lisp for preparing Longitudinal section

 

I have no idea about this section , so can you please post an image of that section or a drawing ?

Share this post


Link to post
Share on other sites
I have no idea about this section , so can you please post an image of that section or a drawing ?
Yes, it would be good to have DWGs with both before and after, that is, what you start with and what you hope to end up with. Also, arunr_18, you did not really say what your functions were for. Are they intended to prepare the section you mention? BTW, I noticed that the file name is the same in two of them, but is on a different drive for the other. All of them open the file for writing, which means any previous data would be overwritten. Also, in any case WT would overwrite WTT, & vice versa. I mention this just to make sure that is your intention.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×