Results 1 to 3 of 3

Thread: ; error: bad function: (5136.4 1645.08 0.0)

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2021-10
    Posts
    1
    Login to Give a bone
    0

    Default ; error: bad function: (5136.4 1645.08 0.0)

    hi there
    i have a problem while typing nt command autocad draw last points ...
    Code:
    (defun cdrs (key lst / pair rtn)
      (while (setq pair (assoc key lst))
        (setq rtn (cons (cdr pair) rtn)
    	  lst (cdr (member pair lst))
        )
      )
      (reverse rtn)
    )
    ;;;***********************************************************************************
    (defun c:pp ()
      (setq r (getdist "\nSpecify radius of circles: "))
      (setq s (entsel "\nSelect Polyline: "))
      (setq point (cdrs 10 (entget (car s))))
      (setq polen (length point))
      (foreach x point (command "point" x))
      (foreach x point (command "circle" x r))
    					;(setq polenst (itoa polen))
    
      ;;(alert (strcat "number of points is: " polenst))
      ;;(princ)
    )
    (defun c:nt ()
        (setq ss (ssget))
      (setq sn (entget (ssname ss 0)))
      (setq nameobj (cdr (assoc 0 sn)))
      (if (= nameobj "LWPOLYLINE")
        ((setq point (cdrs 10 (entget (car ss))))
          (setq polen (length point))
          (foreach x point (command "point" x))
        )
        ((setq start (cdr (assoc 10 sn))
    	   end	 (cdr (assoc 11 sn))
         )
         (setq plist (list start end))
         (foreach x plist (command "point" x))
        )
      )
      (princ nameobj)
      (princ)
    )
    Last edited by BlackBox; 2021-10-08 at 11:23 AM. Reason: Please use [CODE] Tags

  2. #2
    Member
    Join Date
    2000-11
    Posts
    3
    Login to Give a bone
    0

    Default Re: ; error: bad function: (5136.4 1645.08 0.0)

    Use progn to separate the true and false parts of an if statement.
    Code:
    (defun c:nt ()
      (setq ss (ssget))
      (setq sn (entget (ssname ss 0)))
      (setq nameobj (cdr (assoc 0 sn)))
      (if (= nameobj "LWPOLYLINE")
        (progn
          (setq point (cdrs 10 (entget (car ss))))
          (setq polen (length point))
          (foreach x point (command "point" x))
        )
        (progn
          (setq start (cdr (assoc 10 sn))
               end (cdr (assoc 11 sn))
          )
          (setq plist (list start end))
          (foreach x plist (command "point" x))
        )
      )
      (princ nameobj)
      (princ)
    )
    Last edited by BlackBox; 2021-10-10 at 04:54 PM. Reason: Please use [CODE] Tags

  3. #3
    Member
    Join Date
    2010-10
    Location
    Việt Nam
    Posts
    43
    Login to Give a bone
    0

    Default Re: ; error: bad function: (5136.4 1645.08 0.0)

    You miss function name after "(" in If state part, and wrong argument in "(car ss)"
    Maybe use sth like this, i guess

    Code:
    (defun c:nt (/ e ss)
    	(if 
    		(setq ss (ssget '((0 . "LWPOLYLINE,LINE"))))
    		(while 
    			(setq e (ssname ss 0))			
    			(mapcar 
    				'(lambda(point)
    					(command "point" "_non" point)
    				)
    				(append (cdrs 10 (entget e))(cdrs 11 (entget e)))
    			)
    			(setq ss (ssdel e ss))
    		)
    	)
    )

Similar Threads

  1. Replies: 8
    Last Post: 2012-01-28, 10:01 PM
  2. error: bad function: 180
    By DijitalB in forum AutoLISP
    Replies: 7
    Last Post: 2012-01-23, 02:33 PM
  3. LISP routine returning bad function error
    By playerdraft in forum AutoLISP
    Replies: 2
    Last Post: 2011-06-15, 04:38 PM
  4. Bad function "1" error message
    By fletch97 in forum AutoLISP
    Replies: 1
    Last Post: 2007-04-06, 12:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •