Author Topic: Leader update question  (Read 217 times)

0 Members and 1 Guest are viewing this topic.

Biscuits

  • Bull Frog
  • Posts: 451
Leader update question
« on: March 11, 2019, 04:19:10 PM »
This code snippet will change dimstyle settings but has no effect on leaders. Any ideas what I need to modify? Thanks.

Code: [Select]
;This portion will reset all Dimension Styles to the correct "Standard"
 
  (setq dm_tbl  (vla-get-DimStyles (vla-get-activedocument (vlax-get-acad-object))))
  (vlax-for n dm_tbl (setq dm_lst (cons (vla-get-name n) dm_lst))) 
  (foreach n dm_lst     
    (command "_-dimstyle" "r" n
       "_dimdli" 0.1825
       "_dimasz" 0.0685
       "_dimtxt" 0.0685
       "_dimexe" 0.0342
       "_dimexo" 0.0342
       "_dimgap" 0.0342
       "_-dimstyle" "s" n "Y"
)
  )
 (princ)

PKENEWELL

  • Bull Frog
  • Posts: 204
Re: Leader update question
« Reply #1 on: March 11, 2019, 04:44:57 PM »
Are you using MLeaders? If so - the properties are stored in Mleaderstyle objects accessed by the MLEADERSTYLE command. Mleaders no longer use Dimstyles.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

Biscuits

  • Bull Frog
  • Posts: 451
Re: Leader update question
« Reply #2 on: March 11, 2019, 04:58:03 PM »
No mleader just the old standard leader.

PKENEWELL

  • Bull Frog
  • Posts: 204
Re: Leader update question
« Reply #3 on: March 12, 2019, 04:59:18 PM »
No mleader just the old standard leader.

Then to some extent they should follow the dimension style. I believe however the leader line would update with the dimstyle changes, but the text would not. I just tested this in 2019 and that is still the case. If you're not referring to the text, perhaps there is also the possibility of dimension override(s) controlling the leader?
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

tombu

  • Newt
  • Posts: 141
  • ByLayer=>Not0
Re: Leader update question
« Reply #4 on: March 13, 2019, 10:09:07 AM »
This is what you need.  Google gives many examples http://forums.augi.com/showthread.php?5248-Is-there-a-way-to-Automatically-set-the-QLEADER-defaults&p=31280&viewfull=1#post31280
Code: [Select]
;|
  qlset.lsp - example initialization of QLEADER settings
  Frank Whaley, Autodesk

  Two functions are included in this file:
  (acet-ql-get)
  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

|;

(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)
Tom Beauford P.S.M.
Leon County FL Public Works - Windows 7 64 bit AutoCAD Civil 3D