K Baden Posted January 5, 2018 Posted January 5, 2018 Good morning all. I've found this routine that ALMOST does what i need it to do. Basically, I need this routine to only run on blocks that have a suffix of "-NI" (ex. XXX-##-XX-#-NI) at the end of the block name. Does anyone have any idea how to do this? I'm not great working with vla stuff. Anything helps! Thanks!! EDIT: just FYI these will be dynamic blocks, if that makes any difference. (defun c:Test (/ doc) (vlax-for bks (vla-get-blocks (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)) ) ) (if (and (eq :vlax-false (vla-get-islayout bks)) (eq :vlax-false (vla-get-isXref bks)) ) (vlax-for obj bks (if (and (wcmatch (vla-get-objectname obj) "AcDbHatch" ) (vlax-write-enabled-p obj) ) (vla-delete obj) ) ) ) ) (vla-regen doc AcAllViewports) (princ) )(vl-load-com) Quote
Tharwat Posted January 5, 2018 Posted January 5, 2018 Hi, Its a good manner to reference the codes to the link where you got them from as long as you are not the one who wrote them. Right? (if (and (eq :vlax-false (vla-get-islayout bks)) (eq :vlax-false (vla-get-isXref bks)) (wcmatch (vla-get-name bks) "*-NI") ) ( ....... Quote
K Baden Posted January 5, 2018 Author Posted January 5, 2018 This is perfect, thank you! I've honestly had this one sitting around for a while after using it for another application a while back! I'm not too sure where it came from! Very appreciative to whoever did write it though! Works great, and thank you very much for the extra line! 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.