(defun c:p2l (/ e o ss i sn l p)
;; Created by Tharwat 17.10.2015
;; Modified by Igal Averbuh 20.10.2015

(and (or (= (getvar "_VERNUM") "G.55.0.0 (UNICODE)");;;2013 without service packs
(= (getvar "_VERNUM") "G.204.0.0 (UNICODE)");2013 SP2
(= (getvar "_VERNUM") "G.114.0.0 (UNICODE)");2013 SP1.1
(= (getvar "_VERNUM") "G.112.0.0 (UNICODE)");2013 SP1

)
)

(acet-ql-set '((60 . 4)(65 . 0)(66 . 0)(67 . 3)(70 . 0)(71 . 0)))

(setvar 'DIMASZ
(cond ((getdist (strcat "\nSpecify Arrow Head Size : ")))
((getvar 'DIMASZ))
)
)

(if (setq e (entlast)
ss (ssget "_:L" '((0 . "LWPOLYLINE") (-4 . "=") (90 . 3)))
)
(repeat (setq i (sslength ss))
(setq sn (ssname ss (setq i (1- i)))
l (mapcar
'cdr
(vl-remove-if-not '(lambda (p) (eq (car p) 10)) (entget sn))
)
)
(if (> (distance (car l) (cadr l))
(distance (caddr l) (cadr l))
)
(setq p (reverse l))
(setq p l)
)
(setvar "cmdecho" 0)
(command "_.qleader"
"_none"
(car p)
"_none"
(cadr p)
"_none"
(caddr p)

)
(if (not (eq e (setq o (entlast))))
(progn
(entdel sn)
(setq e o)
)
)
)
)
(princ)
(setvar "cmdecho" 1)
)

;;
;; 2.19.2002 Rob Tomson
;; (acet-ql-get)
;; Returns an association list containing the current QLEADER
;; settings from the Named Object Dictionary.
;;
;; (acet-ql-get )
;; 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_CRX"))
(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 . 4)
(61 . 0)
(62 . 1)
(63 . 1)
(64 . 0)
(65 . 0)
(66 . 0)
(67 . 3)
(68 . 0)
(69 . 0)
(70 . 3)
(71 . 2)
(72 . 0)
(170 . 0)
)
)
)
(defun acet-ql-set (arg / cur prm)
(setq cur (acet-ql-get))
(while arg
(setq prm (car arg)
arg (cdr arg)
cur (subst prm (assoc (car prm) cur) cur)
)
(if (= 3 (car prm))
(setvar "DIMLDRBLK" (cdr prm))
)
)
(dictremove (namedobjdict) "AcadDim_CRX")
(setq
cur (append '((0 . "XRECORD") (100 . "AcDbXrecord") (90 . 990106))
cur
)
)
(dictadd (namedobjdict) "AcadDim_CRX" (entmakex cur))
(acet-ql-get)
)
(princ)

(acet-ql-set
'((3 . "")
(40 . 0.0)
(60 . 4)
(61 . 0)
(62 . 1)
(63 . 1)
(64 . 0)
(65 . 0)
(66 . 0)
(67 . 3)
(68 . 0)
(69 . 0)
(70 . 3)
(71 . 2)
(72 . 1)
(170 . 0)
)
)
;;
(c:p2l)

Advertisements