- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello i am trying to add a super practical LISP code i found that will change all block items layer to "0" layer and end the "CANNOT DELETE LAYER BECAUSE IT IS BEING USED BY BLOCK(S)" issue.
It is my first time creating a LISP, though i followed a tutorial before this one and got the code they were using to work properly.
I found this code code i want to use here: < http://forums.augi.com/showthread.php?127731-changing-multiple-blocks-to-quot-0-quot-layer >
Here is the error message COPIED FROM MY COMMAND LINE:
Command: FIXBLKS
Select objects: 1 found
Select objects: undo Current settings: Auto = On, Control = All, Combine = Yes, Layer = Yes
Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back] <1>: BEgin
Command: ; error: no function definition: VLAX-ENAME->VLA-OBJECT
I will attach a copy of the .lsp i created with this post as well for anyone who wished to review.
Here is the code copied
[This is an amateur question but should not the code start at the "(defun.....)" and not "; written by:....." ??]:
; Written By: Tom Beauford ; Changes all block entities to layer "0" with color, linetype & lineweight ByBlock (defun C:FIXBLKS (/ SSET intCount ENAM ELST BNAM FLST FIX1) (defun FIX1 (BNAM / BENAM BONAM) (if (not (member BNAM FLST)) (progn (setq FLST (cons BNAM FLST) BENAM (tblobjname "block" BNAM) ) (while (setq BENAM (entnext BENAM)) (if (= (cdr (assoc 0 (entget BENAM))) "INSERT") (fix1 (cdr (assoc 2 (entget BENAM)))) (progn (setq BONAM(vlax-ename->vla-object BENAM)) (vl-catch-all-apply 'vla-put-layer (list BONAM "0")) (vl-catch-all-apply 'vla-put-color (list BONAM 0)) (vl-catch-all-apply 'vla-put-linetype (list BONAM "Byblock")) (vl-catch-all-apply 'vla-put-Lineweight (list BONAM -2)) ; (vl-catch-all-apply 'vla-put-PlotStyleName (list BONAM "Byblock")) ) ) ) ) ) ) (setq SSET (ssget (list (cons 0 "INSERT")))) (vl-cmdf "undo" "BEgin") (repeat (setq intCount (sslength SSET)) (setq intCount (1- intCount) ENAM (ssname SSET intCOunt) ELST (entget ENAM) BNAM (cdr (assoc 2 ELST)) FLST nil ) (fix1 BNAM) ) (vl-cmdf "undo" "End") (vl-cmdf "regen") (princ) )
Solved! Go to Solution.