Galtar53 Posted July 2, 2020 Share Posted July 2, 2020 Good evening, I need a lisp to read several files (* .dwg) and replace texts by other texts following a list (* .csv), without opening the files (* .dwg). Quote Link to comment Share on other sites More sharing options...
Dadgad Posted July 2, 2020 Share Posted July 2, 2020 When in doubt, Check Lee Mac out. http://www.lee-mac.com/bfind.html This is an epic example of Lee's work, very generously made available to the global Cad community. Thanks Lee! Quote Link to comment Share on other sites More sharing options...
Galtar53 Posted July 3, 2020 Author Share Posted July 3, 2020 Thank you, yes it works well, but for a single text, and if I have a lot of text to replace how should I do? the problem that I have a lot of modification on files and I cannot do that manually, I already have a list of the texts and replacing them on excel. can you help me find a solution, thank you Quote Link to comment Share on other sites More sharing options...
Dadgad Posted July 3, 2020 Share Posted July 3, 2020 (edited) You can add any number of different TEXT items which you want to change into the dialog box. In one pass it will go through a whole folder or directory and replace them all, without even opening them. It will also print out an excel afterwards describing all the changes which were made in each specific .dwg file. If these are changes which you might frequently have occasion to use, you can save them, so that in the future you will have them available without the need to recreate them. I do not write lisp, but find BFIND to be very powerful and well designed (of course, because Lee-Mac is the Prince of Lispness ). Describe each of the FIND WHAT and REPLACE WITH vales at the top, then hit ADD. Add as many as you want, then hit SAVE, and name that group of changes in case you might need it again later. Should you ever need to use a SAVED group of defined Replace Values another time, just call up BFIND, then use the LOAD option to access the Load Search Items List. This lisp is absolutely Golden. Thanks again Lee! Consider the OPTIONS available in the bottom part of the dialog. Edited July 3, 2020 by Dadgad Screenshot added. Quote Link to comment Share on other sites More sharing options...
Galtar53 Posted July 3, 2020 Author Share Posted July 3, 2020 Hello, I used your beautiful lisp "BFIND" and it works well, but I have a problem if I have a lot of texts to replace, of course the lisp does that but it does it text by text, and I have a list of 17000 texts to replace on several file "* .dwg) without opening them, how I should do to add the texts and their substitutes,thank you Quote Link to comment Share on other sites More sharing options...
Dadgad Posted July 3, 2020 Share Posted July 3, 2020 (edited) Beautiful, "Batch Find & Replace" is, but it isn't mine, it is the Brainchild of Lee-Mac. It is none of my business, but I am reasonably mind-blown that you have a list of 17,000 texts which need to be found and replaced. Can't begin to imagine how you have gotten to such a point. Let alone having 17,000 text entries period. Time to call in the A-Team Lisperatti, and jump to warp-speed! Good luck with it. Edited July 3, 2020 by Dadgad Quote Link to comment Share on other sites More sharing options...
Galtar53 Posted July 3, 2020 Author Share Posted July 3, 2020 22 minutes ago, Dadgad said: Magnifique, "Batch Find & Replace" est, mais ce n'est pas le mien, c'est le Brainchild de Lee-Mac. Cela ne me regarde pas, mais je suis raisonnablement stupéfait que vous ayez une liste de 17 000 textes qui doivent être trouvés et remplacés. Je ne peux pas commencer à imaginer comment vous en êtes arrivé à un tel point. Sans parler de la période de 17 000 entrées de texte. Il est temps d'appeler l'A-Team Lisperatti et de passer à la vitesse de distorsion! Bonne chance. Ok thank you. Quote Link to comment Share on other sites More sharing options...
Steven P Posted July 6, 2020 Share Posted July 6, 2020 As a start you could look at this: https://www.augi.com/forums/showthread.php?43053-Take-existing-drawings-and-find-all-quot-quot-and-replace-with-quot-1-4-quot&p=521248&viewfull=1#post521248 which will find and replace text exactly as it is entered (case sensitive too), it will fail with longer mtexts. It is all command line rather than dialogue box and that means you can use it in a LISP,... so all you need now a lisp that will loop through your excel file data, extract the find and the replace and use them in this find-replace. Which will do it for a single drawing - then use Lee Macs script routine to apply it to all the drawings without opening them. I can't help more than this, I haven't ever needed to link up with excel so no nothing about that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.