Author Topic: When Dimscale is 0  (Read 3674 times)

0 Members and 1 Guest are viewing this topic.

hendie

  • Guest
When Dimscale is 0
« on: December 03, 2004, 06:46:34 AM »
I have my Dimscale set to "Scale dimensions to layout (paperspace)" ~ in other words, Dimscale = 0
now when I create my dimensions it automatically creats a dim over-ride, where the Dimscale in that is, for example 0.48
can someone give me a clue as to how I can access that value ? Dimscale still gives back a value of 0

hendie

  • Guest
When Dimscale is 0
« Reply #1 on: December 03, 2004, 07:32:25 AM »
here's a clue

Code: [Select]
(setq Dimdata (entget (car (entsel)) '("acad")))
 (setq Dimdata (cdadr (assoc -3 Dimdata)))
 (setq theREALdimscale (cdr (assoc 1040 Dimdata)))


courtesy of Piercey, Jason on the Adork forum

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
When Dimscale is 0
« Reply #2 on: December 03, 2004, 08:42:00 AM »
hendie,
you talking to your self this morning?

You may find this info I collected useful
or not.

Code: [Select]
Art Cooney (artc@autodesk.com)
There's a description of the codes in the ObjectARX documentation (I've included
it below).  I don't think the DXF documentation explains the overrides.

Here's the description from the ObjectARX docs:

Dimension style overrides can be applied to any of the AcDbEntity types that
reference an AcDbDimStyleTableRecord.  These are:

 AcDbAlignedDimension
 AcDbRotatedDimension
 AcDbDiametricDimension
 AcDbRadialDimension
 AcDb2LineAngularDimension
 AcDb3PointAngularDimension
 AcDbOrdinateDimension

 AcDbLeader
 AcDbFcf

Dimension overrides applied to an object of any of these classes are stored as
xdata under the "ACAD" appId in a special subsection. The subsection starts with
a group code 1000 (AcDb::kDxfXdAsciiString) with the string "DSTYLE", followed
by all the dimension override data bracketed inside a pair of group code 1002's
(AcDb::kDxfXdControlString) (the first being a "{" and the other a "}").
Dimension variables in general are called dimvars, and this data is commonly
called "per-entity dimvar overrides" or just dimvar overrides.

Within the group code 1002 brackets is a chain of dimvar group-code/data-value
resbuf pairs, one pair for each dimvar being overridden.
The first resbuf in each pair is the DXF group code for the dimvar, as found in
the Table below.  Since the group code is an integer it has a restype of
AcDb::kDxfXdInteger16 (group code 1070).
The second resbuf in each pair is the value for that dimvar.  Data values for
dimvars may be strings, integers, reals, or objectIds.  As with resbufs in
general, the value of the resbuf’s restype indicates how to read the data in the
resval.  Please refer to the Table below.

As an example, here is a dimension style override list that will override the
DIMTAD and DIMGAP variables. The list is shown in AutoLISP format with indenting
for clarity.

 ("ACAD"
    (1000 . "DSTYLE")
    (1002 . "{")
    (1070 . 77) (1070 . 1)
    (1070 . 147) (1040 .  0.2)
    (1002 . "}")

 )

In this example the group code 77 is DIMTAD, which is overridden to be 1. Then
DIMGAP (group code 147) is set to 0.2.
The following code sample uses acutBuildList() to create this resbuf chain and
to set overrides for DIMTAD and DIMGAP on the entity pointed to by pEnt,
assuming pEnt points to an AcDbEntity of one of the types listed above and is
open for writing:

resbuf* pRb = acutBuildList(
        AcDb::kDxfRegAppName,      "ACAD",
        AcDb::kDxfXdAsciiString,   "DSTYLE",
        AcDb::kDxfXdControlString, "{",
        AcDb::kDxfXdInteger16,  77, AcDb::kDxfXdInteger16, 1,
        AcDb::kDxfXdInteger16, 147, AcDb::kDxfXdReal,      0.2,
        AcDb::kDxfXdControlString, "}",
        RTNONE);
Acad::ErrorStatus es = pEnt->setXdata(pRb);

acutRelRb(pRb);

It is very important the xdata you set onto an object have the proper sequence
of resbufs.  Each override must have both the DXF group code resbuf and the
associated value resbuf. In addition, the value must be the correct data type
(string, real, or int) and must be within the allowable range for that dimvar.
If any of these conditions are not met, AutoCAD may terminate. Also, the 1000
"DSTYLE" and the following 1002 "{" "}" set must be present, and there must only
be one set of all of these.

Remember that xdata is obtained and replaced on a per-appId basis. To modify any
dimension overrides, work with the complete list of xdata for the "ACAD" appId,
which may have other data, including other dimension overrides. So, be sure to
obtain whatever xdata may already be present for the "ACAD" appId (use the
object's xData() method with the string "ACAD"). Add or remove only the
dimension override information you need, making sure that if dimension override
information already exists you don't duplicate any of the xdata that's already
there (including the "DSTYLE" string and the 1002 "{" "}" bracket pairs). Place
new overrides in between the existing 1002 bracket pair, and put the complete
modified list back into the object via the object's setXData() method. If not
done correctly, AutoCAD may terminate.

Here is a table of all the DimStyleTableRecord dimvars, with their DXF group
codes, data types, and value ranges:

Group code  Dimension variable     Data type     Value range
3           DIMPOST                string        any
4           DIMAPOST               string        any
40          DIMSCALE               real          >= 0.0
41          DIMASZ                 real          >= 0.0
42          DIMEXO                 real          >= 0.0
43          DIMDLI                 real          >= 0.0
44          DIMEXE                 real          >= 0.0
45          DIMRND                 real          >= 0.0
46          DIMDLE                 real          >= 0.0
47          DIMTP                  real          >= 0.0
48          DIMTM                  real          >= 0.0
71          DIMTOL                 int           0 = off,  1 = on
72          DIMLIM                 int           0 = off,  1 = on
73          DIMTIH                 int           0 = off,  1 = on
74          DIMTOH                 int           0 = off,  1 = on
75          DIMSE1                 int           0 = off,  1 = on
76          DIMSE2                 int           0 = off,  1 = on
77          DIMTAD                 int           0 - 3
78          DIMZIN                 int           0 - 15
79          DIMAZIN                int           0 - 15            new
140         DIMTXT                 real          >= 0.0
141         DIMCEN                 real          any value
142         DIMTSZ                 real          >= 0.0
143         DIMALTF                real          >= 0.0
144         DIMLFAC                real          >= 0.0
145         DIMTVP                 real          >= 0.0
146         DIMTFAC                real          >= 0.0
147         DIMGAP                 real          any value
148         DIMALTRND              real          >= 0.0           new
170         DIMALT                 int           0 = off,  1 = on
171         DIMALTD                int           >= 0
172         DIMTOFL                int           0 = off,  1 = on
173         DIMSAH                 int           0 = off,  1 = on
174         DIMTIX                 int           0 = off,  1 = on
175         DIMSOXD                int           0 = off,  1 = on
176         DIMCLRD                int           0 - 256
177         DIMCLRE                int           0 - 256
178         DIMCLRT                int           0 - 256
179         DIMADEC                int           0 - 8            new
271         DIMDEC                 int           0 - 8
272         DIMTDEC                int           0 - 8
273         DIMALTU                int           1 - 8
274         DIMALTTD               int           0 - 8
275         DIMAUNIT               int           0 - 4
276         DIMFRAC                int           0 - 2            new
277         DIMLUNIT               int           0 - 4            new
278         DIMDSEP                int           (char) any char  new
279         DIMTMOVE               int           0 - 2            new
280         DIMJUST                int           0 - 4
281         DIMSD1                 int           0 = off,  1 = on
282         DIMSD2                 int           0 = off,  1 = on
283         DIMTOLJ                int           0 - 2
284         DIMTZIN                int           0 - 15
285         DIMALTZ                int           0 - 15
286         DIMALTTZ               int           0 - 15
288         DIMUPT                 int           0 = off,  1 = on
289         DIMATFIT               int           0 - 3            new
340         DIMTXSTY               objectId                       new
341         DIMLDRBLK              objectId                       new
342         DIMBLK                 objectId                       new
343         DIMBLK1                objectId                       new
344         DIMBLK2                objectId                       new
371         DIMLWD                 int           lineweights      new
372         DIMLWE                 int           lineweights      new
Code: [Select]
(defun c:dova (/ ss ss2 ent obj meas prec txtov)
  ;;;
  ;;; Program prompts for a selection set filtered for
  ;;; dimensions only. It then applies a fractional units
  ;;; dimension override only to dimensions less then 24"
  ;;;
  ;;; Steve Doman
  ;;;
  ;;;  Revised by CAB 10/24/2004 to add <>" to override if no override
  ;;;
  (vl-load-com)
  (graphscr)
  (prompt "\nDimension Override Apply: Fraction < 24\"")
  (setq n 0
        ss2 (ssadd))
  (if (setq ss (ssget ":L" '((0 . "DIMENSION"))))
    (progn
      (princ
        (strcat "\n" (itoa (sslength ss)) " dimensions found ")
      )
      (repeat (sslength ss)
        (setq ent (ssname ss n))
        (setq obj (vlax-ename->vla-object ent))
        (setq meas (vla-get-measurement obj))
        (if (and (vlax-property-available-p obj 'PrimaryUnitsPrecision)
                 (vlax-property-available-p obj 'TextOverride)
            )
          (progn
            (setq prec (vla-get-primaryunitsprecision obj))
            (setq txtov (vla-get-textoverride obj))
            (if (and (< (distof (rtos meas 5 prec) 2) 24.0)
                     (or (= txtov "")
                         (wcmatch txtov "*<>*")
                     )
                )
              (progn
               (vla-put-textoverride obj "<>\""); CAB
               (setq ss2 (ssadd ent ss2))
              )
            )
            (setq n (1+ n))
          )
        )
      )
      (if ss2
        (progn
          (setvar "cmdecho" 0)
          (command ".dimoverride" "lunit" "5" "" ss2 "")
          (setvar "cmdecho" 1)
          (princ
            (strcat
              "   "
              (itoa (sslength ss2))
              " dimension(s) Dova'd "
            )
          )
        )
        (princ
          "   No dimensions found measuring less than 24\""
        )
      )
    )
  ) ;end big if

  (princ)
)

Corrections applied, Thanks Roy
« Last Edit: February 25, 2014, 10:55:33 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

hendie

  • Guest
When Dimscale is 0
« Reply #3 on: December 03, 2004, 08:59:23 AM »
very useful info CAB, thanks

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: When Dimscale is 0
« Reply #4 on: February 20, 2014, 09:34:03 AM »
I am reviving this very old thread to report two errors in the dim override documentation:
1.
(1070 . 147) (1000 .  0.2)
Should be:
(1070 . 147) (1040 .  0.2)
2.
DIMATMOVE
Should be:
DIMTMOVE

Thank you CAB for sharing.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: When Dimscale is 0
« Reply #5 on: February 25, 2014, 04:08:00 PM »
FWIW: Some additions for the dim override documentation:
Code: [Select]
Group code  Dimension variable     Data type     Value range
 49         DIMFXL                 real          any value         new 2007
 50         DIMJOGANG              real          0.08727 - 1.5708 (5 - 90 degrees)  new 2007
 69         DIMTFILL               int           0 - 2             new 2007
 70         DIMTFILLCLR            int           0 - 256           new 2007
 90         DIMARCSYM              int           0 - 2             new 2007
290         DIMFXLON               int           0 = off,  1 = on  new 2007
294         DIMTXTDIRECTION        int           0 = off,  1 = on  new 2007
346         DIMLTEX1               objectId                        new 2007
347         DIMLTEX2               objectId                        new 2007
345         DIMLTYPE               objectId                        new 2007