alanjt Posted April 14, 2010 Share Posted April 14, 2010 You've probably seen the discussion I'm having with Joe over at theSwamp regarding MText formatting codes - I'm not planning to remove MText formatting codes completely - rather dissect the text, make replacements and then put the formatting back together. Users know the risk of a Batch find and replace, I'm just providing an option for those who want to use it (that's probably not going to be you). Lee Yeah, I've been loosely following it and I hope you can pull it off. It's a really cool concept and you've put together some really nice code/interface for it. I hope you are correct, but I feel that a good amount just load the program and start editing drawings. No, I won't use it (unless you add a search and report only function), but I'm sure something like this can be useful to others. The thing about it is, even if I automate replacing the text on 10-15 drawings, I'd still feel compelled to open and check, just to make sure everything went accordingly. I commend you for your efforts and will continue following it. I hope you don't interpret this as an attack on you. It's really nice; I just hope everyone who uses it truly comprehends the risks involved in such an intrusive program. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 15, 2010 Author Share Posted April 15, 2010 I would hope that users are aware of such dangers of a batch find and replace program - and if they are not then: Use this program at your own risk! Thanks for the compliments - I just wish I had more time to work on it in between studying... Quote Link to comment Share on other sites More sharing options...
ayman Posted April 16, 2010 Share Posted April 16, 2010 nice code mr lee but if i have many number and i would like to search in number between 1.20-1.50 is that possible Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 16, 2010 Author Share Posted April 16, 2010 nice code mr lee but if i have many number and i would like to search in number between 1.20-1.50 is that possible Not currently - the function doesn't have wildcard matching as yet, but only partial/whole word matching. Lee Quote Link to comment Share on other sites More sharing options...
DAVIDr2pa Posted April 22, 2010 Share Posted April 22, 2010 This is a great routine! Thanks! Question: It ignores locked layers which is great but sometimes folks here forget to lock the proper layers. Is there a place in the code where I can add to the locked layer list? (my layer that I want to lock is called Attributes). Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 22, 2010 Author Share Posted April 22, 2010 Thanks David, I'm glad you like it. There isn't currently a facility to add to the locked layers list - just the option to ignore them all. I'm currently in the process of upgrading the code for this program, as it is flawed in a big way when it comes to MText with nested formatting - which I hope to resolve in the near future. Lee Quote Link to comment Share on other sites More sharing options...
DAVIDr2pa Posted April 22, 2010 Share Posted April 22, 2010 Lee - I'm fairly fluent with LISP - is there a place in the code where I can just add the layer to ignore? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 22, 2010 Author Share Posted April 22, 2010 Yes, here: ... (vlax-for lay (vla-get-Layers oDoc) (if (eq :vlax-true (vla-get-Lock lay)) (progn (vla-put-lock lay :vlax-false) (setq Locked (cons lay Locked) LockedLayers (cons (strcase (vla-get-name lay)) LockedLayers))))) (or (vl-position "ATTRIBUTES" LockedLayers) (setq LockedLayers (cons "ATTRIBUTES" LockedLayers))) (vlax-for lay (vla-get-Layouts oDoc) ... Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 22, 2010 Share Posted April 22, 2010 You know, that's not a bad idea to add an option to ignore objects on layers matching a specified string filter. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 22, 2010 Author Share Posted April 22, 2010 You know, that's not a bad idea to add an option to ignore objects on layers matching a specified string filter. I'll consider it Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 22, 2010 Share Posted April 22, 2010 I'll consider it I'm just waiting on a 'Search' only option.:wink: Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 22, 2010 Author Share Posted April 22, 2010 I'm just waiting on a 'Search' only option.:wink: True, as you probably know though, time is short with exams, and I want to get the Mtext formatting fixed first... Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 22, 2010 Share Posted April 22, 2010 True, as you probably know though, time is short with exams, and I want to get the Mtext formatting fixed first... Oh yes, I totally understand. Quote Link to comment Share on other sites More sharing options...
therock005 Posted April 27, 2010 Share Posted April 27, 2010 The program will replace text strings within multiple drawings in a directory (and subdirectories). The program will search Text, MText, Dimension Text, Leaders, MLeaders, and Block Attributes. Help can be found in the Code Header: Preview: Editing an Entry: Options Dialog: Function Syntax: BFind ;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;;; ;;;ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,¤º°`°º¤;;; ;; ;; ;; ;; ;; --=={ Batch Find & Replace }==-- ;; ;; ;; ;; Will Find and Replace strings entered by the user within Text, MText, Block ;; ;; Attributes, MLeader Text, Table Text and Dimensions within the current ;; ;; drawing and/or a directory (and subdirectories) of drawings. ;; ;; ;; ;; The user can choose which objects to search, whether the find string is ;; ;; case sensitive, and whether to search for whole words only, i.e. strings ;; ;; that match the Find String exactly in length. ;; ;; ;; ;; Example: Find ~ AutoCAD => Replace With ~ CAD ;; ;; ;; ;; With 'Match Case' ON: AutoCAD => CAD ;; ;; ;; ;; With 'Match Case' OFF: AutoCAD => CAD ;; ;; AUTOCAD => CAD ;; ;; AuToCaD => CAD ;; ;; ;; ;; ;; ;; The user can also choose to 'Ignore Locked Layers', with this option set, ;; ;; all objects on Locked Layers are not searched for the Find String, else all ;; ;; objects are searched. ;; ;; ;; ;; ;; ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; ;; ;; ;; FUNCTION SYNTAX: BFind ;; ;; ;; ;; Notes:- ;; ;; --------- ;; ;; As usual the known bug with ObjectDBX arises when it comes to attribute ;; ;; alignment after modification. A sub-function has been included to try to ;; ;; allow for the shift in position, however it is not 100% foolproof, and a ;; ;; slight shift in position may be noticed. The attribute is realigned when the ;; ;; block is moved manually. ;; ;; ;; ;; As expected, when using the Batch Find and Replace, drawing thumbnails are ;; ;; lost upon saving with ObjectDBX. These return when the drawing is saved ;; ;; manually. ;; ;; ;; ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; ;; ;; ;; AUTHOR: ;; ;; ;; ;; Copyright © Lee McDonnell, March 2010. All Rights Reserved. ;; ;; ;; ;; { Contact: Lee Mac @ TheSwamp.org, CADTutor.net } ;; ;; ;; ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; ;; ;; ;; VERSION: ;; ;; ;; ;; ø 1.0 ~¤~ 24th March 2010 ~¤~ ;; ;; ;; ;; º First Release ;; ;;...............................................................................;; ;; ø 1.1 ~¤~ 26th March 2010 ~¤~ ;; ;; ;; ;; º Added Options Button. ;; ;; º Updated String Replacement functions to allow for case sensitivity ;; ;; options. ;; ;; º Upgraded StringRep function to allow replacement string to contain find ;; ;; string. ;; ;; º Fixed bug causing an unsaved drawing to be saved. ;; ;;...............................................................................;; ;; ø 1.2 ~¤~ 29th March 2010 ~¤~ ;; ;; ;; ;; º Added ability to perform multiple replacements. ;; ;;...............................................................................;; ;; ø 1.3 ~¤~ 31st March 2010 ~¤~ ;; ;; ;; ;; º Added ability to edit find and replace entry by double-clicking. ;; ;; º Added 'Table Text' object to Options Dialog. ;; ;; º Added 'Find Whole Words Only' option to Options Dialog. ;; ;; º Redesigned Options Dialog to accommodate new toggles, added mnemonics. ;; ;;...............................................................................;; ;; ;; ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=;; ;; ;; ;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;;; ;;;ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,¤º°`°º¤;;; --=={ Code Updated to Version 1.3 }==-- Good job, looks great, but cant the same thing be done natively in Autocad with the FIND command? I'm looking for a procedure that lists all available text inside a drawing and lets you replace on the fly with no searching for specific strings. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 27, 2010 Author Share Posted April 27, 2010 Good job, looks great, but cant the same thing be done natively in Autocad with the FIND command? Not for multiple drawings at the same time I don't think... Quote Link to comment Share on other sites More sharing options...
Least Posted April 27, 2010 Share Posted April 27, 2010 I don't think the FIND can replace multiple find and replace strings, or can it? Lee, I think there is a bug with the 'match whole words only' option. It doesn't seem to recognise a space as a break between words. CBF -> C/B CBF 1.3 should change to C/B 1.3 but instead it remains unchanged bfind version 1.3. Cheers P Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 27, 2010 Author Share Posted April 27, 2010 Thanks for that Pad, I'm currently working on a newer String Replace function that will replace the main engine in this program, but its having the time... Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 27, 2010 Share Posted April 27, 2010 Not for multiple drawings at the same time I don't think... You are correct. Quote Link to comment Share on other sites More sharing options...
Least Posted April 27, 2010 Share Posted April 27, 2010 but its having the time... that's always a problem in this day and age! there's no rush though, take it easy.. P Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 27, 2010 Author Share Posted April 27, 2010 You are correct. Thank goodness for that - that would have been a lot of code down the drain otherwise... that's always a problem in this day and age!there's no rush though, take it easy.. P Sure, this is only a hobby anyway... after all: Exams > LISP 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.