Jump to content

load error


michaeloureiro

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • michaeloureiro

    14

  • Lee Mac

    9

Popular Days

Top Posters In This Topic

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")

)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

 

<a href=errorya6.th.png' alt='errorya6.th.png'>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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,

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...