REMOVE background mask from all block attributes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all:
The code I have here adds a background mask to ALL blocks attributes in a dwg...now I have colleagues who need it REMOVED. I've tried changing the "Background Fill Setting" from 3 to 0 but that doesn't work. ***text colored magenta***
I found some evidence thru online searching that indicates an AutoCAD "bug" might prevent what I want from happening. Is that still currently true? Here's my code for ADDING the block attribute masks:
;;************************* { ADD BACKGROUND MASK TO ATTRIBUTE } ****************************;;
;; ;;
;; ------------------ Designed & Created by Satish Rajdev ------------------ ;;
;; ;;
;; ------------------ Command to Invoke = "ABMA" ------------------ ;;
;; ;;
;;********************************************************************************************;;
(defun c:abma (/ a b c)
(if (setq a (ssget '((0 . "insert") (66 . 1))))
; Select blocks which has attributes
(progn
(setq c (getvar 'cmdecho))
(setvar 'cmdecho 0)
(repeat (setq i (sslength a))
(setq b (vlax-ename->vla-object (ssname a (setq i (1- i)))))
; Get block from selection set 1 by 1 here
(mapcar ; trace all attributes which block has
'(lambda (x / x1)
(setq x1 (entget (vlax-vla-object->ename x)))
; convert VL-object to autolisp object
(if (member '(101 . "Embedded Object") x1)
; check attirbutes has embedded function added
(entmod
(append
(vl-remove-if
(function (lambda (y)
(member (car y) '(45 63 90 421 431 441))
)
)
x1
)
(list (cons 90 3) ; <- Background Fill Setting (0=Background off, 1= Use background fill color, 2 = Use drawing background as fill color
(cons 63 256) ; <- Change background fill color according to color index here
(cons 45 1.125) ; <- Border Offset Factor
(cons 441 0)
)
)
) ; add this DXF codes for filling background mask
)
)
(vlax-invoke b 'getattributes); get list of attributes of block
)
(command-s "_.draworder" (vlax-vla-object->ename b) "" "_f")
)
(setvar 'cmdecho c)
)
)
(princ)
)
(vl-load-com)
(princ)
(princ
(strcat
"\n:: Add Background Mask to Attribute.lsp ::"
"\n:: Created by Satish Rajdev | "
(menucmd "M=$(edtime,$(getvar,date),DDDD\",\" D MONTH YYYY)"
)
" ::"
"\n:: Type \"ABMA\" to Invoke ::"
)
)
(princ)