
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, as in title, i have a routine that craetes lots of blocks, each with a hatch inside, but when i insert it hachs come to top so i cant see annotations. I found a lisp from LeeMac here
http://www.cadtutor.net/forum/archive/index.php/t-60244.html?
And I tryed to adapt it to my needs but its failing. I changed the function's name and added a parameter (blk = the block to be "fixed"), "AcDbWipeout" has become "AcDbHatch" and (SSGET "X" '((0 . "INSERT"))) changed to (SSADD blk).
I attach a indented file, more readable... Any help is very welcome! Thanks
;; Lee Mac 17.06.11
(defun BlkToBottom (blk / acblk acdoc acsel name obj processed LM:SortentsTable)
(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") )
)
)
(setq acdoc (vla-get-activedocument (vlax-get-acad-object))
acblk (vla-get-blocks acdoc)
)
(if (SSADD blk)
(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)
)
)
)
Solved! Go to Solution.