Rotate line to zero

Discussion in 'AutoCAD' started by Big 'D', May 6, 2004.

  1. Big 'D'

    Big 'D' Guest

    I am cleaning up some scanned translations and am seeking some assistance. I am looking for a command someone may have to rotate a selected line (or lines) to an angle of zero. If anyone has anything like this, it would be most appreciated.
    Thank you,
    D
     
    Big 'D', May 6, 2004
    #1
  2. Big 'D'

    David Bethel Guest

    What you are asking is doable, just not practical.

    What started out as this:

    /
    /
    /
    /
    /


    Will end up like this:

    -
    -
    -
    -
    -
    -



    In ASCII -David
     
    David Bethel, May 6, 2004
    #2
  3. Big 'D'

    Big 'D' Guest

    Thanks for your response.
    In my circumstance, it would be quite pratical. More than / becoming - it would be used to change lines with just a slight angle to zero. The key factor is that these are translated files from tif images so there are many lines that are slightly off zero degrees and it would be more effecient to just select the line and set to zero than to go through the chain of commands to rotate to zero.
     
    Big 'D', May 6, 2004
    #3
  4. Big 'D'

    Joe Burke Guest

    D,

    Here's something tossed together a few months ago intended to do what I think you are
    talking about. Tossed together means not much error checking and/or just intended for
    my use.

    The idea is the user provides an angle range value. If the range is one degree, any
    line selected within one degree of horizontal or vertical is modified appropriately.

    Joe Burke

    (defun c:FixLineAngles ( / range ss idx vobj startpt endpt ang )
    (while (not (< 0 range (* pi 0.25)))
    (initget 5)
    (setq range (getangle "\nEnter angle range between 0 and 45 degrees: "))
    )
    (setq ss (ssget (list (cons 0 "LINE"))))
    (setq idx 0)
    (if ss
    (repeat (sslength ss)
    (setq vobj (vlax-ename->vla-object (ssname ss idx)))
    (setq startpt (vlax-get vobj 'StartPoint))
    (setq endpt (vlax-get vobj 'EndPoint))
    (setq ang (vlax-get vobj 'Angle))
    (cond
    ;modify y value
    ((or
    (< 0 ang range)
    (> (* pi 2) ang (- (* pi 2) range))
    (> pi ang (- pi range))
    (< pi ang (+ pi range))
    )
    (vlax-put vobj 'EndPoint
    (list (car endpt) (cadr startpt) (caddr endpt)))
    )
    ;modify x value
    ((or
    (> (* pi 0.5) ang (- (* pi 0.5) range))
    (< (* pi 0.5) ang (+ (* pi 0.5) range))
    (> (* pi 1.5) ang (- (* pi 1.5) range))
    (< (* pi 1.5) ang (+ (* pi 1.5) range))
    )
    (vlax-put vobj 'EndPoint
    (list (car startpt) (cadr endpt) (caddr endpt)))
    )
    )
    (setq idx (1+ idx))
    )
    ) ;if
    (princ)
    ) ;end


    looking for a command someone may have to rotate a selected line (or lines) to an
    angle of zero. If anyone has anything like this, it would be most appreciated.
     
    Joe Burke, May 6, 2004
    #4
  5. Big 'D'

    Big 'D' Guest

    This is what I have to rotate text to zero angle. How do I make this select lies also or change it and create a different command for lines?

    (DEFUN C:ut(/ p l n e new as)
    (command "undo" "be")
    (prompt "\nSelect Text to rotate")
    (setq p (ssget))
    (setq n (sslength p))
    (setq l 0)
    (setq entit (cdr (assoc 0 (setq e (entget (ssname p l))))))
    (while (< l n)
    (if (OR (= "TEXT" entit)(= "MTEXT" entit))
    (progn
    (setq s (cdr (setq as (assoc 50 e))))
    (setq new (cons 50 0))
    (setq e (subst new (cons 50 s) e))
    (entmod e)
    (setq l (1+ l))
    );PROGN
    );IF
    );WHILE
    (command "undo" "END")
    );defun
     
    Big 'D', May 6, 2004
    #5
  6. Big 'D'

    Big 'D' Guest

    Wow! Thanks Joe! Even more than I expected. You just made my day!!!
     
    Big 'D', May 6, 2004
    #6
  7. Big 'D'

    Joe Burke Guest

    D,

    Glad to hear that's what you were looking for.

    Joe Burke
     
    Joe Burke, May 6, 2004
    #7
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.