Attributes mirror after using ATTREDEF

Discussion in 'AutoCAD' started by simon.weel, Jan 5, 2005.

  1. simon.weel

    simon.weel Guest

    Hello,

    We experience a nasty problem with ATTREDEF.
    Blocks with attributes can be mirrored and the text is still readable. But after changing a block with attributes using the ATTREDEF command, the attributes in mirrored blocks become mirrored as well, making them unreadable.

    I've been trying to tackle this for a while, but can't get a grasp on it. Some strange things happen. Although it is possible to edit the attribute values by simply double-clicking the block, the command -ATTEDIT reports 0 attributes found when you pick such a mirrored attribute.

    Does anyone has a clue in how to solve this? It seems like the ATTREDEF command does some unexpected things...

    Greetings,

    Simon Weel
     
    simon.weel, Jan 5, 2005
    #1
  2. simon.weel

    James Allen Guest

    Hi Simon,

    I don't see that problem now, but think I remember seeing it when we
    discussed this before. (
    http://discussion.autodesk.com/thread.jspa?messageID=4132889 ) Perhaps
    related; I do see other strange happenings on my system involving attributes
    in mirrored blocks (non-uniformly scaled blocks in general, actually).

    I may not be able to, but I'm interested in helping figure this out. I
    would need more info though. What version of AutoCAD? It may be that the
    problem or even possible solutions to it are version specific (maybe why I
    don't see it now). And as I mentioned before, looking at a small sample
    file that demonstrates the problem would help a lot too.

    James


    after changing a block with attributes using the ATTREDEF command, the
    attributes in mirrored blocks become mirrored as well, making them
    unreadable.
    Some strange things happen. Although it is possible to edit the attribute
    values by simply double-clicking the block, the command -ATTEDIT reports 0
    attributes found when you pick such a mirrored attribute.
    command does some unexpected things...
     
    James Allen, Jan 5, 2005
    #2
  3. simon.weel

    James Allen Guest

    Ahhh! Now I see. My current routine to fix this "moves" the attribute if
    it is not justified middle center. This will require a bit more work.
    Looking into it now and will post back.

    James


    normal and mirrored. The attribute value in both blocks is readable. Then I
    exploded block2 and used ATTREDEF to redefine it. Block2 mirrored shows what
    happens then. The attribute value is mirrored, making it hard to read.
    clicking it, but if you try -ATTEDIT, you'll notice you cannot select the
    attribute.
    as little as possible, but we do have a problem in cases it IS used...
     
    James Allen, Jan 6, 2005
    #3
  4. simon.weel

    Jay Guest

    When I mirror your BLOCK2, the text doesn't mirror, unlike what your samle shows.

    Anyway, have you considered using the Express Tolls Block Attribute Manager?

    Jay
     
    Jay, Jan 6, 2005
    #4
  5. simon.weel

    James Allen Guest

    Simon, see if this works for you.

    James

    Code:
    ;;; Fixes attributes that are facing away
    (defun c:FixAtt (/ edt enm jst ins nrm rot vdr wid)
    (command "_.undo" "begin")
    (setq vdr (trans (getvar "viewdir") 1 0)
    enm (car (nentsel "\nPick Attribute to Fix: "))
    edt (entget enm)
    nrm (assoc 210 edt)
    )
    (if (equal (cdr nrm) '(0 0 -1) 0.1)
    (progn
    (setq jst (cdr (assoc 72 edt))
    wid (if (vl-position
    t
    (mapcar '(lambda (a) (= jst a)) '(1 3 4 5))
    )
    0
    (progn
    (setq wid (textbox (entget enm))
    wid (- (caadr wid) (caar wid))
    )
    (if (= jst 2)
    wid
    (- wid)
    )
    )
    )
    rot (cdr (assoc 50 edt))
    rot (list (cos rot) (sin rot) 0)
    rot (trans rot enm vdr)
    rot (+ (angle '(0 0 0) rot) pi)
    edt (subst (cons 50 rot) (assoc 50 edt) edt)
    wid (polar '(0 0 0) rot wid)
    ins (trans (cdr (assoc 10 edt)) enm vdr)
    ins (mapcar '+ ins wid)
    edt (subst (cons 10 ins) (assoc 10 edt) edt)
    ins (trans (cdr (assoc 11 edt)) enm vdr)
    ins (mapcar '+ ins wid)
    edt (subst (cons 11 ins) (assoc 11 edt) edt)
    edt (subst (cons 210 vdr) (assoc 210 edt) edt)
    )
    (entmod edt)
    (entupd enm)
    )
    )
    (command "_.undo" "end")
    (princ)
    )
    

    normal and mirrored. The attribute value in both blocks is readable. Then I
    exploded block2 and used ATTREDEF to redefine it. Block2 mirrored shows what
    happens then. The attribute value is mirrored, making it hard to read.
    clicking it, but if you try -ATTEDIT, you'll notice you cannot select the
    attribute.
    as little as possible, but we do have a problem in cases it IS used...
     
    James Allen, Jan 6, 2005
    #5
  6. simon.weel

    simon.weel Guest

    Yes! Great!!

    Thanks a lot James, me and my colleagues are very happy with this routine.

    Greetings,

    Simon Weel
     
    simon.weel, Jan 6, 2005
    #6
  7. simon.weel

    James Allen Guest

    Excellent! You're welcome.

    James
     
    James Allen, Jan 6, 2005
    #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.