TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Andrea on January 03, 2007, 11:02:30 AM
-
Hi all,...
first, best wishes for 2007.. :-)
Is there any way to select all text and mtext in the entire drawing including in block, layout, and model space ?
I need to do this:
I have many diffrent text style and need to purge all them and keep only 1.
so I think i need to select all text by filtering them en change style.
But if you have any other idea....i'll keep it !
thanks.
-
The best way (I think) is to search the block collection, filtering out xrefs, and the checking for text, mtext, attribute references, attribute definitions, constant attributes and tables. Tables and Mtext you will have to search the string also, because they can have style overrides within the string. This is how I would do it.
-
thanks.... T.Willy..
I was hoping using somting like...
(vlax-for style
(vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)))
(vla-put-textstyle style "simplex.SHX")
)
-
That is not changing the text style of objects, that is changing the font of a text style. If that is what you want to do, then you can step through the text style collection of a document, and change them from there.
(vlax-for Sty (vla-get-TextStyles (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(vla-put-fontFile Sty "simplex.shx")
)
-
ok....thanks...
but how can I use vla-put-textstyle
?
I can't see any exemple on the web..
-
OK...
Convert the selection (of text and mtexts) to vla-objects, then use the below code to change the object to the desired textstyle.
(vla-put-stylename obj "style1")
HTH
-
thanks LE..
(setq ss1 (ssget "X" '((0 . "MTEXT,TEXT"))))
(setq sscount (sslength ss1))
(setq val1 (- sscount 1))
(repeat sscount
(setq ent (vlax-ename->vla-object (ssname ss1 val1)))
(vla-put-stylename ent "SIMPLEX")
(setq val1 (- val1 1))
)
Now all I need to do is to verify Attribute and text in existing block..
-
Now all I need to do is to verify Attribute and text in existing block..
Look at my first response as to how to do this. Once you do it the way I explained, then you won't need the other code you posted.
-
Here is a nice description.......hey it's by TWilley :)
http://www.theswamp.org/index.php?topic=12437.msg154308#msg154308
-
Now all I need to do is to verify Attribute and text in existing block..
Look at my first response as to how to do this. Once you do it the way I explained, then you won't need the other code you posted.
Tim;
Maybe it is me, or something in my poor English translation.... but I understood something different... like he wants to select the text,mtext and the inserts.... or I am out of my mind now?, if I am, it will my last post about lisp here, I promissed - :ugly:
-
Now all I need to do is to verify Attribute and text in existing block..
Look at my first response as to how to do this. Once you do it the way I explained, then you won't need the other code you posted.
Tim;
Maybe it is me, or something in my poor English translation.... but I understood something different... like he wants to select the text,mtext and the inserts.... or I am out of my mind now?, if I am, it will my last post about lisp here, I promissed - :ugly:
Luis,
This is the line that makes me think it is more that just selecting text and mtext
Is there any way to select all text and mtext in the entire drawing including in block, layout, and model space ?
And I hope you don't stop posting in the lisp section. You are a tremendous help here. Many people still don't know what you know about lisp.
Here is a nice description.......hey it's by TWilley :)
http://www.theswamp.org/index.php?topic=12437.msg154308#msg154308
Thanks Ron. I forgot I did that. :-D This will help with the basic idea, but what Andrea is after is a little different, but this shows how to go through the block collections.
-
This is what Andrea said:
I need to do this:
I have many different text style and need to purge all them and keep only 1.
The way I read it is he wants all text styles deleted & only one left in the drawing.
This takes way more work. You need to change dimension styles & overrides, Fileds,
attributes, tables, text within blocks, plain text, and mtext. Did I miss anything?
Only the xrefs would be exempt from the process.
-
Sorry guys....
My english seem to be not better than 2006 !
In fact,...I need to keep all existing text, including text and/or attribute in block,
and change the style.
something like...
(vlax-PUT-ALLTEXTSTYLE "SIMPLEX")
-
"SIMPLEX" is a FontName
Do you mean change the 'TextStyle' or change the 'FontName'
I dont think the problem is your English.
-
You mentioned
purge all them and keep only 1
.. is this still the case ?
Here's a thought .. If you were to do this process by hand how would you do it .. exactly.
Then we will know what result you want .. exactly.
-
Hi Kerry, and thanks for the reply...
you'r right....SIMPLEX is a font name....but can be also the style name.
we work with many clients standards here...
so we are trying to make something easy for CAD user,..
STYLE NAME = FONT NAME here..
because to many architect use the something like..
STYLENAME = ARIAL
FONTNAME = SIMPLEX
see ?
there is what i was able to do with your appreciated help guys...
(defun c:test (/ ActDoc Obj Blk)
(vl-load-com)
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(vlax-for Blk (vla-get-Blocks ActDoc)
(vlax-for Obj Blk
(if
(or
(= (vla-get-ObjectName Obj) "AcDbText")
(= (vla-get-ObjectName Obj) "AcDbAttributeDefinition")
)
(vla-put-stylename Obj "SIMPLEX")
)
(vla-put-layer Obj "0")
)
)
(princ)
)
this code seem to work.....
the problem is the block is good when inserting new one..
but all the existing are not updated.
is this in the code ?
-
Hi
And with this
(defun c:test (/ Att ActDoc att Obj Blk n tot)
(vl-load-com)
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)) tot 0 n 0)
(vlax-for Blk (vla-get-Blocks ActDoc)
(setq tot (+ tot (vla-get-count blk)))
)
(acet-ui-progress-init "Traitement" tot)
(vlax-for Blk (vla-get-Blocks ActDoc)
(vlax-for Obj Blk
(setq n (1+ n))(setq aa obj)
(acet-ui-progress-safe n)
(if (member (vla-get-ObjectName Obj) '("AcDbText" "AcDbMText" "AcDbAttributeDefinition"))
(vl-catch-all-apply 'vla-put-stylename (list Obj "SIMPLEX"))
)
(if (eq (vla-get-objectname Obj) "AcDbBlockReference")
(if (eq (vla-get-hasattributes Obj) :vlax-true)
(foreach Att (vlax-invoke Obj 'getattributes)
(vl-catch-all-apply 'vla-put-stylename (list Att "SIMPLEX"))
)
)
)
(vla-put-layer Obj "0")
)
)
(acet-ui-progress-done)
(princ)
)
Amicalement
@+
-
Bonne année Patrick..
Thanks for the help.
acet-ui-progress.....nice initiative !
I forgot the "AcDbMText"
Oops..
what is (setq aa obj)
for ?
-
Merci, à toi aussi et surtout bonne santé :-)
(setq aa obj)
It's for my tests. I forgot to remove it :roll:
@+
-
Thanks. :roll:
ok..
can anyone help me to finalise the routine..with this :
(vlax-for style (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)))
(if
(and
(= (strcase (vla-get-stylename style)) "SIMPLEX") ;;this line not working..
(/= (strcase (vla-get-fontfile style)) "SIMPLEX.SHX")
)
(vla-put-fontfile style "SIMPLEX.SHX")
)
)
-
How about this vla-get-textfontstyle
-
How about this vla-get-textfontstyle
?? :?
not sure to understand..
vla-get-stylename is not to get the textstyle ?
-
Thanks. :roll:
ok..
can anyone help me to finalise the routine..with this :
(vlax-for style (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)))
(if
(and
(= (strcase (vla-get-stylename style)) "SIMPLEX") ;;this line not working..
(/= (strcase (vla-get-fontfile style)) "SIMPLEX.SHX")
)
(vla-put-fontfile style "SIMPLEX.SHX")
)
)
You shouldn't need this. Once you change all the objects that depend on text styles, just delete the styles you don't want.
If you want to use something like this, then when you are stepping through the text style collection, you only need to check the 'Name' property, not 'StyleName' as that is only available on objects that use text objects.
The routine Patrick gave you is pretty close to what you want, but he doesn't check for 'Constant Attributes' within blocks, and nothing about 'Tables' or 'Dimensions', and nothing about text style overrides within 'Mtext' or 'Tables'.
-
Oh, I see, he is making sure Style SIMPLES uses the font file SIMPLEX.SHX
So as Tim said, this is what you need:
(= (strcase (vla-get-name style)) "SIMPLEX")
-
Corrected code Patrick_35. Checks property StyleName and TextStyle of object
(defun c:test (/ Att ActDoc att Obj Blk n tot)
(vl-load-com)
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)) tot 0 n 0)
;_Unlock Layers
(vlax-for lay (vla-get-layers ActDoc)
(vla-put-Lock lay :vlax-false)
(vl-catch-all-apply 'vla-put-Freeze (list lay :vlax-false))
)
(vla-put-ActiveLayer ActDoc (vla-item (vla-get-layers ActDoc) "0"))
(vlax-for Blk (vla-get-Blocks ActDoc)
(setq tot (+ tot (vla-get-count blk)))
)
;_Make TextStyle
(mapcar (function (lambda ( _font / text_style)
(setq text_style (vla-add (vla-get-textstyles ActDoc) _font))
(vla-put-fontfile text_style "SIMPLEX.SHX")
(vla-put-height text_style 0.0)
(vla-put-width text_style 1.0)
(vla-put-activetextstyle ActDoc text_style)))
'("SIMPLEX"))
(acet-ui-progress-init "Traitement" tot)
(vlax-for Blk (vla-get-Blocks ActDoc)
(vlax-for Obj Blk
(setq n (1+ n))
(acet-ui-progress-safe n)
(cond
((vlax-property-available-p Obj 'TextStyle) ;_DIMENSION
(vl-catch-all-apply 'vla-put-TextStyle (list Obj "SIMPLEX"))
)
((vlax-property-available-p Obj 'StyleName) ;_TEXT,MTEXT, ATTRIBUTE
(vl-catch-all-apply 'vla-put-stylename (list Obj "SIMPLEX"))
)
((and
(eq (vla-get-objectname Obj) "AcDbBlockReference")
(not (vlax-property-available-p Obj 'Path)) ;_Not Xref ???
(eq (vla-get-hasattributes Obj) :vlax-true)
)
(foreach Att (vlax-invoke Obj 'getattributes)
(vl-catch-all-apply 'vla-put-stylename (list Att "SIMPLEX"))
)
)
(t nil)
)
(vla-put-layer Obj "0")
)
)
(acet-ui-progress-done)
(princ)
)
-
I think the same thing as T.Willey but if you need this code, here
(vlax-for style (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)))
(if (/= (strcase (vla-get-fontfile style)) "SIMPLEX.SHX")
(vla-put-fontfile style "SIMPLEX.SHX")
)
)
but he doesn't check for 'Constant Attributes' within blocks, and nothing about 'Tables' or 'Dimensions', and nothing about text style overrides within 'Mtext' or 'Tables'.
Yes, I don't think of them, but Andrea can modify the lisp
Nice code VAA :-)
@+
-
Nice code VAA !!??
You mean VVA !
:police:
yes,...very nice.
But, guys,...I don't know where you lurn all this....but very useful.
thank you very much...
last thing.....
with the..
(vla-put-layer Obj "0")
It change all on layer "0".
But I need to change only all layer inside the block to "0" and leave the layer insertion of the block.
(see picture below)
for the moment I run the routine....and
add the previous code to reset the layer...
but i'm trying to understand what is the OBJ versus the BLK variable..
-
this is how i've modified the routine for doing exactly what i need..
but i'm sure there is another solution..
(defun c:TEST (/ Att ActDoc att Obj Blk n tot f)
(vl-load-com)
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)) tot 0 n 0)
;_Unlock les couches
(vlax-for lay (vla-get-layers ActDoc)
(vla-put-Lock lay :vlax-false)
(vl-catch-all-apply 'vla-put-Freeze (list lay :vlax-false))
)
;; (vla-put-ActiveLayer ActDoc (vla-item (vla-get-layers ActDoc) "0"))
;;capture tous les block
(vlax-for Blk (vla-get-Blocks ActDoc)
(setq tot (+ tot (vla-get-count blk)))
)
;;CREATION DU STYLE SIMPLEX
(mapcar (function (lambda ( _font / text_style)
(setq text_style (vla-add (vla-get-textstyles ActDoc) _font))
(vla-put-fontfile text_style "SIMPLEX.SHX")
(vla-put-height text_style 0.0)
(vla-put-width text_style 1.0)
(vla-put-activetextstyle ActDoc text_style)))
'("SIMPLEX"))
(acet-ui-progress-init "Traitement" tot)
;;traitement des blocks
(vlax-for Blk (vla-get-Blocks ActDoc)
(vlax-for Obj Blk
(setq n (1+ n))
(acet-ui-progress-safe n)
(setq f (vla-get-layer Obj))
(vla-put-layer Obj "0")
(cond
((vlax-property-available-p Obj 'TextStyle) ;_DIMENSION
(vl-catch-all-apply 'vla-put-TextStyle (list Obj "SIMPLEX"))
)
((vlax-property-available-p Obj 'StyleName) ;_TEXT,MTEXT, ATTRIBUTE
(vl-catch-all-apply 'vla-put-stylename (list Obj "SIMPLEX"))
)
((and
(eq (vla-get-objectname Obj) "AcDbBlockReference")
(not (vlax-property-available-p Obj 'Path)) ;_Not Xref ???
(eq (vla-get-hasattributes Obj) :vlax-true)
)
(progn
(vla-put-layer Obj f)
(foreach Att (vlax-invoke Obj 'getattributes)
(vl-catch-all-apply 'vla-put-stylename (list Att "SIMPLEX"))
)
)
)
(t nil)
)
)
)
(setq ss1 (ssget "X" '((0 . "MTEXT,TEXT"))))
(if ss1
(progn
(setq sscount (sslength ss1))
(setq val1 (- sscount 1))
(repeat sscount
(setq ent (vlax-ename->vla-object (ssname ss1 val1)))
(vla-put-layer ent "TextLayer")
(setq val1 (- val1 1))
)
)
)
(vla-Regen ActDoc acActiveViewport)
(acet-ui-progress-done)
(princ)
)
-
I wasn't going to, but I got bored. Here is how I would do it. It won't change the text for dim styles, or for formated mtext, but it will change all the rest. It also assumes that layers that need to be unlocked are, and that the text style you name in the calling function exists in the drawing.
(defun ChangeAllTextObjectsStyle (Doc StyName / tempObjType IsLo ColCnt RowCnt)
(vlax-for Blk (vla-get-Blocks Doc)
(setq IsLo (if (= (vla-get-IsLayout Blk) :vlax-true) T nil))
(if (= (vla-get-IsXref Blk) :vlax-false)
(vlax-for Obj Blk
(setq tempObjType (vla-get-ObjectName Obj))
(cond
((vl-position tempObjType '("AcDbText" "AcDbMText" "AcDbAttributeDefinition"))
(vla-put-StyleName Obj StyName)
(if (not IsLo)
(vla-put-Layer Obj "0")
)
)
((wcmatch tempObjType "AcDb*Dimension")
(vla-put-TextStyle Obj StyName)
)
((= tempObjType "AcDbBlockReference")
(foreach Att (vlax-invoke Obj 'GetAttributes)
(vla-put-StyleName Att StyName)
)
(foreach Att (vlax-invoke Obj 'GetConstantAttributes)
(vla-put-StyleName Att StyName)
)
)
((= tempObjType "AcDbTable")
(setq ColCnt 0)
(repeat (vla-get-Columns Obj)
(setq RowCnt 0)
(repeat (vla-get-Rows Obj)
(vlax-invoke Obj 'SetCellTextStyle RowCnt ColCnt StyName)
(setq RowCnt (1+ RowCnt))
)
(setq ColCnt (1+ ColCnt))
)
)
)
)
)
)
)
Call like for the active drawing.
(ChangeAllTextObjectsStyle (vla-get-ActiveDocument (vlax-get-Acad-Object)) "Simplex")
Edit: I changed the wording in the attribute area to be correct. I had it trying to change 'TextStyle' but needed to be 'StyleName'.
-
Tim, nice code, you're very productive when you're bored...
An ignorant question, you have the acad object passed in as a variable. Does one ever not use the active document?
Thanks,
Dan
-
Tim, nice code, you're very productive when you're bored...
An ignorant question, you have the acad object passed in as a variable. Does one ever not use the active document?
Thanks,
Dan
Sometimes, like with DBX or when reading from another db, you will need to pass 'that' doc reference.
-
Tim, nice code, you're very productive when you're bored...
An ignorant question, you have the acad object passed in as a variable. Does one ever not use the active document?
Thanks,
Dan
Sometimes, like with DBX or when reading from another db, you will need to pass 'that' doc reference.
Yup. Thanks Kerry.
and Thanks Dan for the nice comment. I just like the flexibility of it, since the way the code is written it could be called from, and used with, ObjectDBX.
-
:?
Tim....
Thank you !
The code work perfectly.
-
:?
Tim....
Thank you !
The code work perfectly.
I'm glad Andrea. I hope you can learn from it. And You're Welcome.
-
:?
Tim....
Thank you !
The code work perfectly.
I'm glad Andrea. I hope you can learn from it. And You're Welcome.
I lurn each day Tim......but with you guys......I lurn more faster.. :roll:
just a little thing...
the code works perfectly since I got a new drawing from client...
the..
.... (if (not IsLo)
(vla-put-Layer Obj "0")......
section seem to work.....but even with regenall or
(vla-Regen (vla-get-ActiveDocument (vlax-get-Acad-Object)) acActiveViewport)
all blocks seem to not being refreshed...(<- is this a english word ?) :|
-
just a little thing...
the code works perfectly since I got a new drawing from client...
the..
.... (if (not IsLo)
(vla-put-Layer Obj "0")......
section seem to work.....but even with regenall or
(vla-Regen (vla-get-ActiveDocument (vlax-get-Acad-Object)) acActiveViewport)
all blocks seem to not being refreshed...(<- is this a english word ?) :|
What do you think Tims code should do to the blocks Andrea ?
-
Hi all,...
first, best wishes for 2007.. :-)
Is there any way to select all text and mtext in the entire drawing including in block, layout, and model space ?
I need to do this:
I have many diffrent text style and need to purge all them and keep only 1.
so I think i need to select all text by filtering them en change style.
But if you have any other idea....i'll keep it !
thanks.
Question aside, why write code given CAD Standards can do this?
I looked at Tim's code, though not in detail. I think it would not allow a text style to be purged if it is used in a dimension style.
IOM, code like Tim's is useful for examining a drawing. Tell me where this or these text styles are used, so I can decide beforehand whether it's safe to let CAD Standards do what it does.
-
just a little thing...
the code works perfectly since I got a new drawing from client...
the..
.... (if (not IsLo)
(vla-put-Layer Obj "0")......
section seem to work.....but even with regenall or
(vla-Regen (vla-get-ActiveDocument (vlax-get-Acad-Object)) acActiveViewport)
all blocks seem to not being refreshed...(<- is this a english word ?) :|
What do you think Tims code should do to the blocks Andrea ?
Yes,..
-
Hi all,...
first, best wishes for 2007.. :-)
Is there any way to select all text and mtext in the entire drawing including in block, layout, and model space ?
I need to do this:
I have many diffrent text style and need to purge all them and keep only 1.
so I think i need to select all text by filtering them en change style.
But if you have any other idea....i'll keep it !
thanks.
Question aside, why write code given CAD Standards can do this?
I looked at Tim's code, though not in detail. I think it would not allow a text style to be purged if it is used in a dimension style.
IOM, code like Tim's is useful for examining a drawing. Tell me where this or these text styles are used, so I can decide beforehand whether it's safe to let CAD Standards do what it does.
some client have standard.....
one of these want only SIMPLEX style in drawings..in 5 specific layers, all block created to layer "0" etc....
but we receive some drawing from architect and diffrent other discipline who work with there standard.
so when we receive these drawing we always need to clean all textstyle and fonts before returning the drawing to the client.
To obtain in the drawing this final result of textstyle:
Standard and SIMPLEX
-
......What do you think Tims code should do to the blocks Andrea ?
Yes,..
Lets try that again ...
When you read the code that Tim provided, what do you think it does to blocks ?
-
((vl-position tempObjType '("AcDbText" "AcDbMText" "AcDbAttributeDefinition"));;detect text TYPE
(vla-put-StyleName Obj StyName);;put the new stylename
(if (not IsLo);;if is not in same layout
(vla-put-Layer Obj "0");;put the text item found to layer "0"
)
do I'm right ?
-
Forget posting code and try to answer the question ..
When you read the code that Tim provided,
what do you think it does to blocks ?
-
just a little thing...
the code works perfectly since I got a new drawing from client...
the..
.... (if (not IsLo)
(vla-put-Layer Obj "0")......
section seem to work.....but even with regenall or
(vla-Regen (vla-get-ActiveDocument (vlax-get-Acad-Object)) acActiveViewport)
all blocks seem to not being refreshed...(<- is this a english word ?) :|
What do you think Tims code should do to the blocks Andrea ?
Yes,..
Andrea,
Do you think you maybe misunderstood Kerry's question? He's asking how the code should affect the blocks, not if it should affect the blocks.
just throwing a little hint out there ;)
-
Andrea,
Do you think you maybe misunderstood Kerry's question? He's asking how the code should affect the blocks, not if it should affect the blocks.
just throwing a little hint out there ;)
exactly !
I originally wrote something like
What does Tim's code do to the blocks.?
but I have been accused of being rude or blunt to Andrea in the past, so I changed it to :
What do you think Tims code should do to the blocks Andrea ?
-
but I have been accused of being rude or blunt to Andrea in the past, so I changed it to :
Guilty as charged. :oops:
My mistake and my apologies :-)
-
Wasn't trying to put you ( or anyone else ) onto a guilt trip Mike.
-
I know...
I was jus' sayin' :)
-
some client have standard.....
one of these want only SIMPLEX style in drawings..in 5 specific layers, all block created to layer "0" etc....
but we receive some drawing from architect and diffrent other discipline who work with there standard.
so when we receive these drawing we always need to clean all textstyle and fonts before returning the drawing to the client.
To obtain in the drawing this final result of textstyle:
Standard and SIMPLEX
I understand what you want to do and why. I'm just suggesting you don't need code because CAD Standards can do it. And it would do a better job than what Tim posted. As he said, "It won't change the text (style) for dim styles, or for formated mtext."
CAD Standards would get rid of any unwanted text styles contained in dimstyles. And it purges unwanted items, those which were replaced, in the process.
Regarding Tim's comment about formatted mtext, that is, or should be, a concern. If an mtext string looks like this, "{\\Fromans|c0;SEE ROOF PLAN}" it will display using ROMANS regardless of what the style name property is. To fix that there's John Uhden's Unformat function. It allows removal of font formatting in mtext without changing other formatting codes which you'd probably want to keep.
Tim,
If you read this, I trust you know it's not meant as criticism. Basically I'm just underlining what you said.
-
just a little thing...
the code works perfectly since I got a new drawing from client...
the..
.... (if (not IsLo)
(vla-put-Layer Obj "0")......
section seem to work.....but even with regenall or
(vla-Regen (vla-get-ActiveDocument (vlax-get-Acad-Object)) acActiveViewport)
all blocks seem to not being refreshed...(<- is this a english word ?) :|
What do you think Tims code should do to the blocks Andrea ?
Yes,..
Andrea,
Do you think you maybe misunderstood Kerry's question? He's asking how the code should affect the blocks, not if it should affect the blocks.
just throwing a little hint out there ;)
By extracting each entity of it and change layer.
-
Tim,
If you read this, I trust you know it's not meant as criticism. Basically I'm just underlining what you said.
No problem at all Joe. I was going to show how a formatted string looked like, but couldn't seem to get one to work right. One thing I did learn from this is that you can't have formatted strings in a Table object. Don't know if it will ever be useful, but it is something I learned.
As for stripping out formats with mtext strings, here is one I wrote a little while ago (couple of years maybe).
(defun StripString (String / cstr1 cstr2 nString cnt1 tstr1)
; Strips out formation for color, font, height and width.
(setq cnt1 1)
(while (and (setq cstr1 (substr String 1 1)) (> (strlen String) 0))
(if (= cstr1 "\\")
(progn
(setq cstr2 (substr String 2 1))
(if (member (strcase cstr2) '("C" "F" "H" "W"))
(progn
(while (/= (substr String cnt1 1) ";")
(setq cnt1 (1+ cnt1))
); while
(setq String (substr String (1+ cnt1) (strlen String)))
(setq cnt1 1)
); progn
(progn
(if nString
(setq nString (strcat nString (substr String 1 1)))
(setq nString (substr String 1 1))
); if
(setq String (substr String 2 (strlen String)))
); progn
); if
); progn
(progn
(if nString
(setq nString (strcat nString (substr String 1 1)))
(setq nString (substr String 1 1))
); if
(setq String (substr String 2 (strlen String)))
); progn
); if
); while
(setq tstr1 (vl-string->list nString))
(if (and (not (member 92 tstr1)) (member 123 tstr1))
(setq tstr1 (vl-remove-if '(lambda (x) (or (= x 123) (= x 125))) tstr1))
); if
(vl-list->string tstr1)
)
By extracting each entity of it and change layer.
The code doesn't care about the objects within the blocks that are not text oriented. If you want it to change all objects in the block, then you will have to add some stuff to the code. It shouldn't be too hard, so I will leave it up to you to try.