New routine returns NIL

Discussion in 'AutoCAD' started by shortems, Jul 27, 2004.

  1. shortems

    shortems Guest

    I have been working on the following routine for part of today with the help of this site have been pretty sugesful. The routine runs and works all the way through. I am however getting a NIL towards the end of the line. Here is the routine:

    ^C^C(setq scale (getreal "Scale Factor: "))(command "-insert" "J:/Library/Symbols/Architectural/Tags/ele-mark.dwg" pause scale "" pause)(command "-insert" "J:/Library/Symbols/Architectural/Tags/elesec-att.dwg" (getvar "lastpoint") scale "" "0" );

    the last insert is an attribute and at the end it asks to insert the attribute fields what happens is the follow:

    angle <0d0'0">: 0
    Enter attribute values
    DETAIL <??>: nil
    DETAIL <??>:
    SHEET NUMBER <??.??>:

    I am unclear why the nil happens. now I have attempted different things. I have removed the second insert and attempt this routine with just one insert and I sill get a nil at the end. that nil comes on the next command line, and i am able to continue to work without a problem. I have removed the semi-colon at the end and I still get nil.

    Any suggestions would be greatly appreciated.
     
    shortems, Jul 27, 2004
    #1
  2. A lisp function always returns returns a value. The Command lisp function returns nil.
    To avoid the nil, use (princ) at the end of your lisp routines.

    Try this instead:

    ^C^C(progn (setq scale (getreal "Scale Factor: "))(command "-insert"
    "J:/Library/Symbols/Architectural/Tags/ele-mark.dwg" pause scale "" pause)(command "-insert"
    "J:/Library/Symbols/Architectural/Tags/elesec-att.dwg" (getvar "lastpoint") scale "" "0" ) (princ));




    been pretty sugesful. The routine runs and works all the way through. I am however getting a NIL
    towards the end of the line. Here is the routine:
    "J:/Library/Symbols/Architectural/Tags/ele-mark.dwg" pause scale "" pause)(command "-insert"
    "J:/Library/Symbols/Architectural/Tags/elesec-att.dwg" (getvar "lastpoint") scale "" "0" );
    insert and attempt this routine with just one insert and I sill get a nil at the end. that nil comes
    on the next command line, and i am able to continue to work without a problem. I have removed the
    semi-colon at the end and I still get nil.
     
    Allen Johnson, Jul 27, 2004
    #2
  3. shortems

    dblaha Guest

    It looks like a block you're inserting contains multiple attributes. AutoCAD is expecting you to supply values for the attributes when you insert the block. If you don't want to assign values to the attributes when you insert the block, you can make AutoCAD not ask for the values by setting the ATTREQ sysvar to 0.

    (setvar "attreq" 0)

    Set it to 1 to turn the automatic request back on when you're done.
     
    dblaha, Jul 27, 2004
    #3
  4. shortems

    ECCAD Guest

    Replace the ";" on the end with (princ)

    Bob
     
    ECCAD, Jul 27, 2004
    #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.