Change Block Visibility depending on File Name using LISP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good morning. Would anyone know of a lisp which is easily adjustable to add multiple outcomes for this request:
I am needing a lisp which will update a dynamic-visibility block (which has 10 different visibilities), which I change depending on the file name
File Name: 01 - Visibility: First Floor
File Name: 02 - Visibility: Second Floor
File Name: 03 - Visibility: Third Floor
File Name: 04 - Visibility: Fourth Floor etc...
I have a lisp I recieved from LeeMac which allows me to manually adjust a blocks visibility which is super useful, I only use the first portion of said lisp.
If someone could help me merge this into a lisp which detects a file name and changes the visibility depending on this, then my titleblocks will be nearly fully automatic and save so much time and error.
(defun c:changevis-BLOCKNAME ( / blk idx obj sel vis )
(setq blk "BLOCK" ;; Block Name
vis "VISIBILITY" ;; New Visibility State
)
(if (setq sel (ssget "_X" (list '(0 . "INSERT") (cons 2 (strcat "`*U*," blk)) '(410 . "~Model"))))
(repeat (setq idx (sslength sel))
(if (= (strcase blk) (strcase (LM:blockname (setq obj (vlax-ename->vla-object (ssname sel (setq idx (1- idx))))))))
(LM:SetVisibilityState obj vis)
)
)
)
(princ)
)