aridzv Posted August 18, 2023 Share Posted August 18, 2023 (edited) Hi. I have a lisp that update blocks attributes. I'm trying to add an option to change the attribute visibility state, including *U blocks (as usual...) dynamic & parametric blocks - see block No. 4 in the sample drawing. in this code it makes the attribute to complitly disappear... (defun c:chatht15-1 ( / ta an bent bent2 pt lay tagname ss bname x att temp YN VSBL ) (vl-load-com) ;;(vlax-put-property x 'visible :vlax-false) (setq tagname "ORDER") (setq ss (ssget (list (cons 0 "INSERT")))) (setq ht (getreal "\nEnter text height<24>: ")) (if (= ht nil) (setq ht 24) ) (setq an (getreal "\nEnter Rotation<0>: ")) (if (= an nil) (setq an 0) ) (initget "YES NO") (if (null (setq VSBL (getkword "\nVisible [YES/NO] <NO>: "))) (vla-put-invisible att :vlax-false) ) (princ VSBL) (setq tagname (strcase (getstring "\nAttribute tag specification<ORDER>: "))) (if (= tagname "") (setq tagname "ORDER") ) (initget "Yes No") (if (null (setq YN (getkword "\nClear Attribute Value? [Yes/No] <No>: "))) (setq YN "No") ) (setq an (/ (* an pi) 180)) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1) )))) (if (= (vla-get-hasattributes obj) :vlax-true) (foreach att (vlax-invoke obj 'getattributes) (if (= tagname (strcase (vla-get-tagstring att))) (progn (vla-put-Rotation att an) (vla-put-height att ht) (if (= (vlax-get-property att 'Backward) :vlax-true) (vlax-put-property att 'Backward :vlax-false) ) (if (= (vlax-get-property att 'UpsideDown) :vlax-true) (vlax-put-property att 'UpsideDown :vlax-false) ) (if (= YN "Yes") (vla-put-textstring att "") ) ;; (vlax-put-property att 'visible :vlax-false) (if (= VSBL "NO") (progn (vla-put-invisible att :vlax-false) (vla-put-invisible att :vlax-true) ;;(vlax-put-property att 'visible :vlax-false) ;;(vlax-put-property att 'visible :vlax-true) );;close progn );;close if );;close progn ) ) ) ) (princ) ) I also attached a sample drawing. Thanks, aridzv. Drawing1.dwg Edited August 19, 2023 by aridzv Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 19, 2023 Share Posted August 19, 2023 You have no att when calling this (vla-put-invisible att :vlax-false) will error. needs to go after this (if (= tagname (strcase (vla-get-tagstring att))) I would look at a DCL as well much easier to have all the questions in front of you. Quote Link to comment Share on other sites More sharing options...
aridzv Posted August 19, 2023 Author Share Posted August 19, 2023 (edited) Hi @BIGAL and thanks for your reply!! thanks for pointing the issue with the redundant (vla-put-invisible att :vlax-false) - fixed it and it led me to find some more issues that was fixed - the revised code attached here below. DCL is Way beyond my abilities for now... thanks again, aridzv. (defun c:chatht15 ( / ta an bent bent2 pt lay tagname ss bname x att temp YN VSBL ) (vl-load-com) (setq ss (ssget (list (cons 0 "INSERT")))) (setq ht (getreal "\nEnter text height<24>: ")) (if (= ht nil) (setq ht 24) ) (setq an (getreal "\nEnter Rotation<0>: ")) (if (= an nil) (setq an 0) ) (initget "YES NO") (setq VSBL (getkword "\nVisible [YES/NO] <NO>: ")) (if (= VSBL nil) (setq VSBL "NO") ) (setq tagname (strcase (getstring "\nAttribute tag specification<ORDER>: "))) (if (= tagname "") (setq tagname "ORDER") ) (initget "Yes No") (if (null (setq YN (getkword "\nClear Attribute Value? [Yes/No] <No>: "))) (setq YN "No") ) (setq an (/ (* an pi) 180)) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1) )))) (if (= (vla-get-hasattributes obj) :vlax-true) (foreach att (vlax-invoke obj 'getattributes) (if (= tagname (strcase (vla-get-tagstring att))) (progn (vla-put-Rotation att an) (vla-put-height att ht) (if (= (vlax-get-property att 'Backward) :vlax-true) (vlax-put-property att 'Backward :vlax-false) ) (if (= (vlax-get-property att 'UpsideDown) :vlax-true) (vlax-put-property att 'UpsideDown :vlax-false) ) (if (= YN "Yes") (vla-put-textstring att "") ) ;;(vlax-put-property att 'visible :vlax-false) (if (= VSBL "NO") (vla-put-invisible att :vlax-true) (vla-put-invisible att :vlax-false) );;close if );;close progn );;close if );;close foreach );;close if );;close repeat (princ) ) Edited August 19, 2023 by aridzv Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 19, 2023 Share Posted August 19, 2023 If I can find time will do the dcl added to my To Do list. I start with a picture of what I want. Just a side note working on a make dcl from objects. 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.