flip dimensions

Discussion in 'AutoCAD' started by kemp, Nov 23, 2004.

  1. kemp

    kemp Guest

    I want to write a lisp that will take an aligned or linear dimension and
    flip the text orientation.

    My question is how do you list the ucs properties used when the dim was
    created?

    When we create dimensions we typically will align the ucs z axis to the
    angle the dimension will be drawn at, but some people here cant figure
    out how to pick the correct direction to make the text on the dims
    appear right side up.

    Maybe there is a better way to handle this?

    thx - kemp
     
    kemp, Nov 23, 2004
    #1
  2. kemp

    Tom Smith Guest

    I want to write a lisp that will take an aligned or linear dimension and
    (defun fdt (ename / edata ang)
    (setq
    edata (entget ename)
    ang (cdr (assoc 51 edata)))
    (entmod (subst (cons 51 (+ ang pi)) (assoc 51 edata) edata)))
    I assume you mean rotate the UCS about the z axis. They don't need to figure
    out anything, they just need to be trained on how this works. It's not hard.
    Enter UCS Z and pick two points in the POSITIVE X DIRECTION. The order you
    pick them determines the this. You can set guidelines on what range of
    angles relative to WCS are acceptable to avoid upside down dimension text.

    We don't have an issue with this, but use a "flip dimension text" routine to
    correct the orientation when we do a mirror-image version of a plan.
     
    Tom Smith, Nov 23, 2004
    #2
  3. Here is one that I wrote a while back. Does this do what you want?

    (defun DTR (A) (* PI (/ A 180.0)))
    (defun c:DIMROTATE (/ DIM_CNT DIM_SS1 DIM_OBJ DIM_ANG)
    (command ".undo" "group")
    (setq DIM_CNT 0
    DIM_SS1 (ssget '((0 . "DIMENSION")))
    )
    (if DIM_SS1
    (progn
    (repeat (sslength DIM_SS1)
    (setq DIM_OBJ (entget (ssname DIM_SS1 DIM_CNT)))
    (setq DIM_ANG (- (cdr (assoc 51 DIM_OBJ)) (DTR 180)))
    (setq DIM_OBJ (subst (cons 51 DIM_ANG) (assoc 51 DIM_OBJ) DIM_OBJ))
    (entmod DIM_OBJ)
    (princ (strcat "\rRotating dimension "
    (itoa DIM_CNT)
    " of "
    (itoa (sslength DIM_SS1))
    )
    )
    (setq DIM_CNT (1+ DIM_CNT))
    )
    (princ (strcat "\rRotating dimension "
    (itoa DIM_CNT)
    " of "
    (itoa (sslength DIM_SS1))
    )
    )
    )
    )
    (command ".undo" "end")
    (princ)
    )
     
    Daniel J. Altamura, R.A., Nov 23, 2004
    #3
  4. kemp

    Dave Jones Guest

    here's another one...
    ;;by David Kozina
    (defun C:FLIPTEXT (/ ss i ent ele)
    (setq ss (ssget '((0 . "DIMENSION")))
    i (1- (sslength ss)))
    (while (not (minusp i))
    (setq ent (ssname ss i)
    ele (entget ent))
    (entmod
    (subst (cons 51 (- (abs (cdr (assoc 51 ele))) PI))
    (assoc 51 ele)
    ele))
    (entupd ent)
    (setq i (1- i))))
     
    Dave Jones, Nov 23, 2004
    #4
  5. kemp

    kemp Guest

    Hahah, maybe I need to give them a chance instead of assuming they can't
    learn anything new.

    Either way I incorporated your fix into a lisp that flips all sorts of
    itmes - so thanks a lot, I really do appreciate it!

    kemp
     
    kemp, Nov 23, 2004
    #5
  6. kemp

    Tom Smith Guest

    You're welcome. I just gave you the entmod part. We run it in a functions
    much like Daniel's, which uses an ssget filter to select only dimensions,
    then runs the entmod on entities in the selection set.

    Our users don't get too confused on the UCS orientation once the "positive
    x" thing is shown to them. This comes up mainly on angled buildings where we
    have families of dimensions running at odd angles. If these plans are
    mirrored, some of the dims will need to be flipped.
     
    Tom Smith, Nov 24, 2004
    #6
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.