Stumped by Simple Leader command

Discussion in 'AutoCAD' started by Don Reichle, Dec 23, 2004.

  1. Don Reichle

    Don Reichle Guest

    Happy Holidays to all;

    I am stumped by a "Invalid Input" for my OMON setting in the following code:

    [Lisp Code]
    (defun c:DonR08dimStdldr (/ omon)
    (setq omon (setvar "orthomode" 1)) ;set orthomode on

    (DonRdimStd08)
    (setq DonRosm (getvar "osmode"))
    (setq DonRorm (getvar "orthomode"))
    (if (not DonRal) (command "-layer" "t" "C-TEXT-DIMS" "on" "C-TEXT-DIMS"
    "m" "C-TEXT-DIMS" "c" "2" "C-TEXT-DIMS" ""))
    ;set OSNAP and ORTHOMODE to NONE
    (command "osmode" "0")
    (command "orthomode" "0")
    (command "leader" pause pause omon pause "" "" "N")

    (setvar "cmdecho" 1)

    ;return ucs to world
    (setvar "cmdecho" 0)
    (DonRucsw)
    ;set OSNAP and ORTHOMODE to previous setting
    (setvar "osmode" DonRosm)
    (setvar "orthomode" DonRorm)
    (princ)
    )
    [Lisp Code]

    I am attempting to draw the first two points of a three point leader with
    ORTHOMODE off, set ORTHOMODE on for the last point, and then return
    ORTHOMODE to its previous setting prior to starting the Leader command. In
    running the above code the first two points are set properly, then I receive
    the "Invalid Input", set the last point and the command finishes. My interim
    WA is to reach up and hit F8 prior to setting the last point.

    [Command History]
    Command: (if (not c:DonRdimStd08) (load "DonRdimStd08.lsp"))
    C:DONR08DIMSTDLDR

    Command: DonR08dimStdldr
    Dimension style is STANDARD.
    Invalid Input.
    <Ortho on> Verifying UCS set to WORLD.

    [Command History]

    Any help would be greatly appreciated.

    --
    Don Reichle
    "King Of Work-Arounds"
    Barghausen Consulting Engineers
    Kent, WA USA
    LDT3 - SP1/CD3 - SP1
    On WIN2K SP4
    Dell 1.6 Ghz P4
    512MB RAM
    NVIDIA 32MB AGP
     
    Don Reichle, Dec 23, 2004
    #1
  2. Don Reichle

    T.Willey Guest

    omon is set to 1. It is assuming that omon is a point, but it is only a value of 1. One thing you could do is just get the points then pass all three points to the leader command.

    Tim
     
    T.Willey, Dec 23, 2004
    #2
  3. Don Reichle

    Don Reichle Guest

    Thanks for the suggestion, but I'm attempting to place the leader WRT other
    entities on screen, so I want to be able to watch the relationship between
    these entities as I draw the leader. Placing three points on screen without
    the linework accompanying them kind of defeats that purpose.

    Example;
    A rectangle representing a site in a vicinity map, and the text indicating
    the rectangle is the site. The rectangle and the text are placed prior to
    the leader.

    I realize I can place the text with the leader, by using Qleader, but some
    of the folks using this may not follow that process. Some here are more
    comfortable with shall we say, "Legacy" methodology.

    --
    Don Reichle
    "King Of Work-Arounds"
    Barghausen Consulting Engineers
    Kent, WA USA
    LDT3 - SP1/CD3 - SP1
    On WIN2K SP4
    Dell 1.6 Ghz P4
    512MB RAM
    NVIDIA 32MB AGP


    value of 1. One thing you could do is just get the points then pass all
    three points to the leader command.
     
    Don Reichle, Dec 23, 2004
    #3
  4. Don Reichle

    Don Reichle Guest

    And further explanation may be useful.

    What I'm really looking for is a way to use 'ORTHOMODE - the transparent
    form while in the middle of the Leader command.

    This works during a normal step-through during the Leader command, but Lisp
    won't have anything to do with it, without the correct code.

    --
    Don Reichle
    "King Of Work-Arounds"
    Barghausen Consulting Engineers
    Kent, WA USA
    LDT3 - SP1/CD3 - SP1
    On WIN2K SP4
    Dell 1.6 Ghz P4
    512MB RAM
    NVIDIA 32MB AGP


    value of 1. One thing you could do is just get the points then pass all
    three points to the leader command.
     
    Don Reichle, Dec 23, 2004
    #4
  5. (command "leader" pause pause )(setvar "orthomode" 1)(command pause "" ""
    "N")
     
    Allen Johnson, Dec 23, 2004
    #5
  6. Don Reichle

    T.Willey Guest

    You can see the line drawin between points as you draw the points

    (setvar "orthomode" 0)
    (setq pt1 (getpoint "\n Select point: "))
    (setq pt2 (getpoint pt1"\n Select point: "))
    (setvar "orthomode" 1)
    (setq pt3 (getpoint pt2"\n Select point: "))

    Tim
     
    T.Willey, Dec 23, 2004
    #6
  7. Don Reichle

    GaryDF Guest

    Here is what I use, maybe it will help:

    Gary

    (defun ALDR_SET (/ ldrname)
    (cond
    ((>= (atoi (substr (getvar "acadver") 1 2)) 15)
    (progn
    (setvar "CMDECHO" 0)
    (setvar "DIMCLRT" 2)
    (setvar "DIMCLRD" 1)
    ;;(setvar "DIMBLK" ".")
    ;;(setvar "DIMBLK1" ".")
    ;;(setvar "DIMBLK2" ".")
    (setvar "DIMLDRBLK" ".")
    ;;(setvar "DIMLDRBLK" "")
    (cond
    ((= ARCH#UNIT "Ci")
    (setvar "DIMASZ" 0.2)
    ) ;Arrow size
    ((= ARCH#UNIT "Mm")
    (setvar "DIMASZ" 5.08)
    ) ;Arrow size
    ((= ARCH#UNIT "Cm")
    (setvar "DIMASZ" 0.508)
    ) ;Arrow size
    ((= ARCH#UNIT "Ar")
    (setvar "DIMASZ" 0.2)
    ) ;Arrow size
    ((= ARCH#UNIT "Me")
    (setvar "DIMASZ" 0.00508)
    ) ;Arrow size
    ((= ARCH#UNIT "En")
    (setvar "DIMASZ" 0.2)
    ) ;Arrow size
    )
    (setq DIMNAME (rtos (getvar "dimscale") 2 0))
    (setq ldrname (strcat "LDR-" DIMNAME))
    (cond
    ((/= (cdr (assoc 2 (tblsearch "dimstyle" ldrname))) ldrname)
    (command "dimstyle" "S" ldrname)
    )
    ((= (cdr (assoc 2 (tblsearch "dimstyle" ldrname))) ldrname)
    (command "dimstyle" "R" ldrname)
    )
    )
    )
    )
    )
    (princ)
    )

    (defun LEADER_SETTER (/ pt1 pt2 pt3)
    (setvar "CMDECHO" 0)
    (setvar "orthomode" 0)
    (setvar "osmode" 0)
    (setq pt1 (getpoint "\n* Specify leader start point *"))
    (setvar "osmode" 512)
    (setq pt2 (getpoint pt1 "\n* Specify leader break point *"))
    (setvar "orthomode" 1)
    (setq pt3 (getpoint pt2 "\n* To point *"))
    (command ".leader" pt1 pt2 pt3 "A" "" "N" "")
    (setvar "CMDECHO" 1)
    (princ)
    )

    (defun c:ALDR ()
    ;;(ARCH:F_S-VAR) ;save vars
    ;;(ARCH:CUSTOM_LAYERS-ANNO) ;create layer
    ;;(ALDR_SET) ;set leader style
    (LEADER_SETTER)
    ;;(ARCH:F_R-VAR) ;restore vars
    (princ "\n* Leader completed *")
    (princ)
    )

     
    GaryDF, Dec 23, 2004
    #7
  8. Don Reichle

    Don Reichle Guest

    PERFECT!

    Thanks, Allen.

    Sometimes its the obvious things that escape us. You just taught me
    something about Lisp.

    Have a Merry Christmas, Santa!

    --
    Don Reichle
    "King Of Work-Arounds"
    Barghausen Consulting Engineers
    Kent, WA USA
    LDT3 - SP1/CD3 - SP1
    On WIN2K SP4
    Dell 1.6 Ghz P4
    512MB RAM
    NVIDIA 32MB AGP
     
    Don Reichle, Dec 23, 2004
    #8
  9. Don Reichle

    T.Willey Guest

    Here is one I use.... very small simple and easy. Writen long ago, could be better, but it works why change.

    Tim

    (defun c:q(/ ot1 os1 pt1 pt2 pt3)

    (setq ot1(getvar "orthomode"))
    (setq os1(getvar "osmode"))
    (setvar "osmode" 0)
    (setq pt1(getpoint "\nSelect first point.."))
    (setq pt2(getpoint pt1 "\nSelect second point.."))
    (grdraw pt1 pt2 1)
    (setvar "orthomode" 1)
    (setq pt3(getpoint pt2 "\nSelect last point.."))
    (command "redraw")
    (if (= pt3 nil)
    (lead2)(lead3)
    )
    )


    (defun lead3()
    (command "leader" pt1 pt2 pt3 "" "" "n")
    (setvar "orthomode" ot1)
    (setvar "osmode" os1)
    (princ)
    )

    (defun lead2()
    (command "leader" pt1 pt2 "" "" "n")
    (setvar "orthomode" ot1)
    (setvar "osmode" os1)
    (princ)
    )
     
    T.Willey, Dec 23, 2004
    #9
  10. Don Reichle

    GaryDF Guest

    Nice one.......

    We still use a pline leader...don't ask.

    Gary


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;; Polyline Leader Routine
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;
    (defun LDRIT (/ tmp)
    (setvar "CMDECHO" 0)
    (initget "2 3 4 X")
    (setq tmp
    (getkword
    "\n* Pick Arrow Leader type: <2> Picks <3> Picks <4> Picks
    <X> CHX *"
    )
    )
    (cond
    ((= tmp "2") (LDR2IT))
    ((or (= tmp "3") (= tmp nil)) (LDR3IT))
    ((= tmp "4") (LDR4IT))
    ((= tmp "X") (CHXLDRIT))
    )
    (princ)
    )
    ;;;
    (defun LDR2IT (/ pt1 pt2 pt3)
    (ARCH:F_S-VAR)
    (setvar "CMDECHO" 0)
    ;;(ARCH:CUSTOM_LAYERS-ANNO)
    (setvar "orthomode" 0)
    (setvar "osmode" 0)
    (setq pt1 (ARCH:UPOINTX 1 "" "* Pick arrow head start point *" nil nil)
    pt2 (ARCH:UPOINTX 1 "" "* To point *" nil pt1)
    pt3 (polar pt1 (angle pt1 pt2) (* 0.2 (getvar "DIMSCALE"))) ;0.125
    )
    (setvar "osmode" 0)
    (ARCH:CUSTOM_LAYERS-ANNO-LDR)
    (command
    "PLINE"
    pt1
    "W"
    "0"
    (* 0.065 (getvar "DIMSCALE")) ;0.0417
    pt3
    "W"
    "0"
    "0"
    pt2
    )
    (command "")
    ;;(command "change" "l" "" "p" "c" "1" "")
    (ARCH:F_R-VAR)
    )
    ;;;
    (defun LDR3IT (/ pt1 pt2 pt3)
    (ARCH:F_S-VAR)
    (setvar "CMDECHO" 0)
    ;;(ARCH:CUSTOM_LAYERS-ANNO)
    (setvar "orthomode" 0)
    (setvar "osmode" 0)
    (setq pt1 (ARCH:UPOINT 1 "" "* Pick arrow head start point *" nil nil)
    pt2 (ARCH:UPOINT 1 "" "* To point *" nil pt1)
    pt3 (polar pt1 (angle pt1 pt2) (* 0.2 (getvar "DIMSCALE"))) ;0.125
    )
    (setvar "orthomode" 1)
    (ARCH:CUSTOM_LAYERS-ANNO-LDR)
    (command
    "PLINE"
    pt1
    "W"
    "0"
    (* 0.065 (getvar "DIMSCALE")) ;0.0417
    pt3
    "W"
    "0"
    "0"
    pt2
    )
    ;;(while (setq pt2 (getpoint "\n* To point *" pt2)) (command pt2))
    (setq pt2 (getpoint "\n* To point *" pt2))
    (command pt2)
    (command "")
    ;;(command "change" "l" "" "p" "c" "1" "")
    (ARCH:F_R-VAR)
    )
    ;;;
    (defun LDR4IT (/ pt1 pt2 pt3)
    (ARCH:F_S-VAR)
    (setvar "CMDECHO" 0)
    ;;(ARCH:CUSTOM_LAYERS-ANNO)
    (setvar "orthomode" 0)
    (setvar "osmode" 0)
    (setq pt1 (ARCH:UPOINT 1 "" "* Pick arrow head start point *" nil nil)
    pt2 (ARCH:UPOINT 1 "" "* To point *" nil pt1)
    pt3 (polar pt1 (angle pt1 pt2) (* 0.2 (getvar "DIMSCALE"))) ;0.125
    )
    (setvar "orthomode" 0)
    (ARCH:CUSTOM_LAYERS-ANNO-LDR)
    (command
    "PLINE"
    pt1
    "W"
    "0"
    (* 0.065 (getvar "DIMSCALE")) ;0.0417
    pt3
    "W"
    "0"
    "0"
    pt2
    )
    ;;(while (setq pt2 (getpoint "\n* To point *" pt2)) (command pt2))
    (setq pt2 (getpoint "\n* To point *" pt2))
    (command pt2)
    (setvar "orthomode" 1)
    (setq pt2 (getpoint "\n* To point *" pt2))
    (command pt2)
    (command "")
    ;;(command "change" "l" "" "p" "c" "1" "")
    (ARCH:F_R-VAR)
    )
    ;;;
    (defun LDR5IT (/ pt1 pt2 pt3)
    (ARCH:F_S-VAR)
    (setvar "CMDECHO" 0)
    ;;(ARCH:CUSTOM_LAYERS-ANNO)
    (setvar "orthomode" 0)
    (setvar "osmode" 0)
    (setq pt1 (ARCH:UPOINT 1 "" "* Pick arrow head start point *" nil nil)
    pt2 (ARCH:UPOINT 1 "" "* To point *" nil pt1)
    pt3 (polar pt1 (angle pt1 pt2) (* 0.2 (getvar "DIMSCALE"))) ;0.125
    )
    (setvar "orthomode" 0)
    (ARCH:CUSTOM_LAYERS-ANNO-LDR)
    (command
    "PLINE"
    pt1
    "W"
    "0"
    (* 0.065 (getvar "DIMSCALE")) ;0.0417
    pt3
    "W"
    "0"
    "0"
    pt2
    )
    ;;(while (setq pt2 (getpoint "\n* To point *" pt2)) (command pt2))
    (setq pt2 (getpoint "\n* To point *" pt2))
    (command pt2)
    (setq pt2 (getpoint "\n* To point *" pt2))
    (command pt2)
    (setvar "orthomode" 1)
    (setq pt2 (getpoint "\n* To point *" pt2))
    (command pt2)
    (command "")
    ;;(command "change" "l" "" "p" "c" "1" "")
    (ARCH:F_R-VAR)
    )
    ;;;
    (defun LDRCIT (/ pt1 pt2 pt3)
    (ARCH:F_S-VAR)
    (setvar "CMDECHO" 0)
    ;;(ARCH:CUSTOM_LAYERS-ANNO)
    ;;(setq tempsnap (getvar "osmode"))
    (setvar "osmode" 0)
    (setq pt1 (ARCH:UPOINT 1 "" "Pick arrow head point" nil nil)
    pt2 (ARCH:UPOINT 1 "" "To point" nil pt1)
    pt3 (polar pt1 (angle pt1 pt2) (* 0.125 (getvar "DIMSCALE")))
    )
    (setvar "orthomode" 0)
    (ARCH:CUSTOM_LAYERS-ANNO-LDR)
    (command
    "PLINE"
    pt1
    "W"
    "0"
    (* 0.0417 (getvar "DIMSCALE"))
    pt3
    "W"
    "0"
    "0"
    "arc"
    )
    ;;(while (setq pt2 (getpoint "\nTo point: " pt2)) (command pt2))
    (setq pt2 (getpoint "\nTo point: " pt2))
    (command pt2)
    ;;(setvar "osmode" tempsnap)
    (command "")
    ;;(command "change" "l" "" "p" "c" "1" "")
    (ARCH:F_R-VAR)
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; UPOINT Function
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;sorry forgot the original author
    (defun ARCH:UPOINT (bit kwd msg def bpt / inp)
    (setvar "CMDECHO" 0)
    (if def
    (setq pts (strcat (rtos (car def))
    ","
    (rtos (cadr def))
    (if (and (caddr def) (= 0 (getvar "FLATLAND")))
    (strcat "," (rtos (caddr def)))
    ""))
    msg (strcat "\n" msg " <" pts ">: ")
    bit (* 2 (fix (/ bit 2))))
    (setq msg (strcat "\n" msg " ")))
    (initget bit kwd)
    (setq inp (if bpt
    (getpoint msg bpt)
    (getpoint msg)))
    (if inp
    inp
    def))



    better, but it works why change.
     
    GaryDF, Dec 23, 2004
    #10
  11. Don Reichle

    T.Willey Guest

    LOL... sometimes it's whatever works.

    Tim
     
    T.Willey, Dec 23, 2004
    #11
  12. Don Reichle

    Don Reichle Guest

    Thanks to all who shared.

    Merry Christmas to all.

    --
    Don Reichle
    "King Of Work-Arounds"
    Barghausen Consulting Engineers
    Kent, WA USA
    LDT3 - SP1/CD3 - SP1
    On WIN2K SP4
    Dell 1.6 Ghz P4
    512MB RAM
    NVIDIA 32MB AGP
     
    Don Reichle, Dec 23, 2004
    #12
  13. Don Reichle

    T.Willey Guest

    As long as you get it to work, it's all good.

    Merry Christmas to you also, and anyone that reads this, and Happy New Years.

    Tim
     
    T.Willey, Dec 23, 2004
    #13
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.