Inferno Posted June 30, 2014 Share Posted June 30, 2014 I've been using this lisp to fill in the attribute on agroup of blocks. We recently loaded all of our standard blocks onto a toolpalette. The problem I’m having is that the ssget seams to ignore the block ifit was inserted from the tool palette. IfI insert the block via Insert/Block, the lisp will add the text correctly. If I drag a functioning block onto the toolpalette and reinsert it into the same drawing the ssget ignores it. The only way I can make it work is to remove the block namefilter, but I can’t explain why that would make a difference. I tried adding a wild card to the bock nameand the ssget still ignores its. Any help would be appreciated. (defun C:ELVMKNB ( / );PT1 PT2 Mrknbr ss i sn n e ) ;;; Tharwat 27. march. 2012 ;;; ;;; Jeff E June 2014 ;;; (while (SETQ PT1 (GETPOINT "\nSelect the LOWER LEFT corner of the Elevation: ")) (SETQ PT2 (GETCORNER PT1 "\nSelect the UPPER RIGHT corner of the Elevation: ")) (setq Mrknbr (getstring "\nEnter Elevation Number and Page Number (XX/X.XX): ")) (command "_zoom" "W" pt1 pt2) (if (setq ss (ssget "W" PT1 PT2 '((0 . "INSERT")(2 . "MRKNUM2")(66 . 1)))) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (setq n (entnext sn)) (while (not (eq (cdr (assoc 0 (setq e (entget n)))) "SEQEND" ) ) ;(setq Mkr (strcat (cdr (assoc 1 e)) Mrknbr)) (if (eq (strcase (cdr (assoc 2 e))) "ELEV#") (entmod (subst (cons 1 Mrknbr ) (assoc 1 e) e)) ) (setq n (entnext n)) ) ) ) ;end repeat (princ) (command "_zoom" "p") (princ "BLOCKES CHANGED:")(PRINC (sslength ss)) (PRINC " SELECT NEXT ELEVATION") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
ShawnD Posted July 1, 2014 Share Posted July 1, 2014 (entmod (subst (cons 1 Mrknbr ) (assoc 1 e) e)) I'm not entirely sure what your code does, but are you sure the object has a dotted pair for code 1? My script to change attribute colors was failing because I was trying to (subst) (cons 62 color) for (assoc 62 blockname). As it turns out, such a dotted pair does not exist unless the attribute color was changed previously. Freshly inserted blocks didn't have a dotted pair indicating color; it would assume the colors stated in the block definition until stated otherwise. Maybe you're having the same problem. Do an (entget e) to check if there is an entry for (1 . something). If the entry doesn't exist, use (append) instead of (subst) Quote Link to comment Share on other sites More sharing options...
7o7 Posted July 1, 2014 Share Posted July 1, 2014 You shouldn't do the ssget with dynamic block name, only (ssget '((0 . "INSERT") (66 . 1)) , because dynamic block can easily change to anonymous block with name like "*U..." , and you can't get them. Instead you use function vla-get-EffectiveName to choose the exact blocks. Quote Link to comment Share on other sites More sharing options...
ShawnD Posted July 2, 2014 Share Posted July 2, 2014 You shouldn't do the ssget with dynamic block name, only (ssget '((0 . "INSERT") (66 . 1)) , because dynamic block can easily change to anonymous block with name like "*U..." , and you can't get them. Instead you use function vla-get-EffectiveName to choose the exact blocks. Very interesting. That would explain why a different script of mine couldn't change the text or mtext color in dynamic blocks. It was trying to -bedit the block based on ssget, but it would end up opening block editor with no block. I'll keep this in mind next time. Quote Link to comment Share on other sites More sharing options...
Inferno Posted July 7, 2014 Author Share Posted July 7, 2014 You shouldn't do the ssget with dynamic block name, only (ssget '((0 . "INSERT") (66 . 1)) , because dynamic block can easily change to anonymous block with name like "*U..." , and you can't get them. Instead you use function vla-get-EffectiveName to choose the exact blocks. Thanks 7o7. You are correct about Autocad changing a dynamic block name to an anonymousblock. Looks like I will need to find awork around. Quote Link to comment Share on other sites More sharing options...
7o7 Posted July 8, 2014 Share Posted July 8, 2014 You're very welcome. Quote Link to comment Share on other sites More sharing options...
Man-in-a-boat Posted July 23, 2016 Share Posted July 23, 2016 I found this thread because I was trying to use ssget to group objects so that I could set visibility states. I have gotten away with it previously but the one a ran into problems with has 15 visibilty states (if I can get it to work). So......what do you commonly do to group objects so that you can define visibility???? I am trying to create fifteen vis states with a couple of flips, a couple rotates, a property table for five attributes and a couple attributes with values defined by user input. Each of the seven attributes get written out to excel. I'm following a flow diagram but any way of making the vis states a little less cumbersome would be great for this as well as future definitions. 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.