Lee, the only thing I can't figure out is how to include the arrowhead on the leaders so the arrowhead size will be scaled up/down too.Right now after I run the lisp, I'll have to select all the leaders and manualy change the arrow head size to the correct size from the properties window.DIMASZ only works if the leaders are drawn afterwards. Ok, not sure if this suits?
(defun c:sclAll (/ *error* BLKS DOC ENT I MA MI OBJ PTLST SCL SS UF) (vl-load-com) (defun *error* (msg) (and uF (vla-EndUndoMark doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq blks (vla-get-Blocks (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))))) (initget 7) (setq scl (getreal "\nSpecify Scale Factor: ")) (if (setq i -1 ss (ssget "_:L")) (progn (setq uF (not (vla-StartUndoMark doc))) (while (setq ent (ssname ss (setq i (1+ i)))) (setq obj (vlax-ename->vla-object ent)) (cond ((eq "INSERT" (cdr (assoc 0 (entget ent)))) (if (not (eq :vlax-true (vla-get-isXRef (vla-item blks (vla-get-Name obj))))) (vla-ScaleEntity obj (vla-get-InsertionPoint obj) scl))) ((wcmatch (cdr (assoc 0 (entget ent))) "*TEXT") (vla-ScaleEntity obj (vlax-get-property obj (if (eq "AcDbText" (vla-get-ObjectName obj)) (if (eq acAlignmentLeft (vla-get-Alignment obj)) 'InsertionPoint 'TextAlignmentPoint) 'InsertionPoint)) scl)) (t (vla-getBoundingBox obj 'Mi 'Ma) (setq ptLst (mapcar (function vlax-safearray->list) (list Mi Ma))) (vla-ScaleEntity obj (vlax-3D-point (polar (car ptLst) (apply (function angle) ptLst) (/ (apply (function distance) ptLst) 2.))) scl) (if (wcmatch (cdr (assoc 0 (entget ent))) "*LEADER") (vla-put-ArrowHeadSize obj (* (vla-get-ArrowHeadSize obj) scl)))))) (setq UF (vla-EndUndoMark doc))))(princ)) Thanks Lee for the quick response, this seems work for the arrow head sizing, but the leaders are back to being screwy again like what happen from the first version of this lisp.The middle points of the leader are moved.Maybe if you can use the same method on the arrowheads only but added to the previous version. This lisp is way above my skills.
Bear in mind that the other LISP doesn't scale the leaders at all... This one scales the Leaders using the mid-point of the bounding box.
I shall try one more If this doesn't work, then I don't know what to do...
(defun c:sclAll (/ *error* BLKS DOC ENT I MA MI OBJ PTLST SCL SS UF) (vl-load-com) (defun *error* (msg) (and uF (vla-EndUndoMark doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (defun vlax-list->3D-point (lst) (if lst (cons (list (car lst) (cadr lst) (caddr lst)) (vlax-list->3D-point (cdddr lst))))) (setq blks (vla-get-Blocks (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))))) (initget 7) (setq scl (getreal "\nSpecify Scale Factor: ")) (if (setq i -1 ss (ssget "_:L")) (progn (setq uF (not (vla-StartUndoMark doc))) (while (setq ent (ssname ss (setq i (1+ i)))) (setq obj (vlax-ename->vla-object ent)) (cond ((eq "INSERT" (cdr (assoc 0 (entget ent)))) (if (not (eq :vlax-true (vla-get-isXRef (vla-item blks (vla-get-Name obj))))) (vla-ScaleEntity obj (vla-get-InsertionPoint obj) scl))) ((eq (cdr (assoc 0 (entget ent))) "LEADER") (vla-ScaleEntity obj (vlax-3D-point (last (vlax-list->3D-point (vlax-safearray->list (vlax-variant-value (vlax-get-property obj 'Coordinates)))))) scl) (vla-put-ArrowHeadSize obj (* (vla-get-ArrowHeadSize obj) scl))) ((eq (cdr (assoc 0 (entget ent))) "MULTILEADER") (vla-ScaleEntity obj (vlax-3D-point (last (vlax-list->3D-point (vlax-safearray->list (vlax-variant-value (vlax-invoke-method obj 'GetLeaderLineVertices 0)))))) scl)) ((wcmatch (cdr (assoc 0 (entget ent))) "*TEXT") (vla-ScaleEntity obj (vlax-get-property obj (if (eq "AcDbText" (vla-get-ObjectName obj)) (if (eq acAlignmentLeft (vla-get-Alignment obj)) 'InsertionPoint 'TextAlignmentPoint) 'InsertionPoint)) scl)) (t (vla-getBoundingBox obj 'Mi 'Ma) (setq ptLst (mapcar (function vlax-safearray->list) (list Mi Ma))) (vla-ScaleEntity obj (vlax-3D-point (polar (car ptLst) (apply (function angle) ptLst) (/ (apply (function distance) ptLst) 2.))) scl)))) (setq UF (vla-EndUndoMark doc))))(princ)) Thanks Lee again. It seems like the mid point is moved further away from the original spot than the previous version.Maybe whatever you did, do it the opposite?!?Or maybe I'm just talking out of my @ss. I just the start vertex of the Leader Line, i.e. the arrow point.
I shall try the end, as its not too hard to incorporate. Above code updated. Doesn't seem to work either.Leaders are still getting wired mid point.Its ok if it's too much.I don't want waste too much of your time. Thanks for trying Lee.
Blocks(symbols), Text, Leaders, all will work in annotative
页:
1
[2]