+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Senior Member Cadastrophic's Avatar
    Using
    not specified
    Join Date
    Dec 2002
    Location
    Australia
    Posts
    152

    Default Problem with rotation in lisp routine.

    Registered forum members do not see this ad.

    I've been having a ball this weekend since discovering that handy routine to attach lisps to buttons.
    I have a query with one of the lisps I found: Basically, the lisp places sequential numeric callouts inside circles on the end of straight leaders. perfect for what I want. The only problem is, when it places the number inside the circle, it appears rotated 90 degrees anticlockwise. I can see in the lisp that it refers to "polar p2" which presumably is the culprit, but I'm not brave enough to play with the code. Can any of you geniuses help with the number rotation.
    Can anyone point to something I can change to correct the direction of rotation?
    In AutoCAD, I have my base angle set to North and Direction is set to Clockwise.
    Here's the code as I've loaded it:

    (defun c:B1 ()
    (setvar "cmdecho" 0)
    (setvar "attdia" 0)
    (setvar "texteval" 1)
    (setq os (getvar "osmode"))
    (setvar "orthomode" 0)
    (setq pt1 (getpoint "Pick starting point:"))
    (command "line" pt1 pause "")
    (setq pt2 (getvar "lastpoint"))
    (setq rang (angle pt1 pt2))
    (setq ang (/ rang 0.017453))
    (setq dsc (getvar "dimtxt"))
    (setq pt3 (polar pt2 rang (* dsc 1.2903)))
    (if (<= inc 100)
    (progn
    (setvar "osmode" 1024)
    (command "circle" pt3 (* dsc 1.2903))
    (command "text" "m" pt3 dsc "0" (itoa inc))
    (command "donut" "0.001" (* 0.25 dsc) pt1 "")
    (setq inc (+ inc 1))
    )
    )
    (setvar "osmode" os)
    (setvar "orthomode" 1)
    )
    I'm sure you said "Hurry up and DELETE your work".

    AutoCAD 2004, Inventor 8.
    AMD Athlon 64 FX-55, 3GB RAM, NVIDIA Quadro4 980XGL, Windows XP Pro.

  2. #2
    Forum Deity
    Using
    not specified
    Join Date
    Jul 2004
    Location
    Anchorage, Alaska
    Posts
    2,074

    Default

    Again you could avoid this problem by setting angular base& direction to the default. But to answer your question, the problem is in this line:

    (command "text" "m" pt3 dsc "0" (itoa inc))

    The "0" angle typically produces horizontal text but since you have 0 set to North it becomes vertical text. Change "0" to "90" to get it to work in the "Cadastrophic" angular system

  3. #3
    Senior Member Cadastrophic's Avatar
    Using
    not specified
    Join Date
    Dec 2002
    Location
    Australia
    Posts
    152

    Default

    Registered forum members do not see this ad.

    Thanks CarlB. I know my set up may seem odd, but I'm self-taught. I just always pictured the compass like a clock, so I set zero to north and have the direction set as clockwise.
    I'm sure you said "Hurry up and DELETE your work".

    AutoCAD 2004, Inventor 8.
    AMD Athlon 64 FX-55, 3GB RAM, NVIDIA Quadro4 980XGL, Windows XP Pro.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts