Code Red > AutoLISP (Vanilla / Visual)
Replace text with existing block with attribute
luisternou:
Hello everyone!
I have several bridge-numbers in my drawing(2000+). I want to replace the text numbers with an existing block with an attribute in it who's value becomes de replaced text.
Is there someone who can help me to write a lisp?
Thanks in advance,
Kind regards, Luis
ChrisCarlson:
This isn't too bad if you're willing to learn. You need to break it down into steps first. This is how I would break it down
1) Select text entities and filter on entities with the string you want to replace
1a) Create a txtstr variable
1b) Create a variable for insertion point based on the text entity
2) Insert the block
4) Input the string into the attribute of the block entity
5) Delete the text entity
luisternou:
:idea: eeeeh oké, thanks, that looks very simple! But to be honest. I tried in the past to write lisp but I don't have the talent and/or brains to get it right. :idiot2: I hope you or someone else can help me. Anyhow, thanks for replying!
ChrisCarlson:
Research and examine the following;
--- Code - Auto/Visual Lisp: ---ssget , vla-get-TextString , vla-InsertBlock , vla-put-TextString , vla-Delete
luisternou:
Sorry Master_Shake but I am in a hurry! So what I did is: I did the command Tcircle and selected all the text. Then with an old lisp I have I converted all the 2014 circles to a circle block. Then in Express-tools I replaced all the circle blocks with the one I want with the attribute. With another lisp I copy the text to the attribute value one by one... :embarrassed2:
Navigation
[0] Message Index
[#] Next page
Go to full version