rcb007 Posted August 11, 2021 Posted August 11, 2021 I was looking around and found the Hatch to Back (by Mr. Lee Mac) which does a great job. I did not know if anyone may have seen one which worked with predefined layer names or not. (defun c:test ( / acblk acdoc acsel name obj processed ) ;; Lee Mac 17.06.11 (setq acdoc (vla-get-activedocument (vlax-get-acad-object)) acblk (vla-get-blocks acdoc) ) (if (ssget '((0 . "INSERT"))) (progn (vlax-for block (setq acsel (vla-get-activeselectionset acdoc)) (if (not (member (setq name (vla-get-name block)) processed)) ( (lambda ( / lst ) (vlax-for obj (vla-item acblk name) (if (eq "AcDbHatch" (vla-get-objectname obj)) (setq lst (cons obj lst)) ) ) (if lst (vla-movetobottom (LM:SortentsTable (vla-item acblk name)) (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbobject (cons 0 (1- (length lst)))) lst ) ) ) ) (setq processed (cons name processed)) ) ) ) ) (vla-delete acsel) (vla-regen acdoc acallviewports) ) ) (princ) ) (defun LM:SortentsTable ( space / dict result ) (cond ( (not (vl-catch-all-error-p (setq result (vl-catch-all-apply 'vla-item (list (setq dict (vla-GetExtensionDictionary space)) "ACAD_SORTENTS") ) ) ) ) result ) ( (vla-AddObject dict "ACAD_SORTENTS" "AcDbSortentsTable") ) ) ) (vl-load-com) (princ) 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.