Message 1 of 8

Not applicable
02-12-2019
08:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I found this LISP routine by Peter Jamtgaard on an AUGI. It will take the entities in a block and change them to by "By Block". I find it very useful, but I can only use the command on one block at a time. I want to be able to use the commend on a selection set of blocks to speed things up. From what I have read, I need to change the 'entsel' function to ssget. I have tried a few times, but I dont know very much about writing LISPs and I have definitely doing something wrong with the syntax. Below is original LISP code by Peter Jamtgaard:
; Written By: Peter Jamtgaard 12/20/2006 ;^P(or C:BlkByBlock (load "BlkByBlock.lsp"));BlkByBlock (defun C:BlkByBlock (/ colBlockReference ActDoc dprSelection objSelection strBlockName ) (if (setq dprSelection (entsel "\nSelect Block: ")) (progn (setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)) dprSelection (car dprSelection) objSelection (vlax-ename->vla-object dprSelection) ) (vla-StartUndoMark ActDoc) (BlkByBlock objSelection) (entupd dprSelection) (vla-EndUndoMark ActDoc) ) ) (prin1) ) (defun BlkByBlock (objSelection / colBlockReference objBlock strBlockName ) (if (= (type objSelection) 'ENAME) (setq objSelection (vlax-ename->vla-object objSelection))) (if (wcmatch (strcase (vla-get-objectname objSelection)) "*BLOCK*") (progn (vlax-for objBlock (vla-item (vla-get-blocks ActDoc) (vla-get-name objSelection) ) (vla-put-color objBlock 0) ; set color byblock ; (vla-put-linetype EOBJ "ByBlock") if all you want is color byblock ; (vla-put-Lineweight EOBJ -1) if all you want is color byblock ; (vla-put-PlotStyleName EOBJ "ByBlock") if all you want is color byblock ) ) ) (prin1) ) (prin1)
Solved! Go to Solution.