Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
Kent1Cooper
Posts: 5,243
Registered: ‎09-13-2004
Message 21 of 34 (401 Views)

Re: Pre-defined find & replace lisp

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

rwydesk500 wrote:

.... 

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

....


It works for me, in minimal testing.  That message should mean that it's not finding any qualifying objects [the tss variable is nil, so it can't figure out how many objects are in it to apply to the (repeat) function].  The (ssget) filter for text content is case-sensitive -- might you have any case differences in Text/Mtext you're expecting it to find?  If that's the issue, it can be accounted for.

Kent Cooper
Distinguished Mentor
BlackBox_
Posts: 733
Registered: ‎02-25-2013
Message 22 of 34 (397 Views)

Re: Pre-defined find & replace lisp

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

Have you considered using a simple Field reference which points to a Sheet Set Custom Property?

 

We use this methodology for all of our projects, our titleblocks, etc.... You can update the one Custom Property value, and done... The entire plan set can be immediately re-Published, etc..

 

No opening each drawing, no manipulating entities, no iterating a directory of drawings via ObjectDBX, no custom code... Using all built-in functionality. Lemon squeezy.



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

*Expert Elite*
Kent1Cooper
Posts: 5,243
Registered: ‎09-13-2004
Message 23 of 34 (392 Views)

Re: Pre-defined find & replace lisp

05-20-2013 11:32 AM in reply to: BlackBox_

BlackBoxCAD wrote:

Have you considered using a simple Field reference which points to a Sheet Set Custom Property?

....


Something like that, or Rtext or an Xref could accomplish the same.  Those approaches can certainly make life easier if you are setting up a new situation, and I would recommend that to anyone in that situation.  But this thread was started in the context of already-existing Text elements that needed to be changed, and I can only assume rwydesk500 who found and revived it after over a year has the same situation to deal with.

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

Re: Pre-defined find & replace lisp

05-20-2013 11:55 AM in reply to: BlackBox_

Yes, custom fields work great for Title Block information. But, my goal here is to replace one word with another word, in a string of Notes which are Mtext. I must replace this word across about 600 drawings.

 

I just used the Lee-Mac solution, mentioned by Greg above, and it worked beautifully. Thanks for everyones help!

Regards,

Rick Yoerger

AutoCAD Electrical 2014
Distinguished Mentor
BlackBox_
Posts: 733
Registered: ‎02-25-2013
Message 25 of 34 (380 Views)

Re: Pre-defined find & replace lisp

05-20-2013 12:17 PM in reply to: rwydesk500

Kent1Cooper wrote:

BlackBoxCAD wrote:

Have you considered using a simple Field reference which points to a Sheet Set Custom Property?

....


Something like that, or Rtext or an Xref could accomplish the same.  


No... They cannot, as each of those you mention require opening the drawing in the Editor, or custom code (DBX?) in order to manipulate said entity, whereas SSM can be modified without opening a drawing.

 

Regardless, the prerequisite is that this Field, and Custom Property be already setup... Which is obviously not the case here, no matter how advantageous.

 


Kent1Cooper wrote:
But this thread was started in the context of already-existing Text elements that needed to be changed, and I can only assume rwydesk500 who found and revived it after over a year has the same situation to deal with.

That's the context that I overlooked when skimming the prior, multiple pages... Thanks for clarifying. :beer:

 

 


rwydesk500 wrote:

Yes, custom fields work great for Title Block information. But, my goal here is to replace one word with another word, in a string of Notes which are Mtext. I must replace this word across about 600 drawings.

 

I just used the Lee-Mac solution, mentioned by Greg above, and it worked beautifully. Thanks for everyones help!


No worries; glad you got it sorted... Lee's BFIND is one of my favorite routines from him for several years.

 

 



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

*Expert Elite*
Kent1Cooper
Posts: 5,243
Registered: ‎09-13-2004
Message 26 of 34 (371 Views)

Re: Pre-defined find & replace lisp

05-20-2013 01:37 PM in reply to: BlackBox_

BlackBoxCAD wrote:

Kent1Cooper wrote:
....

Something like that, or Rtext or an Xref could accomplish the same.  


No... They cannot, as each of those you mention require opening the drawing in the Editor, or custom code (DBX?) in order to manipulate said entity, whereas SSM can be modified without opening a drawing.

....


You're wrong about Rtext, and even with an Xref there's nothing custom about it.  With an Xref, yes, it would mean getting into a drawing, but just the Xref-referenced one [which presumably in this kind of usage would consist of only a piece of Text] rather than any drawing in the set, and by changing that one you'd be done for the whole set.  Maybe you've never used Rtext [I have almost never used it], but doing it that way is kind of like an Xref for text content only, and it would in fact be updatable without opening any drawing at all, but just updating the Rtext-referenced text file, and you'd be done for all drawings with Rtext that references that file.  I don't have a new-enough version here to have Sheet Sets, but I can only imagine you need to get into something to update a Custom Property value -- is that different in any meaningful way from editing a little text file?

Kent Cooper
Distinguished Mentor
BlackBox_
Posts: 733
Registered: ‎02-25-2013
Message 27 of 34 (365 Views)

Re: Pre-defined find & replace lisp

05-20-2013 02:20 PM in reply to: Kent1Cooper

*Sigh*

 

RText is a custom Express Tool Entity (specifically, ObjectName=RText, which inherits from ImpEntity, an internal, sealed ObjectARX Entity Type), and came out long before the myriad enhacements to MText, and D[B]Text Entities support for Fields, let alone SSM functionality... Hence my logical classification of this entity type as being 'custom'.

 

One would have to manually edit a Drawing (in the Editor), or perhaps use custom code using ObjectDBX to add/manipulate (if the RText Express Tool is not Command dependent)... I've already gone over the setup of SSM Properties were not already setup, so in this aspect, no difference... Setup is setup.

 

RText, as a result of being a legacy carry over, has inferior support for different expressions than that of a standard Field (who still uses Diesel!?)... That said, a Field is a Field, with regard to regeneration, updating behavior, etc..

 

Your example of RText updating automatically is dependent on a static expression where the read property value information changes as a byproduct of actions, rather than directly changing the value ad-hoc (i.e., File Name, Save Date, etc.), and not a dynamic value (i.e., Project Name, Client Name, Phase of Constrcution, Revisions Number, etc.) which SSM is vastly superiror... Once setup accordingly... And can be manipulated without any drawing being opened at all.

 

 

 

... Now, since none of this applies to the thread, I do hope that you do not persist with further meaningless banter.



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

*Expert Elite*
Kent1Cooper
Posts: 5,243
Registered: ‎09-13-2004
Message 28 of 34 (342 Views)

Re: Pre-defined find & replace lisp

05-21-2013 08:35 AM in reply to: BlackBox_

BlackBoxCAD wrote:

.... 

One would have to manually edit a Drawing (in the Editor), or perhaps use custom code using ObjectDBX to add/manipulate (if the RText Express Tool is not Command dependent)....

   

.... Now, since none of this applies to the thread, I do hope that you do not persist with further meaningless banter.


*Sigh* back at ya....

 

I reserve the right to persist if you persist in your earlier factually incorrect [that has meaning for me, because I don't want others who see this thread to be misled] claim, expressed again similarly above, that Rtext "...require(s) opening the drawing in the Editor, or custom code (DBX?) in order to manipulate said entity...."

 

Fields and SSM are surely better in several ways, but however preferable they may be, the fact remains that modifying Rtext content requires neither opening any drawing nor any kind of custom code.  Adding Rtext would require being in the drawing, but if the OP's already-existing Text elements were Rtext instead, they could in fact change the wording in all drawings without getting into any of them -- it wouldn't even require having AutoCAD running at all.

Kent Cooper
Distinguished Mentor
BlackBox_
Posts: 733
Registered: ‎02-25-2013
Message 29 of 34 (333 Views)

Re: Pre-defined find & replace lisp

05-21-2013 10:22 AM in reply to: Kent1Cooper

Kent1Cooper wrote:

BlackBoxCAD wrote:

.... 

One would have to manually edit a Drawing (in the Editor), or perhaps use custom code using ObjectDBX to add/manipulate (if the RText Express Tool is not Command dependent)....

   

.... Now, since none of this applies to the thread, I do hope that you do not persist with further meaningless banter.


*Sigh* back at ya....

 

I reserve the right to persist if you persist in your earlier factually incorrect [that has meaning for me, because I don't want others who see this thread to be misled] claim, expressed again similarly above, that Rtext "...require(s) opening the drawing in the Editor, or custom code (DBX?) in order to manipulate said entity...."

 

Fields and SSM are surely better in several ways, but however preferable they may be, the fact remains that modifying Rtext content requires neither opening any drawing nor any kind of custom code.  Adding Rtext would require being in the drawing, but if the OP's already-existing Text elements were Rtext instead, they could in fact change the wording in all drawings without getting into any of them -- it wouldn't even require having AutoCAD running at all.


Very well.

 

Given the already-existing [RText] elements you speculate, kindly educate me as to how you'd change an RText Field from it's diesel expression's calculated value, to "Mickey Mouse," without the use of opening the drawing in the editor, nor custom code, within AutoCAD and no other application.



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

Distinguished Mentor
BlackBox_
Posts: 733
Registered: ‎02-25-2013
Message 30 of 34 (329 Views)

Re: Pre-defined find & replace lisp

05-21-2013 10:53 AM in reply to: Kent1Cooper

Kent1Cooper wrote:

I reserve the right to persist if you persist in your earlier factually incorrect [that has meaning for me, because I don't want others who see this thread to be misled] claim, expressed again similarly above, that Rtext "...require(s) opening the drawing in the Editor, or custom code (DBX?) in order to manipulate said entity...."

 


Becuase you and I share a passion for both correctness, and completeness... You use them so often, that I thought you might enjoy using them correctly even more:

 

Grammar Girl: Parentheses, Brackets, and Braces

 

 

 

Cheers



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

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