pBe Posted July 26, 2015 Share Posted July 26, 2015 (edited) Ah, good point. In this case there will always be a match. I see. FWIW here is a quick draft (defun c:MRev (/ rtag NValues ss i e atttval target CurRevVal date desc ) (setq rtag "REV") (if (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1) (2 . "Drawing_Sheet_22x34,Drawing_Sheet_22x34-H") (410 . "~Model") ) ) ) (repeat (setq i (sslength ss)) (setq e (ssname ss (Setq i (1- i)))) (setq NValues '( ("DATE" "29-JUN-15") ("DESC" "BASELINE UPDATE - 101/111 RENOVATIONS"))) (if (and (setq attval (mapcar '(lambda (at) (list (vla-get-tagstring at) (vla-get-textstring at) at)) (vlax-invoke (vlax-ename->vla-object e) 'Getattributes))) (setq CurRevVal (cadr (assoc rtag attval))) (setq target (vl-some '(lambda (v) (if (and (wcmatch (setq revtag (vla-get-tagstring (setq v (last v)) ) ) (strcat rtag "#") ) (eq CurRevVal (vla-get-textstring v)) ) (substr revtag (1+ (vl-string-mismatch rtag revtag)) ) ) ) (reverse attval) ) ) (setq NValues (mapcar '(lambda (n) (subst (caddr (assoc (strcat (Car n) target) attval)) (car n) n)) NValues)) (vl-every '(lambda (m) m ) (mapcar 'car NValues))) (mapcar '(lambda (b) (vla-put-textstring (car b)(cadr b))) NValues ) (princ (strcat "\nRevision Number match not found at " (cdr (assoc 410 (entget e)) ))) ) ) ) (princ) ) (vl-load-com) Hope this helps BTW ..... as solve my initial request! Is there more to this than just updating the date and description? Edited July 27, 2015 by pBe REmoved the comments sections in the code Quote Link to comment Share on other sites More sharing options...
Da Ballz Posted July 26, 2015 Author Share Posted July 26, 2015 There is, but I've set up a batch process with a few different lisp routines which I will run on the files in question. There is one piece where I have to sort individual revision blocks by date...but I may open another thread for that. I have a few ideas on it, but I want to see what you guys come up with. Quote Link to comment Share on other sites More sharing options...
pBe Posted July 26, 2015 Share Posted July 26, 2015 ..... There is one piece where I have to sort individual revision blocks by date.. Challenge Accepted Quote Link to comment Share on other sites More sharing options...
Da Ballz Posted July 27, 2015 Author Share Posted July 27, 2015 Commandobill I'm getting the following error: error bad argument type VLA-OBJECT nil. I believe a variable type is being incorrectly passed somewhere. I'm combing through your code carefully to make sure I've got it right, but I think I need some help on this. Quote Link to comment Share on other sites More sharing options...
Da Ballz Posted July 27, 2015 Author Share Posted July 27, 2015 pBe I'm having some issues with your code. Up near the top, there is (410 . "~Model") What is that for? The blocks I am looking for will only be in paper space, but I'm not sure how that needs to be identified. Also, there is a syntax error somewhere... Quote Link to comment Share on other sites More sharing options...
pBe Posted July 27, 2015 Share Posted July 27, 2015 there is (410 . "~Model") What is that for? The blocks I am looking for will only be in paper space, but I'm not sure how that needs to be identified. "~" a filter that matches anything except the pattern, in this case the Model Space. In other words, all paper space tab except Model space. (ssget "_X" '((8 . "~Banana")) ; Also, there is a syntax error somewhere... Works fine on my end. Better yet, post an example. What of the "..to sort individual revision blocks by date.."? I'm more keen to see that puzzle. Quote Link to comment Share on other sites More sharing options...
Da Ballz Posted July 27, 2015 Author Share Posted July 27, 2015 It does work now...not sure what my problem was. And thanks for the learning on the filter stuff. I am working on the new puzzle, will post shortly 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.