+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Full Member
    Using
    AutoCAD 2007
    Join Date
    Sep 2006
    Posts
    30

    Default What am I doing wrong?

    I'm trying to have a lisp run and set the variable "shtscale" by checking against another variable "dimscale" and to output something from a list ex: FULL, or 6" = 1'-0". I keep getting an "unknown command" error.

    Code:
    (defun dwgscale ()
    (getvar dimscale)
    (setq shtscale
       (cond
          ((= dimscale 1) (princ "FULL")) 
          ((= dimscale 2) (princ "6''= 1'-0''"))
          ((= dimscale 4) (princ "3''= 1'-0''"))
          ((= dimscale 8) (princ "1 1/2''= 1'-0''")) 
          ((= dimscale 12) (princ "1''= 1'-0''"))
          ((= dimscale 16) (princ "3/4''= 1'-0''"))
          ((= dimscale 24) (princ "1/2''= 1'-0''"))
          ((= dimscale 32) (princ "3/8''= 1'-0''"))
          (nil (princ "None")) 
        ))
    )

  2. #2
    Full Member
    Using
    AutoCAD 2005
    Join Date
    Oct 2006
    Posts
    27

    Default

    Registered forum members do not see this ad.

    I made some changes - if you don't use the c: after defun you need to type (dwgscale).

    Code:
    (defun c:dwgscale (/ dimscale output)
          (setq dimscale (getvar "dimscale"))
    
          (setq output (cond
                 ((= dimscale 1) "FULL")
                 ((= dimscale 2) "6''= 1'-0''")
                 ((= dimscale 4) "3''= 1'-0''")
                 ((= dimscale 8) "1 1/2''= 1'-0''")
                 ((= dimscale 12) "1''= 1'-0''")
                 ((= dimscale 16) "3/4''= 1'-0''")
                 ((= dimscale 24) "1/2''= 1'-0''")
                 ((= dimscale 32) "3/8''= 1'-0''")
                 (t "None")
               )
          )
          (princ output)
          (princ)
    )
    Last edited by nauggie; 10th Jan 2008 at 05:24 pm.

Similar Threads

  1. Trying to figure out what is wrong
    By Luvrbcs in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 13th Nov 2007, 05:56 pm
  2. What's wrong?
    By whteglve in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 15th Nov 2006, 07:22 pm
  3. Where Did I Go Wrong
    By The Wizard in forum AutoCAD 3D Modelling & Rendering
    Replies: 10
    Last Post: 31st Aug 2006, 03:49 am
  4. what is wrong
    By domepizzle in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 14th Oct 2005, 12:32 pm
  5. What's wrong?
    By Baçon in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 10th May 2005, 10:30 pm

Bookmarks

Posting Permissions

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