width factor attribute of multi drawing

width factor attribute of multi drawing

emadelbatran
Enthusiast Enthusiast
348 Views
2 Replies
Message 1 of 3

width factor attribute of multi drawing

emadelbatran
Enthusiast
Enthusiast

Dear all my friends 

thanks for your sharing me 

I have lisp file that changed attrbuite width factor ,but into only one file (who it open ) if there is a way to change the width factor to changer all drawing into specifed foder . the following one the lisp which's i need to revised to be able modify mult drawing 

(defun c:widedit (/ aDoc x attent uwd option tag blk bn)
;;; pBe 11JN2013 ;;;
(vl-load-com)
(setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(if (and (setq x (car (nentsel "\nSelect attribute: ")))
(eq "ATTRIB" (cdr (assoc 0 (entget x))))
(setq attent (vlax-ename->vla-object x))
(princ (strcat "\nCurrent Width is <" (rtos (vla-get-scalefactor attent) 2)"> "))
(setq uwd (getreal "\nEnter new width: ")))
(progn
(initget "Y N")
(setq option (cond
((getkword "\nApply width to all Attribute of the same block? [Yes/no] <N>: "))
( "N" )))
(if (eq option "N")
(vla-put-scalefactor attent uwd)
(progn
(setq tag (vla-get-tagstring attent))
(setq Blk (vla-ObjectIdToObject aDoc
(vla-get-OwnerId attent))
Bn (vla-get-effectivename blk))
(vlax-for itm (vla-item (vla-get-blocks aDoc) bn)
(if (and (eq (vla-get-objectname itm) "AcDbAttributeDefinition")
(eq (vla-get-tagstring itm) tag))
(vla-put-scalefactor itm uwd)))
(vlax-for layout (vla-get-layouts aDoc)
(vlax-for i (vla-get-block layout)
(if (and
(eq (vla-get-objectname i) "AcDbBlockReference")
(eq (Vla-get-hasAttributes i) :Vlax-true)
(eq (vla-get-effectivename i) bn)
)
(foreach itm (vlax-invoke i 'GetAttributes)
(if (eq (vla-get-tagstring itm) tag)
(vla-put-scalefactor itm uwd))
)
)
)
)
)
)
)
(vl-some
'(lambda (j) (if (null (eval (car j))) (princ (cadr j))
))
'((x "\n<<None Selected>>")
(attent "\n<<Selected object not an Attribute>>")
(uwd "\n<<No Width value>>"))
)
)
(princ)

)

 

0 Likes
349 Views
2 Replies
Replies (2)
Message 2 of 3

АлексЮстасу
Advisor
Advisor

It is better to ask questions about lisp here.


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 3 of 3

emadelbatran
Enthusiast
Enthusiast
thanks a lot for your advice , i'll go there ....
0 Likes