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
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
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!
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: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).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 ) )
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!
Very nice!... 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.![]()
It is great!
Thanks again, irneb.
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!
Hi irneb,
In your code, how to add a localised variable "dimTadValue" to the list? eg
So it will moves the dimtext up or down when the user changes the value of "DimTadValue".Code:'(1070 . DimTadValue)
It doesn't work as it returns an error message:
I have no problem with predefining the "DimTadValue".; error: bad DXF group: (-3 ("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 77)
(1070 DimTadValue) (1002 . "}")))
Thanks for your help.
If you want to generate a pair from a variable you need to use cons instead of quote ('). Something like this:Using the quote will not evaluate the items in the list into their values. So using the following:Code:(setq DimTadValue 4) (cons 1070 DimTadValue) ;Returns (1070 . 4)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!