MarcoW Posted March 6, 2010 Posted March 6, 2010 A long time ago I used a lisp file that worked almost the same as the "ddatte" function / dialog. I believe it was part of an application, that I no longer work with since several years. One big difference to the ommon "ddatte dialog" was that it had toggle switches (checkboxes) to set the attribute to visible / invisible. Does anyone around still have that / such routine? I'd be glad to get a copy. Quote
Lee Mac Posted March 6, 2010 Posted March 6, 2010 This will make your Atts invisible: (defun c:invis (/ ent obj) (vl-load-com) (while (setq ent (car (nentsel "\nSelect Attribute: "))) (if (eq "ATTRIB" (cdr (assoc 0 (entget ent)))) (vlax-put (setq obj (vlax-ename->vla-object ent)) 'invisible -1))) (princ)) Or, as a different functionality, this will make all tags with the listed name visible/invisible: Upon Selection (defun c:am1 (/ tag ss att obj) (vl-load-com) (setq tag "TAG1") (while (setq ss (ssget "_+.:E:S" '((0 . "INSERT") (66 . 1)))) (foreach att (append (vlax-invoke (setq obj (vlax-ename->vla-object (ssname ss 0))) 'GetAttributes) (vlax-invoke obj 'GetConstantAttributes)) (if (eq tag (strcase (vla-get-TagString att))) (vlax-put att 'Invisible (~ (vlax-get att 'Invisible)))))) (princ)) All Blocks: (defun c:am2 (/ tag ss sel) (vl-load-com) (setq tag "TAG1") ;; <<-- Tag to be Searched (and (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1)))) (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object)))) (foreach att (append (vlax-invoke Obj 'GetAttributes) (vlax-invoke Obj 'GetConstantAttributes)) (if (eq tag (strcase (vla-get-TagString att))) (vlax-put att 'Invisible (~ (vlax-get att 'Invisible)))))) (vla-delete sel)) (princ)) Quote
alanjt Posted March 6, 2010 Posted March 6, 2010 Have a look at this thread... http://www.cadtutor.net/forum/showthread.php?p=283952&highlight=visible#post283952 Quote
MarcoW Posted March 7, 2010 Author Posted March 7, 2010 This will make your Atts invisible: (defun c:invis (/ ent obj) (vl-load-com) (while (setq ent (car (nentsel "\nSelect Attribute: "))) (if (eq "ATTRIB" (cdr (assoc 0 (entget ent)))) (vlax-put (setq obj (vlax-ename->vla-object ent)) 'invisible -1))) (princ)) Or, as a different functionality, this will make all tags with the listed name visible/invisible: Upon Selection (defun c:am1 (/ tag ss att obj) (vl-load-com) (setq tag "TAG1") (while (setq ss (ssget "_+.:E:S" '((0 . "INSERT") (66 . 1)))) (foreach att (append (vlax-invoke (setq obj (vlax-ename->vla-object (ssname ss 0))) 'GetAttributes) (vlax-invoke obj 'GetConstantAttributes)) (if (eq tag (strcase (vla-get-TagString att))) (vlax-put att 'Invisible (~ (vlax-get att 'Invisible)))))) (princ)) All Blocks: (defun c:am2 (/ tag ss sel) (vl-load-com) (setq tag "TAG1") ;; <<-- Tag to be Searched (and (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1)))) (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object)))) (foreach att (append (vlax-invoke Obj 'GetAttributes) (vlax-invoke Obj 'GetConstantAttributes)) (if (eq tag (strcase (vla-get-TagString att))) (vlax-put att 'Invisible (~ (vlax-get att 'Invisible)))))) (vla-delete sel)) (princ)) AM1 & AM2 are nice codes... must read into them for I dont get it at all. Tnx for that. Now: sleep on the couch! Quote
Lee Mac Posted March 7, 2010 Posted March 7, 2010 Hi Marco, Had some time this afternoon, see the attached suits you, ddatte with visibility toggles Lee ddatte2.lsp 1 Quote
MarcoW Posted March 8, 2010 Author Posted March 8, 2010 Hi Lee, Thanks for this piece of code. It works like a charm and can be of great use. See ya around, Marco. 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.