pmxcad Posted April 28, 2018 Posted April 28, 2018 Hello, I need help with the lisp. Have it adjusted to my wishes. It almost works, I just want to get rid of the "ensel part". I do not neet to manual select because the block names are already known. The blocks that have to be removed are the blocks "cabletype A" & "cabletype B" with the Lookup1 value "1". (first load dynblock.LSP) Thanks in advance, PmxCAD ;; ;;--------- Allen Johnson -------------------------------------------------------- ;; ;; find dynamic blocks ;; a command line function to select all dynamic blocks ;; with the same effective name and same visibility state (defun c:test (/ en obj effname ssdb ssfvis visname visstat c) (setq en (car (entsel))) (if en (progn (setq obj (vlax-ename->vla-object en)) (if (vlax-property-available-p obj 'effectivename) (progn (setq effname (vlax-get-property obj "effectivename")) ; first create a ss of the dynamic blocks with the right name (setq ssdb (ssdblk effname)) ; now filter for visibility (setq ssfvis (ssadd) c 0 ) (setq lookupname "Lookup1") (setq lookupstat "1") (while (< c (sslength ssdb)) (setq en (ssname ssdb c)) (setq evstat (print (getdynprop en lookupname))) ;(if (= (strcase evstat) (strcase lookupstat)) (if (= evstat (strcase lookupstat)) (ssadd en ssfvis) ) (setq c (1+ c)) ) ) (prompt "\nNot a block.\n") ) (command "erase" ssfvis) (princ) ) ) ) Thanks in advance, PmxCAD cabletype B.dwg dynblock.LSP Quote
rlx Posted April 29, 2018 Posted April 29, 2018 minimal tested (defun c:tst ( / acad doc lay obj) (setq acad (vlax-get-acad-object) doc (vla-get-activedocument acad)) (vlax-for lay (vla-get-layouts doc) (vlax-for obj (vla-get-block lay) (and (vl-every '(lambda (p)(vlax-property-available-p obj p)) '(isdynamicblock effectivename)) (member (vla-get-effectivename obj) '("cabletype A" "cabletype B")) (vl-some '(lambda (p) (and (= "Lookup1" (vla-get-propertyname p)) (eq (vlax-get p 'value) "1"))) (vlax-invoke obj 'getdynamicblockproperties)) (vla-delete obj))))) gr.Rlx 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.