Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
pbejse
Posts: 2,406
Registered: ‎11-24-2009
Message 11 of 34 (737 Views)

Re: Pre-defined find & replace lisp

06-03-2011 12:09 AM in reply to: kameron1967

why of course it can, you need to provide us the block name if you want this to run without promptng for selection

 

 

 

Distinguished Contributor
kameron1967
Posts: 156
Registered: ‎09-05-2008
Message 12 of 34 (727 Views)

Re: Pre-defined find & replace lisp

06-03-2011 09:22 AM in reply to: pbejse

The block name is BLOCKA and Tag name is DESCRIPTION.  But the change I want to update is what's written on the description.  So if it says "ISSUED FOR ABCDE", I'd like it to say "ISSUED FOR 12345".  Let me know if you need more information.

 

Thanks, pbejse.

Active Contributor
blackseabrew
Posts: 33
Registered: ‎04-03-2007
Message 13 of 34 (697 Views)

Re: Pre-defined find & replace lisp

08-04-2011 12:07 AM in reply to: Kent1Cooper

Have you ever used the AEFINDTERMTEXT command in ACAD Electrical?  I've tried but it's not working.

Distinguished Contributor
greg.battin
Posts: 147
Registered: ‎12-10-2010
Message 14 of 34 (681 Views)

Re: Pre-defined find & replace lisp

08-04-2011 06:31 AM in reply to: blackseabrew

If the command isn't working because it says that the command is "Unknown" you may be able to use the command REDEFINE and bring the command "back to life"

Distinguished Contributor
kameron1967
Posts: 156
Registered: ‎09-05-2008
Message 15 of 34 (597 Views)

Re: Pre-defined find & replace lisp

04-23-2012 10:18 AM in reply to: pbejse

Pbejse - I was wondering if you have a modified version that includes block name (BlockA) and description attribute (DESC) so that if Block A exists, we then check if DESC has "Issued for ABC".  If it does, we then update it to say "Issued for XYZ".  Thanks in advance.

*Expert Elite*
pbejse
Posts: 2,406
Registered: ‎11-24-2009
Message 16 of 34 (580 Views)

Re: Pre-defined find & replace lisp

04-23-2012 10:12 PM in reply to: kameron1967

kameron1967 wrote:

Pbejse - I was wondering if you have a modified version that includes block name (BlockA) and description attribute (DESC) so that if Block A exists, we then check if DESC has "Issued for ABC".  If it does, we then update it to say "Issued for XYZ".  Thanks in advance.


 

  Start with this <----

 

Holler if you hit a snag.

 

 

 

 

Distinguished Contributor
kameron1967
Posts: 156
Registered: ‎09-05-2008
Message 17 of 34 (568 Views)

Re: Pre-defined find & replace lisp

04-24-2012 12:57 PM in reply to: pbejse

Thanks, Pbejse!  I think I have what I need.  But will let you know if I do hit a snag! :smileyhappy:

Valued Contributor
rwydesk500
Posts: 54
Registered: ‎01-13-2010
Message 18 of 34 (418 Views)

Re: Pre-defined find & replace lisp

05-20-2013 09:56 AM in reply to: Kent1Cooper

How would the second instance of code be modified to account for spaces at the beginning and end of a text string? Thank you!

Regards,

Rick Yoerger

AutoCAD Electrical 2014
*Expert Elite*
Kent1Cooper
Posts: 5,237
Registered: ‎09-13-2004
Message 19 of 34 (410 Views)

Re: Pre-defined find & replace lisp

05-20-2013 10:24 AM in reply to: rwydesk500

rwydesk500 wrote:

How would the second instance of code be modified to account for spaces at the beginning and end of a text string? Thank you!


If I understand correctly, just include them inside the double-quotes wrapping the string, e.g. " issued for construction ".  If you might not always have the same number of spaces at the beginning or end of existing strings, you would probably need to use something like this:

 

(setq tss (ssget "X" '((1 . "*issued for tender*"))))

 

to find them [though that would also find strings with the same content even if what's outside it is not just spaces], and apply (vl-string-trim) if you want them removed.

Kent Cooper
Valued Contributor
rwydesk500
Posts: 54
Registered: ‎01-13-2010
Message 20 of 34 (405 Views)

Re: Pre-defined find & replace lisp

05-20-2013 10:42 AM in reply to: Kent1Cooper

I thought the spaces at either end of the word I am replacing was what was preventing it from working. However, it is not. After I load TRC.lsp and type the command, it returns the following error...

 

"Command: TRC ; error: bad argument type: lselsetp nil"

 

...not sure why. I cut and pasted the code directly from your post. Thanks

Regards,

Rick Yoerger

AutoCAD Electrical 2014

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community