function not defined error

Discussion in 'AutoCAD' started by Matthew Gonzalez, Feb 19, 2005.

  1. Hello all, I am getting this error:

    error: no function definition: VAL

    When running this function:

    (defun c:xrefclr ();(/ xref_lyr)
    (setq xref_lyr (val 2 (entget (Car (entsel "\nSelect an XREF to
    change color:" )))))
    (setq clr (getstring "\nEnter New Color (1-255): "))
    (if xref_lyr
    (progn
    (command "-layer" "c" clr (strcat xref_lyr "*") "")
    (setq xref_lyr nil)
    )))


    It's supposed to let you select the Xref which it then changes all
    layers of to whatever color you input. It worked fine at my previous
    place of employment, we use Acad2004 and Acad2005 at both places.

    This is actually part of a larger routine so if you need more context
    just let me know, I'm trying not to post too much code for someone to
    peruse through quickly :) . Thanks!



    Matthew
     
    Matthew Gonzalez, Feb 19, 2005
    #1
  2. Matthew Gonzalez

    T.Willey Guest

    Try this. Put it in the same lisp file as your lisp, so that it will load when the other one loads.

    (defun val (DxfCode EntData /)
    (cdr (assoc DxfCode EntData))
    )

    Tim
     
    T.Willey, Feb 19, 2005
    #2
  3. No go, thanks though. It gives me the same error. Do you think it's
    trying to get the second half of a dotted pair?



    Matthew
     
    Matthew Gonzalez, Feb 19, 2005
    #3
  4. I apologize, I had the routine in two different places and added your
    code to the wrong one. When I added it to the correct one, it works
    just dandy. Thanks extremely!




    Matthew
     
    Matthew Gonzalez, Feb 19, 2005
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.