michaeloureiro Posted December 17, 2008 Posted December 17, 2008 hey everybody, just tried to reload a lisp routine and i get this at the command prompt: error: no function definition:c can anybody help? thanks Quote
Lee Mac Posted December 17, 2008 Posted December 17, 2008 Could be an error in the LISP, post the LISP and I'll have a look. Quote
michaeloureiro Posted December 17, 2008 Author Posted December 17, 2008 Tip2090: MARRAY.LSP Modified Array Command © 2006 Paul Hinds (defun c:MARRAY () ;MULTIPLE EQUAL ARRAY BETWEEN 2 POINTS (setq SS (ssget)) (setq P1 (getpoint "\nArray from point:")) (setq P2 (getpoint p1 "\nTo point :")) (setq dis (distance p1 p2)) (princ "\nDistance ") (princ dis) (initget (+ 1 2 4)) (setq SPACE (getint "\nNumber of SPACES:")) (SETQ SPA (/ DIS SPACE)) (princ "Space between ") (princ spa) (setq ANG (angle p1 p2)) (setq dist1 (distance p1 p2)) (setq dist (/ dist1 space)) (setq counter space) ;body (command "undo" "be") (while (> counter 0) (command "copy" ss "" p1 (polar p1 ang (* dist counter))) (setq counter (- counter 1)) ) (command "undo" "e") ) Quote
michaeloureiro Posted December 17, 2008 Author Posted December 17, 2008 it worked the first time. Quote
Lee Mac Posted December 17, 2008 Posted December 17, 2008 Try this: (defun c:MARRAY (/ ss p1 p2 dis space spa ang counter) ;MULTIPLE EQUAL ARRAY BETWEEN 2 POINTS (setvar "cmdecho" 0) (setq SS (ssget)) (if (and (setq P1 (getpoint "\nArray from point:")) (setq P2 (getpoint p1 "\nTo point :")) ) ;_ end and (progn (setq dis (distance p1 p2)) (princ (strcat "\nDistance " (rtos dis))) (initget (+ 1 2 4)) (setq space (getint "\nNumber of SPACES:")) (setq spa (/ dis space)) (princ (strcat "Space between " (rtos spa))) (setq ang (angle p1 p2) counter 1 ) ;_ end setq (while (<= counter space) (command "copy" ss "" p1 (polar p1 ang (* dis counter))) (setq counter (+ counter 1)) ) ;_ end while ) ;_ end progn (alert "Two Point are Needed.") ) ;_ end if (setvar "cmdecho" 1) (princ) ) ;_ end defun Quote
michaeloureiro Posted December 17, 2008 Author Posted December 17, 2008 lee mac, this is my first lisp, you´re gonna have to help me out on this one... how do is save the above text as a lisp file... thanks Quote
michaeloureiro Posted December 17, 2008 Author Posted December 17, 2008 lee mac, tried it and got this: ; error: bad argument type: numberp: nil Quote
Lee Mac Posted December 17, 2008 Posted December 17, 2008 It seems to work fine for me, but I'll see if I can simplify it. Quote
Lee Mac Posted December 17, 2008 Posted December 17, 2008 Try this: (defun c:MARRAY (/ ss p1 p2 space dis ang counter) (defun *error* (msg) (setvar "cmdecho" 1) (if (= msg "") (princ "\nFunction Complete.") (princ "Error or Esc pressed...") ) ;_ end if (princ) ) ;_ end defun (setvar "cmdecho" 0) (setq ss (ssget)) (if (and (setq p1 (getpoint "\nArray from point:")) (setq p2 (getpoint p1 "\nTo point :")) (> (setq space (getint "\nNumber of SPACES:")) 0) ) ;_ end and (progn (setq dis (distance p1 p2) ang (angle p1 p2) counter 1 ) ;_ end setq (while (<= counter space) (vl-cmdf "_copy" ss "" p1 (polar p1 ang (* dis counter))) (setq counter (1+ counter)) ) ;_ end while ) ;_ end progn ) ;_ end if (*error* "") (princ) ) ;_ end defun Quote
michaeloureiro Posted December 17, 2008 Author Posted December 17, 2008 leemac, it doesn´t seem to be arraying along the selected line, but arraying to the length of the line. image on top: result image below: pretended result Quote
Lee Mac Posted December 17, 2008 Posted December 17, 2008 Well, thats what the LISP was set to do previously, so I assumed that it what you wanted. Quote
Lee Mac Posted December 17, 2008 Posted December 17, 2008 try this then. (defun c:MARRAY (/ ss p1 p2 space dis ang counter spc) (defun *error* (msg) (setvar "cmdecho" 1) (if (= msg "") (princ "\nFunction Complete.") (princ "Error or Esc pressed...") ) ;_ end if (princ) ) ;_ end defun (setvar "cmdecho" 0) (setq ss (ssget)) (if (and (setq p1 (getpoint "\nArray from point:")) (setq p2 (getpoint p1 "\nTo point :")) (> (setq space (getint "\nNumber of SPACES:")) 0) ) ;_ end and (progn (setq dis (distance p1 p2) ang (angle p1 p2) counter 1 spc (/ dis space) ) ;_ end setq (while (<= counter space) (vl-cmdf "_copy" ss "" p1 (polar p1 ang (* spc counter))) (setq counter (1+ counter)) ) ;_ end while ) ;_ end progn ) ;_ end if (*error* "") (princ) ) ;_ end defun Quote
michaeloureiro Posted December 17, 2008 Author Posted December 17, 2008 thanks for the help lee mac, it was working and for some reason it didn´t, i´ll have to do this one manually, thanks again for your time, Quote
michaeloureiro Posted December 17, 2008 Author Posted December 17, 2008 didn´t work either, objects overlap at the end of the line.... Quote
michaeloureiro Posted December 17, 2008 Author Posted December 17, 2008 is there a reason why it only worked the first time? Quote
michaeloureiro Posted December 17, 2008 Author Posted December 17, 2008 here´s where i got it http://cadtips.cadalyst.com/2d-operations/modified-array-command Quote
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.