Command Alias for Circle Tan Tan Tan?

Discussion in 'AutoCAD' started by Chris Chiles, Sep 14, 2004.

  1. Chris Chiles

    Chris Chiles Guest

    I use the circle options TTR and TTT alot. I am making a lisp routine to
    setup aliases for those comands (2p and 3p as well). Because Circle Tan Tan
    Tan is not an option in the cirlce command I can't figure out how to do it.

    Here is what I have:

    ;Circle - Tangent Tangent Radius
    (defun C:ct ()
    (command "circle" "t" )
    (princ))

    ;Circle - 2 Point
    (defun C:c2 ()
    (command "circle" "2p" )
    (princ))

    ;Circle - 3 Point
    (defun C:c3 ()
    (command "circle" "3p" )
    (princ))

    ;Circle - Tangent Tangent Tangent
    (defun C:ctt ()
    (command "circle" "3p" (getpoint "tan")(getpoint "tan")(getpoint "tan")
    (princ))

    I don't know much about lisp, but do my best.

    Any help would be much appreciated.

    Chris
     
    Chris Chiles, Sep 14, 2004
    #1
  2. Here's the macro used by the menu:

    ^C^C_circle _3p _tan \_tan \_tan \
     
    Frank Oquendo, Sep 14, 2004
    #2
  3. Chris Chiles

    Chris Chiles Guest

    Yea, I tried inserting that into my lisp - but it didn't work for me. Maybe
    I am doing something wrong.
     
    Chris Chiles, Sep 14, 2004
    #3
  4. It's not going to be a direct drop-in. You'll need to set up the tangent
    snap and use the pause function to acquire user input.
     
    Frank Oquendo, Sep 14, 2004
    #4
  5. Chris Chiles

    T.Willey Guest

    What Frank gave was a menu macro not a lisp. In lisp you could do this.

    (defun c:CTT(/ oos1)
    (setq oos1 (getvar "osmode"))
    (setvar "osmode" 256)
    (command "_.circle" "_3p" pause pause pause)
    (setvar "osmode" oos1)
    (princ)
    )

    or

    (defun c:CTT (/ pt1 pt2 pt3 oos1)
    (setq oos1 (getvar "osmode"))
    (setvar "osmode" 256)
    (setq pt1 (getpoint "\n Select first tangent point: "))
    (setq pt2 (getpoint "\n Select second tangent point: "))
    (setq pt3 (getpoint "\n Select third tangent point: "))
    (if (and pt1 pt2 pt3)
    (command "_.circle" "_3p" pt1 pt2 pt3)
    )
    (setvar "osmode" oos1)
    (princ)
    )

    I would prefer the second one.

    Tim
     
    T.Willey, Sep 14, 2004
    #5
  6. Chris Chiles

    Chris Chiles Guest

    OK - TIM - That all makes sense. Like Isaid I don't know much about
    writting lisps, but I'm trying to learn on the fly.

    Thanks!
    Chris
     
    Chris Chiles, Sep 14, 2004
    #6
  7. Chris Chiles

    T.Willey Guest

    Chris,

    No problem, happy to help. This NG has been one of the most beneficial learning places for me, so when I can help I like to, as do almost all people here.

    Tim
     
    T.Willey, Sep 14, 2004
    #7
  8. Chris Chiles

    GaryDF Guest

    Thanks, I can make use of this to.

    Gary

    learning places for me, so when I can help I like to, as do almost all people
    here.
     
    GaryDF, Sep 14, 2004
    #8
  9. Chris Chiles

    Jürg Menzi Guest

    Hi Tim

    It's recommendable to check each user input and add error handling...¦-)
    Code:
    (defun C:CTTT ( / pt1 pt2 pt3 ocmd oos1 *Error*)
    (setq oos1 (getvar "OSMODE")
    ocmd (getvar "CMDECHO")
    )
    (defun *Error* (Msg)
    (setvar "OSMODE" oos1)
    (setvar "CMDECHO" ocmd)
    (if Msg (princ Msg))
    (princ)
    )
    (setvar "OSMODE" 256)
    (cond
    ((not (setq pt1 (getpoint "\nSelect 1st tangent point: "))))
    ((not (setq pt2 (getpoint "\nSelect 2nd tangent point: "))))
    ((not (setq pt3 (getpoint "\nSelect 3rd tangent point: "))))
    (T
    (setvar "CMDECHO" 0)
    (command "_.CIRCLE" "_3P" pt1 pt2 pt3)
    )
    )
    (*Error* nil)
    )
    
    Cheers
     
    Jürg Menzi, Sep 15, 2004
    #9
  10. You can avoid having to mess with osmode by putting it in the command call:
    (command "._circle" "_3P" "_tan" PAUSE "_tan" PAUSE "_tan" PAUSE)
    But, as shown in Jürg's function, you may still want to suppress cmdecho.
     
    Cliff Middleton, Sep 15, 2004
    #10
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.