sbarszczewski Posted June 10, 2016 Share Posted June 10, 2016 Hi this is my first post on forum so please be tolerant. I have many multiple dimension lines with different prefixes . the dimension text looks like that : W1/+1 (220), Prefix is diffrent for each dimension line : W1/+1 W2/+1 W3/+1 ect..... the prefix data is stored in Xdata entity. Autocad Find command doesn't work on this text , also few lisp routines I found on this forum fail. Could anybody point me to a lisp which will manage to change selected text for +1 to +2 ( or another fiven value ) for multiple dimension lines Regards Sebastian Quote Link to comment Share on other sites More sharing options...
tmelancon Posted June 10, 2016 Share Posted June 10, 2016 Can you post sample file? What type of text are you using? I just ran the Find and Replace command in autocad on standard DIMLIN and DIMALI dimensions and it worked fine. I searched for "/+1" and it found all results, I replaced with "/+2". Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 10, 2016 Share Posted June 10, 2016 Try the following basic code: (defun c:dimpre ( / a b e i s p x ) (if (and (setq s (ssget "_:L" '((0 . "*DIMENSION") (-3 ("ACAD"))))) (/= "" (setq a (getstring "\nPrefix to find: "))) (/= "" (setq b (getstring (strcat "\nReplace " a " with: ")))) ) (repeat (setq i (sslength s)) (and(setq e (ssname s (setq i (1- i)))) (setq x (cadr (assoc -3 (entget e '("acad"))))) (setq p (member '(1070 . 3) x)) (entmod (append (entget e) (list (list -3 (append (reverse (member '(1070 . 3) (reverse x))) (cons (cons 1000 (vl-string-subst b a (cdadr p))) (cddr p) ) ) ) ) ) ) (entupd e) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
tmelancon Posted June 10, 2016 Share Posted June 10, 2016 I don't know about the types of dimensions he is using, nor when he will have time to test but I have just tested on a few dimensions with his W1/+1, W2/+1. W3/+1 examples and the code you provided did not work lee. Of course things could be different on his end I am not sure. I entered W1/+1 as my prefix to be changed then W1/+2 as my target change. Nothing. I also entered /+1 as my prefix on the second run and /+2 as my target, again nothing. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 10, 2016 Share Posted June 10, 2016 I have just tested on a few dimensions with his W1/+1, W2/+1. W3/+1 examples and the code you provided did not work lee. Do you have the dimension prefix applied as a dimension style override as indicated by the OP?: ...the prefix data is stored in Xdata entity. Quote Link to comment Share on other sites More sharing options...
tmelancon Posted June 10, 2016 Share Posted June 10, 2016 My apologies. I did not add the prefix. Once I added it then tested it, your code works flawlessly. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 10, 2016 Share Posted June 10, 2016 My apologies. I did not add the prefix. Once I added it then tested it, your code works flawlessly. Excellent - thanks! Quote Link to comment Share on other sites More sharing options...
tmelancon Posted June 10, 2016 Share Posted June 10, 2016 Hey may even like the option to incorporate a list of Prefixes within the code and all dimensions on a specific layer, that way he runs the code and it evaluates and changes all the prefixes automatically without user selected objects and manually entered prefix(s). Just a thought. Quote Link to comment Share on other sites More sharing options...
tmelancon Posted June 10, 2016 Share Posted June 10, 2016 (defun c:dimpre ( / a b e i s p x ) (if (and (setq s (ssget [color=red]"X"[/color] '((0 . "*DIMENSION")[color=red](8 . "DIM")[/color](-3 ("ACAD"))))) (/= "" (setq a [color=red]"W1/+1"[/color])) (/= "" (setq b [color=red]"W1/+2"[/color])) ) (repeat (setq i (sslength s)) (and(setq e (ssname s (setq i (1- i)))) (setq x (cadr (assoc -3 (entget e '("acad"))))) (setq p (member '(1070 . 3) x)) (entmod (append (entget e) (list (list -3 (append (reverse (member '(1070 . 3) (reverse x))) (cons (cons 1000 (vl-string-subst b a (cdadr p))) (cddr p) ) ) ) ) ) ) (entupd e) ) ) ) (princ) ) 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.