Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: Dim Text Above the Dim Line

  1. #11
    I could stop if I wanted to Tharwat's Avatar
    Join Date
    2010-06
    Posts
    478

    Default Re: Dim Text Above the Dim Line

    That's correct irne'

    My code also would behave as a temporary solution and when any modification would take a place on the dims , they would
    go back to their previous shape ( according to dim style settings ) and that's odd isn't it ?

    Thanks

  2. #12
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: Dim Text Above the Dim Line

    Quote Originally Posted by Tharwat View Post
    My code also would behave as a temporary solution and when any modification would take a place on the dims , they would
    go back to their previous shape ( according to dim style settings ) and that's odd isn't it ?
    Not exactly "odd" I'd say. The block is simply a temporary thing which is recreated each time a change is made the the Dimension object. So every time a change is made to the dimension the entire block-definition is redone from scratch, thus your changes are deleted.

    Actually I've just found another way of doing it ... use the XData for overrides. No need to fiddle with the exact text position, and no need to go into the block's definition. Also no need to even worry about other DimVars / Scaling / UCS / etc.
    Code:
    (defun c:DimTxtMoveUp  (/ en ed)
      (princ)
      (while (setq en (entsel))
        (setq ed (entget (car en)))
        (cond
          ((wcmatch (cdr (assoc 0 ed)) "DIM*")
           (entmod (list (assoc -1 ed)
                         (list -3 (list "ACAD" '(1000 . "DSTYLE") '(1002 . "{") '(1070 . 77) '(1070 . 1) '(1002 . "}"))))))
          (t (princ "\nThat's not a dimension, try again."))))
      (princ))
    
    (defun c:DimTxtMoveDn  (/ en ed)
      (princ)
      (while (setq en (entsel))
        (setq ed (entget (car en)))
        (cond
          ((wcmatch (cdr (assoc 0 ed)) "DIM*")
           (entmod (list (assoc -1 ed)
                         (list -3 (list "ACAD" '(1000 . "DSTYLE") '(1002 . "{") '(1070 . 77) '(1070 . 4) '(1002 . "}"))))))
          (t (princ "\nThat's not a dimension, try again."))))
      (princ))
    Last edited by irneb; 2012-05-22 at 12:13 PM.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  3. #13
    AUGI Addict
    Join Date
    2006-04
    Location
    (0,0,+|Z|)
    Posts
    1,119

    Default Re: Dim Text Above the Dim Line

    Quote Originally Posted by irneb View Post
    ...You're modifying the temporary block of the dim object, as soon as anything changes on that dim (e.g. stretch) these edits are all gone.
    Exactly!

    And thanks irneb, for your last code. It works perfectly.
    But I haven't learned into the "1000", "1002" and "1070" codes yet.
    Could you tell me where to find those info in the "HELP"? Thanks again.

    Thanks to Tharwat, too.

  4. #14
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: Dim Text Above the Dim Line

    First look at xdata: http://docs.autodesk.com/ACD/2011/EN...7a53f-7a08.htm

    Especially the organization section, but also retrieval & attach. Then you need to add xdata sections for each of the settings you want to override. E.g. to override the text height to 100.0, this is governed by DimTxt, which in turn is saved as code 140 in a DimStyle.

    And then to override the arrow size to 100.0, this is DimAsz, which is code 41 of the DimStyle.

    So the XData should look something like this:
    Code:
    (-3 ;Start of the XData DXF section
      ("ACAD" ;ACAD registered app section
        (1000 . "DSTYLE") ;DimStyle sub-section
        (1002 . "{") ;Group the next together
        (1070 . 41) ;An integer (16 bit) to reflect the DXF code of the DimAsz override
        (1040 . 100.0) ;A real value for the DimAsz override's value
        (1070 . 140) ;An integer (16 bit) to reflect the DXF code of the DimTxt override
        (1040 . 100.0) ;A real value for the DimTxt override's value
        (1002 . "}") ;End of group
      )
    )
    Notice the overrides are similar to the DXF codes of the DimStyle itself (this is something for DimStyles though, other stuff may work in other ways). Then in the XData each dxf code is placed in a 1070 (16bit integer) item followed by an item pertinent to the value's type (according to the XData Organization).
    Last edited by irneb; 2012-05-23 at 11:24 AM. Reason: Fixed typo in description
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  5. #15
    I could stop if I wanted to pbejse's Avatar
    Join Date
    2010-10
    Posts
    395

    Default Re: Dim Text Above the Dim Line

    ... use the XData for overrides. No need to fiddle with the exact text position, and no need to go into the block's definition. Also no need to even worry about other DimVars / Scaling / UCS / etc.
    Very nice!

  6. #16
    AUGI Addict
    Join Date
    2006-04
    Location
    (0,0,+|Z|)
    Posts
    1,119

    Default Re: Dim Text Above the Dim Line

    It is great!
    Thanks again, irneb.

  7. #17
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: Dim Text Above the Dim Line

    You're all welcome. And it actually showed me how to do this ... never used xdata overrides before, so this was a learning experience for me as well.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  8. #18
    AUGI Addict
    Join Date
    2006-04
    Location
    (0,0,+|Z|)
    Posts
    1,119

    Default Re: Dim Text Above the Dim Line

    Quote Originally Posted by irneb View Post
    You're all welcome. And it actually showed me how to do this ... never used xdata overrides before, so this was a learning experience for me as well.
    I always learn something from you with your helps.
    Thank you and I am very appreciated.

  9. #19
    AUGI Addict
    Join Date
    2006-04
    Location
    (0,0,+|Z|)
    Posts
    1,119

    Default Re: Dim Text Above the Dim Line

    Hi irneb,
    In your code, how to add a localised variable "dimTadValue" to the list? eg
    Code:
    '(1070 . DimTadValue)
    So it will moves the dimtext up or down when the user changes the value of "DimTadValue".
    It doesn't work as it returns an error message:
    ; error: bad DXF group: (-3 ("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 77)
    (1070 DimTadValue) (1002 . "}")))
    I have no problem with predefining the "DimTadValue".
    Thanks for your help.

  10. #20
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: Dim Text Above the Dim Line

    If you want to generate a pair from a variable you need to use cons instead of quote ('). Something like this:
    Code:
    (setq DimTadValue 4)
    (cons 1070 DimTadValue) ;Returns (1070 . 4)
    Using the quote will not evaluate the items in the list into their values. So using the following:
    Code:
    (setq DimTadValue 3)
    '(1070 . DimTadValue) ;Returns (1070 . DIMTADVALUE) not (1070 . 3)
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Line based text - remove text masking?
    By blumarble in forum Revit Architecture - General
    Replies: 3
    Last Post: 2012-01-04, 05:20 PM
  2. Line spacing In Multi Line Text
    By STHRevit in forum Revit Architecture - General
    Replies: 1
    Last Post: 2008-09-22, 09:59 AM
  3. Replies: 8
    Last Post: 2007-06-27, 09:09 PM
  4. Convert single line text to multi line text?
    By civilguy in forum AutoCAD General
    Replies: 3
    Last Post: 2006-10-11, 11:37 PM

Posting Permissions

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