custom lisp error "stringp"

Discussion in 'AutoCAD' started by erickson123, Jul 14, 2004.

  1. erickson123

    erickson123 Guest

    hi all,

    i am running r2004 land desktop......
    i am trying to use the following routine (after drawing a line for storm drain, i use the routine and it changes the line to a polyline at the width i choose (size of pipe) and changes it to hidden and adds to outside lines, it is how we show our storm drain lines)

    ;; DR.LSP Storm Drain convertion lisp command.
    ;;
    ;; Converts any line, or arc into a storm drain.
    ;;
    ;;***************************************************************************
    ;;
    (defun rtd ( r )
    (* 180 (/ r pi))
    )
    ;;
    (defun C:DR (/ ctr size newsize wid ss n e1 rad ang pta ptb disp1 disp2)
    (brstart)
    (command "ucs" "w")
    (setq ctr 0)
    (if (= oldsize nil)
    (setq oldsize 24.0)
    )
    (princ (strcat "\nPipe size in inches <"(rtos oldsize) ">: "))
    (setq newsize (getreal))
    (if newsize (setq oldsize newsize))
    ;
    (setq size (/ oldsize 24.0)
    wid (- (* 2.0 size) 0.2))
    ;;
    ;;
    (setq ss ;; select lines or arcs
    (ssget '((-4 . "<or") (0 . "line")
    (0 . "arc") (-4 . "or>"))))
    ;;
    (if ss
    (progn
    (while (setq n (ssname ss ctr))
    (if (= "ARC" (cdr (assoc 0 (entget n))))
    (progn
    (setq e1 (entget n)
    rad (assoc 40 e1))
    (entmake (subst (cons '40 (+ size (cdr rad))) rad e1))
    (entmake (subst (cons '40 (- (cdr rad) size)) rad e1))
    ) ;; end progn
    (progn ;; else
    (setq pta (cdr (assoc 10 (entget n)))
    ptb (cdr (assoc 11 (entget n)))
    ang (angle pta ptb)
    disp1 (strcat "@" (rtos size) "<" (rtos (+ 90 (rtd ang))))
    disp2 (strcat "@" (rtos size) "<" (rtos (- (rtd ang) 90))))
    (command "._copy" n "" '(0 0) disp1 )
    (command "._copy" n "" '(0 0) disp2 )
    ) ;; end progn
    ) ;; end if
    (command "._change" n "" "p" "lt" "hidden" "")
    (command "._pedit" n "y" "w" wid "")
    (setq ctr (1+ ctr))
    ) ;; end while
    ) ;; end progn
    (princ "\n No entities selected. ")
    ) ;; end if
    (brend "OK")
    ;;
    (princ)
    ) ;; end defun


    ANYWAY, after i run the routine, this happens:

    Command: dr

    Pipe size in inches <8>:

    Select objects: 1 found

    Select objects:

    Invalid option keyword.
    ; error: An error has occurred inside the *error* functionbad argument type:
    stringp nil

    Enter an option [Close/Join/Width/Edit vertex/Fit/Spline/Decurve/Ltype
    gen/Undo]:

    ______the routine is stopping when it wants the width of the polyline, (maybe it's not setting the value in the first part of the routine?)

    additional info: this routine works on all other computers in the office, but i have added a few other things on my machine, like toolpac, but it does work on my machine when i bring up R2000. and, just so you know my knowledge of lisp writing and understanding is writing very simple 2key one-line routines.

    thanks very much.
     
    erickson123, Jul 14, 2004
    #1
  2. erickson123

    ECCAD Guest

    Try commenting out:
    (brstart)
    And:
    (brend "OK")

    Bob
     
    ECCAD, Jul 14, 2004
    #2
  3. erickson123

    erickson123 Guest

    well, after trying more things i found something.....changing my profile back to the standard one fixed the problem. the only difference i have is the added "support file search path" for toolpac. I can move back and forth between profiles easily, but if that rings any bells for anyone let me know. Thanks.
     
    erickson123, Jul 14, 2004
    #3
  4. erickson123

    Don I Guest

    It sounds like SOMETHING that toolpac redefines/undefines a command that
    your routine uses. When you use the profile that includes TP, TP does the
    Redefine/Undefine action.

    --

    RDI

    (remove the exclamation from the email address)

    back to the standard one fixed the problem. the only difference i have is
    the added "support file search path" for toolpac. I can move back and forth
    between profiles easily, but if that rings any bells for anyone let me know.
    Thanks.
     
    Don I, Jul 15, 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.