-x mirror from pt2

Discussion in 'AutoCAD' started by Jon Baker, Jun 1, 2004.

  1. Jon Baker

    Jon Baker Guest

    I need an if statement and I have no idea how to create one..
    okay.. I pick point 1 and then point 2, I have code that will give me the mid point between these two points so I can insert text there. but what I need is if point 2 has a negative x value from point 1 I want to mirror the inserted text using point 1 if point 2 does not have a negative X value from point 1 then I want to mirror using point 2..

    any ideas.. thank you in advance..
     
    Jon Baker, Jun 1, 2004
    #1
  2. Jon Baker

    Jon Guest

    Hi Jon

    You just need to strip the x value and compare them:
    (setq pt1x (car pt1) pt2x (car pt2))
    (if (< pt2x pt1x)
    (setq mirrorpt pt1)
    (setq mirrorpt pt2)
    )

    Jon Rasmussen

    I need an if statement and I have no idea how to create one..
    okay.. I pick point 1 and then point 2, I have code that will give me the
    mid point between these two points so I can insert text there. but what I
    need is if point 2 has a negative x value from point 1 I want to mirror the
    inserted text using point 1 if point 2 does not have a negative X value from
    point 1 then I want to mirror using point 2..

    any ideas.. thank you in advance..
     
    Jon, Jun 1, 2004
    #2
  3. Jon Baker

    Jon Baker Guest

    thanx.. I'll try that first thing Tuesday morning..
    Hi Jon

    You just need to strip the x value and compare them:
    (setq pt1x (car pt1) pt2x (car pt2))
    (if (< pt2x pt1x)
    (setq mirrorpt pt1)
    (setq mirrorpt pt2)
    )

    Jon Rasmussen

    I need an if statement and I have no idea how to create one..
    okay.. I pick point 1 and then point 2, I have code that will give me the
    mid point between these two points so I can insert text there. but what I
    need is if point 2 has a negative x value from point 1 I want to mirror the
    inserted text using point 1 if point 2 does not have a negative X value from
    point 1 then I want to mirror using point 2..

    any ideas.. thank you in advance..
     
    Jon Baker, Jun 1, 2004
    #3
  4. Jon Baker

    Jon Baker Guest

    that is exactly correct.. I kinda got it to work.. but if there is a better way.. I am game.. thanx guys.. (gals)
    "Devin" <devinw(^)sdsmw.com> wrote in message Jon,

    First off, I'm not totally sure what you're getting at, but I think you may be trying to keep the text oriented properly according to plan standards (ie: reading up or to the left only). If that's the case then let us know and we can give a better solution.

    Otherwise, I'm still not sure what you're trying to do, perhaps you could explain what effect you're trying to achieve and in what situation.

    HTH,

    Devin
     
    Jon Baker, Jun 2, 2004
    #4
  5. Jon Baker

    Devin Guest

    The following works for me. Just throw the angle into (fix_text_ang <rads>) and it will fix the angle for you.

    HTH,

    Devin

    (defun fix_text_ang ( ang / )
    (setq ang (norm ang (* pi 2)))
    (if (minusp ang) (setq ang (+ ang (* pi 2))))
    (if
    (and
    (> ang (/ pi 2))
    (<= ang (* pi 1.5))
    )
    (setq ang (- ang pi))
    )
    ang
    )

    (defun norm ( val thresh / )
    (setq thresh (abs thresh))
    (cond
    (
    (minusp val)
    (while
    (< val (- 0.0 thresh))
    (setq val (+ val thresh))
    )
    )
    (
    t
    (while
    (> val thresh)
    (setq val (- val thresh))
    )
    )
    )
    val
    )


    that is exactly correct.. I kinda got it to work.. but if there is a better way.. I am game.. thanx guys.. (gals)
    "Devin" <devinw(^)sdsmw.com> wrote in message Jon,

    First off, I'm not totally sure what you're getting at, but I think you may be trying to keep the text oriented properly according to plan standards (ie: reading up or to the left only). If that's the case then let us know and we can give a better solution.

    Otherwise, I'm still not sure what you're trying to do, perhaps you could explain what effect you're trying to achieve and in what situation.

    HTH,

    Devin
     
    Devin, Jun 2, 2004
    #5
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.