Jump to content

Recommended Posts

Posted

do they exist? I'd like to write a lisp to put them in.

Posted

The settings are stored in a dictionary, you can set them like this:

 

;;; qlset.lsp - example initialization of QLEADER settings
;;; Frank Whaley, Autodesk
;;; 
;;; Two functions are included in this file:
;;; 
;;; (acet-ql-Set)
;;; Returns an association list containing the current QLEADER settings from the
;;; Named Object Dictionary.
;;; 
;;; (acet-ql-get <alist>)
;;; Sets the specified values for QLEADER settings from the given association
;;; list.
;;; Returns an association list containing the new values.
;;; 
;;; These functions can be used to examine the current QLEADER settings, or to
;;; initialize the setting before using the QLEADER command.
;;; For example, to use splined leaders and framed text:
;;; 
;;; (acet-ql-set '((65 . 1)(72 . 1)))
;;; 
;;; Both functions use the following group codes to identify QLEADER settings:
;;; 
;;;  3: user arrowhead block name (default="")
;;;  40: default text width (default=0.0)
;;;  60: annotation type (default=0)
;;;      0=MText
;;;      1=copy object
;;;      2=Tolerance
;;;      3=block
;;;      4=none
;;;  61: annotation reuse (default=0)
;;;      0=none
;;;      1=reuse next
;;;  62: left attachment point (default=1)
;;;  63: right attachment point (default=3)
;;;      0=Top of top line
;;;      1=Middle of top line
;;;      2=Middle of multiline text
;;;      3=Middle of bottom line
;;;      4=Bottom of bottom line
;;;  64: underline bottom line (default=0)
;;;  65: use splined leader line (default=0)
;;;  66: no limit on points (default=0)
;;;  67: maximum number of points (default=3)
;;;  68: prompt for MText width (word wrap) (default=1)
;;;  69: always left justify (default=0)
;;;  70: allowed angle, first segment (default=0)
;;;  71: allowed angle, second segment (default=0)
;;;      0=Any angle
;;;      1=Horizontal
;;;      2=90deg
;;;      3=45deg
;;;      4=30deg
;;;      5=15deg
;;;  72: frame text (default=0)
;;; 170: active tab (default=0)
;;;      0=Annotation
;;;      1=Leader Line & Arrow
;;;      2=Attachment
;;; 340: object ID for annotation reuse
;;; 
;;; |;

acad-push-dbmod
(defun acet-ql-get  (/ xr cod itm reply)
 (if (setq xr (dictsearch (namedobjdict) "AcadDim"))
   (progn
     (foreach cod  '(3 40 60 61 62 63 64 65 66 67 68 69 70 71 72 170 340)
       (if (setq itm (assoc cod xr))
         (setq reply (append reply (list itm)))))
     reply)
   '((3 . "")
     (40 . 0.0)
     (60 . 0)
     (61 . 1)
     (62 . 1)
     (63 . 3)
     (64 . 0)
     (65 . 0)
     (66 . 0)
     (67 . 3)
     (68 . 1)
     (69 . 0)
     (70 . 0)
     (71 . 0)
     (72 . 0)
     (170 . 0))))

(defun acet-ql-set  (arg / cur prm)
 ;;  fetch current
 (setq cur (acet-ql-get))

 ;;  override per argument
 (while arg
   (setq prm (car arg)
         arg (cdr arg)
         cur (subst prm (assoc (car prm) cur) cur))
   ;;  handle DIMLDRBLK
   (if (= 3 (car prm))
     (setvar "DIMLDRBLK" (cdr prm))))

 ;;  put back
 (dictremove (namedobjdict) "AcadDim")
 (setq cur (append '((0 . "XRECORD") (100 . "AcDbXrecord") (90 . 990106))
                   cur))
 (dictadd (namedobjdict) "AcadDim" (entmakex cur))

 (acet-ql-get))

;;  load quietly
(princ)

 

Or you can entmake the leader and put your overrides in the xData (-3) DXF codes:

 

(entmake (list (cons 0 "LEADER")
              (cons 100 "AcDbEntity")
              (cons 100 "AcDbLeader")
              (cons 71 1)
              (cons 72 0)
              (cons 73 3)
              (cons 74 0)
              (cons 75 0)
              (cons 10 pt)
              (cons 10 pt1)
              (cons 10 (getpoint pt1 "\nSpecify Next Point"))
              (list -3
                    (list "ACAD"
                          (cons 1000 "DSTYLE")
                          (cons 1002 "{")
                          (cons 1070 41)
                          (cons 1040 2.5)
                          (cons 1002 "}")))))

 

The information for such groups codes can be found here:

 

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) (1000 .  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         DIMATMOVE              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


Posted

very interesting thanks so much

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...