LISP routine

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

  1. bbates115

    bbates115

    Joined:
    Jul 17, 2017
    Messages:
    6
    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
  2. bbates115

    rkmcswain

    Joined:
    Apr 20, 2018
    Messages:
    8
    Likes Received:
    0
    What is QAFLAGS set to?
     
    rkmcswain, Apr 20, 2018
    #2
  3. bbates115

    bbates115

    Joined:
    Jul 17, 2017
    Messages:
    6
    Likes Received:
    0

    It is set to 16.
     
    bbates115, Apr 27, 2018
    #3
  4. bbates115

    rkmcswain

    Joined:
    Apr 20, 2018
    Messages:
    8
    Likes Received:
    0
    Set it to zero (0).
    Working with non-zero values for this sysvar is generally only for specialized tasks and debugging.
     
    rkmcswain, Apr 27, 2018
    #4
  5. bbates115

    bbates115

    Joined:
    Jul 17, 2017
    Messages:
    6
    Likes Received:
    0
    I am still getting the same error message
     
    bbates115, Apr 27, 2018
    #5
  6. bbates115

    rkmcswain

    Joined:
    Apr 20, 2018
    Messages:
    8
    Likes Received:
    0
    Can you determine which line (of code) the routine fails on?
     
    rkmcswain, Apr 30, 2018
    #6
  7. bbates115

    bbates115

    Joined:
    Jul 17, 2017
    Messages:
    6
    Likes Received:
    0
    i am not sure how to do that.
     
    bbates115, Apr 30, 2018
    #7
  8. bbates115

    rkmcswain

    Joined:
    Apr 20, 2018
    Messages:
    8
    Likes Received:
    0
    Do you mind sharing the block? I can only test the lisp so far, since I don't have the DWG file it inserts and modifies.
     
    rkmcswain, Apr 30, 2018
    #8
  9. bbates115

    bbates115

    Joined:
    Jul 17, 2017
    Messages:
    6
    Likes Received:
    0
    i am trying to upload a .dwg and it will not let me. it says "The uploaded file does not have an allowed extension. "
     
    bbates115, Apr 30, 2018
    #9
  10. bbates115

    Shaggy Administrator

    Joined:
    Jun 29, 2011
    Messages:
    11
    Likes Received:
    0
    I've added dwg to the allowed extensions list, so if it's under 1MB in size it should now upload. If that doesn't work, you may need to use a file hosting site to share the file (perhaps somewhere like DropBox or similar) and the paste the link here.
     
    Shaggy, May 1, 2018
    #10
  11. bbates115

    bbates115

    Joined:
    Jul 17, 2017
    Messages:
    6
    Likes Received:
    0
    Thank you. The file is attached.
     

    Attached Files:

    bbates115, May 11, 2018
    #11
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.