Railyn Posted March 14, 2016 Posted March 14, 2016 oh wait yes it does! that's great! it asks me to manually click the block though. can you make it automatically pick HEADER_N13? Quote
Tharwat Posted March 14, 2016 Posted March 14, 2016 oh wait yes it does! that's great! it asks me to manually click the block though. can you make it automatically pick HEADER_N13? I have asked you before but you did not reply to me about this point so I posted the codes to allow you to check that out by yourself Replace this part from the program then run the program and let me know; (setq s (ssget "_X" '((0 . "INSERT")(66 . 1)(2 . "HEADER_N13")))) Quote
Railyn Posted March 14, 2016 Posted March 14, 2016 yes, I know sorry, I think I was maybe a little unclear when I tried to say that HEADER_N13 was the attributed block name. I am very new with lisps and I don't know exactly what I am doing but you are very very helpful! I am not sure how ever if I am replacing the right part of the code because it doesn't seem to make any difference.. Sorry for being hopeless! Is it also possible to make it only hide it if both HEADER6 AND HEADER7 is blank? Sorry for changing my mind on that. Quote
Railyn Posted March 14, 2016 Posted March 14, 2016 Is it also possibly to remove the warning if no rector layer is found. This lisp will be on auto load and not all drawings will have that layer so it would pop up a lot. Again thank you so much, you have no idea how much time this will save me! Quote
Tharwat Posted March 14, 2016 Posted March 14, 2016 Never mind here it is modified completely . (defun c:Test (/ s _t) ;; Tharwat 14.03.2016 ;; (defun _t (obj / att) (if (vl-some '(lambda (x) (and (eq (strcase (vla-get-tagstring x)) "HEADER6") (setq att x)) ) (vlax-invoke obj 'getattributes) ) (vla-put-Layeron (vlax-ename->vla-object (tblobjname "LAYER" "REACTOR LAYER")) (if (eq (vla-get-textstring att) "") 0 1)) ) ) (cond ( (not (tblsearch "LAYER" "REACTOR LAYER")) (alert "Layer name <REACTOR LAYER> is not found in this drawing !") ) ( (and (princ "\nPick on Attributed Block: ") (setq s (ssget "_X" '((0 . "INSERT")(66 . 1)(2 . "HEADER_N13"))))) (_t (vlax-ename->vla-object (ssname s 0))) ) (t (princ "\nBlock name <HEADER_N13> is not found !") ) ) (princ) )(vl-load-com) Quote
Railyn Posted March 14, 2016 Posted March 14, 2016 I managed to remove the alert! Thanks! This is really cool! I will have to play around with it a little to see if it does what its supposed to but it looks really promising! Thank you so so much, my hero of the day! Quote
Tharwat Posted March 14, 2016 Posted March 14, 2016 You are most welcome. Just ask if you have any question. Quote
pavilon Posted November 3, 2017 Posted November 3, 2017 Sorry to hijack this thread, I found Tharwat lisp very close to my need. I am wondering how to : (defun c:Test (/ s i l lst e n a) ;; Tharwat 12.9.2014 ;; (if (setq s (ssget "_X" '((0 . "INSERT") (66 . 1) (2 . "ULTRA INFO")))) (repeat (setq i (sslength s)) (mapcar '(lambda (u) (if (eq (strcase (vla-get-tagstring u)) "CIRCID") (setq lst (cons (vla-get-textstring u) lst)) ) ) (vlax-invoke (vlax-ename->vla-object (ssname s (setq i (1- i)))) 'getAttributes ) ) ) ) (if lst (while (setq a (tblnext "LAYER" (not a))) (foreach x lst (if (wcmatch (setq n (cdr (assoc 2 a))) (strcat x "*")) (entmod (subst (cons 62 (- (cdr (assoc 62 a)))) (assoc 62 (setq e (entget (tblobjname "LAYER" n)))) e ) ) ) ) ) ) (princ) )(vl-load-com) 1) apply it on Xref's layer. This routine is only matching att values of active cad file layer. 2) Turn "ON" the layer instead of "OFF" Thanks Quote
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.