TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: josan on September 29, 2016, 05:00:25 AM
-
I have a drawing with text blocks and blocks with attributes and need to change the text style.
I was looking for but just got this code.
How I can fix it?
(setq ss (ssget '((0 . "INSERT"))));;block text attribute.
(setq e1 (entget (ssname ss 0)))
(setq e2 (cdr (assoc -1 e1)))
(setq e3 (entget(entnext e2)))
(setq e4 (cdr (assoc 7 e3)))
(setq e5 (subst (cons 7 "LPArialNarrow")(cons 7 e4) e3))
(entmod e5)
(setq e6 (subst e5 e3 e1))
(entmod e6)[code=cadlisp-7]
[/code]
-
Here is an example for you to consider:
(defun c:test
( / ent enx idx sel sty
) (setq sty
"LPArialNarrow") ;; New Textstyle (princ (strcat "\nTextstyle \"" sty
"\" doesn't exist.")) )
sel
(ssget "_:L" '
((0 .
"INSERT") (66 .
1))) )
)
)
)
)
)
)
)
)
Note that any changes to attribute references will be reversed following the use of the ATTSYNC command; you will need to modify the corresponding attribute definitions for the changes to become permanent.
-
Thanks I will apply.
-
The function is very efficient, I thought it was going to change all types of blocks.
But I can only select blocks of text as an attribute.
Text blocks and dynamic blocks are not modified.
How I can change the routine so you can select them?
Thank you.
-
try this
https://www.theswamp.org/index.php?topic=14247.msg172118#msg172118 (https://www.theswamp.org/index.php?topic=14247.msg172118#msg172118)
-
It's great but I can not change the style of text, mtext become block.
thanks.
-
You want to only change text inside blocks, but not loose text?
-
This is a drawing of an example, I have trouble through the list of elements within blocks. To change the texts out of the blocks I have no problems.
That's my problem I do not understand how walking the elements contained within the block and discard those that are not "TEXT" or "MTEXT".
-
Did you try T. Willey's fuction ChangeAllTextObjectsStyle ? It will change the style of mtexts inside blocks
-
I check the file and served me a lot but does not do what I need. In the previous post load the dwg file that I'm testing routines.
With this code try to find the blocks containing texts, which are not attributes, and walk the entities that make up the block, finding the TEXT or MTEXT, sack some values of the database and then modify them.
;(stilos:texto)
(setq Conjunto
(ssget "X" '
((0 .
"INSERT") (66 .
0)))) )
)
)
)
)
-
You're not being clear on what help you need, first post says change text style, the link I posted does that. In any case the vla-put methods cycling through the drawing database via (vlax-for Blk (vla-get-Blocks Doc), allows modification of entities inside blocks. SSGET and ENTUPD won't do that for you. Note your last code posted is missing and ENTUPD fuction to modify the blocks.