LISP To change text width factor inside a block that is text only?

LISP To change text width factor inside a block that is text only?

jdmwrxpower
Advocate Advocate
633 Views
2 Replies
Message 1 of 3

LISP To change text width factor inside a block that is text only?

jdmwrxpower
Advocate
Advocate

Hi everyone,

     I have alot of blocks that are all different. When I go into the block (-bedit) the symbol is a letter or number in the middle of the block. It is text and not an attribute definition. The width factor is .85 and I need to change it to one. I tried Battman but this not show in the list because it's not an attribute definition.

Is there an LSP out that will go through all the blocks, find the text, it's width factor and change it to what you desire? Please help, thank you in advance

0 Likes
Accepted solutions (1)
634 Views
2 Replies
Replies (2)
Message 2 of 3

ВeekeeCZ
Consultant
Consultant
Accepted solution

Try this. You should have posted a sample to test.

 

(vl-load-com)

(defun c:BTextWidth nil
  (vlax-for b (vla-get-blocks (setq doc (vla-get-activedocument (vlax-get-acad-object))))
    (if (and (= 0 (vlax-get b 'islayout))
	     (= 0 (vlax-get b 'isxref))
	     (/= "AcDbBlockReference" (vlax-get b 'objectname))
	     )
      (vlax-for e b
	(if (and (= "AcDbText" (vlax-get e 'objectname)
		 (vlax-write-enabled-p e)
		 )
	  (vla-put-scalefactor e 1)))))
  (vla-regen doc acactiveviewport) 
  (princ)
)

 

0 Likes
Message 3 of 3

jdmwrxpower
Advocate
Advocate

That worked perfectly, thank you! 

0 Likes