LISP routine

Discussion in 'AutoCAD' started by bbates115, Jul 17, 2017.

  1. bbates115

    bbates115

    Joined:
    Jul 17, 2017
    Messages:
    1
    Likes Received:
    0
    I have a lisp routine that brings in a title tag to the correct scale, automatically puts in the view name I want, and enters the scale I have model space set to in the scale line. It works on a new template I created, but if I try and use this routine in a older file, I will get an error that says "value must be nonzero". What do I have entered incorrect? The routine is below.

    upload_2017-7-17_6-58-22.png


    (defun c:TPLAN2017 (/ P1 P2 P3)
    (setvar "CMDECHO" 0)
    (setq CL (getvar "CLAYER"))
    (setq CS (getvar "CANNOSCALE"))
    (command "LAYER" "s" "SYMBOLS" "")
    (SETQ P1 (GETPOINT "\nSelect Center of Text Location: "))
    (SETQ SD (GETVAR "DIMTVP"))
    (IF( = SD 0.65) (setq sd (* 1.0000 (getvar "DIMLFAC"))))
    (IF( = SD 0.7) (setq sd (* 1.0000 (getvar "DIMLFAC"))))
    (SETQ SC (GETVAR "celtSCALE"))
    ( IF ( = SC 1 ) (SETQ SC "F. S."))
    ( IF ( = SC 2 ) (SETQ SC "HALF F. S."))
    ( IF ( = SC 4 ) (SETQ SC "3'' = 1'-0''"))
    ( IF ( = SC 5 ) (SETQ SC "1:5"))
    ( IF ( = SC 6 ) (SETQ SC "2'' = 1'-0''"))
    ( IF ( = SC 8 ) (SETQ SC "1 1/2'' = 1'-0''"))
    ( IF ( = SC 10 ) (SETQ SC "1:10"))
    ( IF ( = SC 12 ) (SETQ SC "1'' = 1'-0' "))
    ( IF ( = SC 15 ) (SETQ SC "1:15"))
    ( IF ( = SC 16 ) (SETQ SC "3/4'' = 1'-0''"))
    ( IF ( = SC 20 ) (SETQ SC "1:20"))
    ( IF ( = SC 24 ) (SETQ SC "1/2'' = 1'-0''"))
    ( IF ( = SC 25 ) (SETQ SC "1:25"))
    ( IF ( = SC 30 ) (SETQ SC "1:30"))
    ( IF ( = SC 32 ) (SETQ SC "3/8'' = 1'-0''"))
    ( IF ( = SC 48 ) (SETQ SC "1/4'' = 1'-0''"))
    ( IF ( = SC 50 ) (SETQ SC "1:50"))
    ( IF ( = SC 64 ) (SETQ SC "3/16'' = 1'-0''"))
    ( IF ( = SC 75 ) (SETQ SC "1:75"))
    ( IF ( = SC 96 ) (SETQ SC "1/8'' = 1'-0''"))
    ( IF ( = SC 100 ) (SETQ SC "1:100"))
    ( IF ( = SC 128 ) (SETQ SC "3/32'' = 1'-0''"))
    ( IF ( = SC 192 ) (SETQ SC "1/16'' = 1'-0''"))
    ( IF ( = SC 200 ) (SETQ SC "1:200"))

    (command "insert" "L:/R2017/2017 GRI BLOCKS/TAG-VIEW-PLAN" p1 sd sd "0")
    (command "explode" "last" )
    (command "objectscale" "last" "" "a" CS "")
    (command "objectscale" "last" "" "d" "1:1" "")


    (command "attedit" "Yes" "*" "*" "*" "last" "V" "R" CS "")
    (setvar "CLAYER" CL)
    (PRINC)
    );End of defunc C:TPLAN2017.
     
    bbates115, Jul 17, 2017
    #1
    1. Advertisements

  2. bbates115

    rkmcswain

    Joined:
    Friday
    Messages:
    5
    Likes Received:
    0
    What is QAFLAGS set to?
     
    rkmcswain, Apr 20, 2018 at 12:32 AM
    #2
    1. Advertisements

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.