attilakw Posted February 15 Posted February 15 (edited) always I get a message "no function definition: VLA-PUT-BACKGROUNDFILLCOLOR" , but it works, what is the mistake ? (defun c:ApplyMaskGreen (/ ss i ent txtObj) ;; Prompt the user to select text objects (setq ss (ssget '((0 . "TEXT,MTEXT")))) ;; Check if any text objects were selected (if ss (progn ;; Loop through each selected text object (setq i 0) (while (< i (sslength ss)) (setq ent (ssname ss i)) (setq txtObj (vlax-ename->vla-object ent)) ;; Apply background mask properties (if (vlax-property-available-p txtObj 'BackgroundFill) (progn (vla-put-BackgroundFill txtObj :vlax-true) (vla-put-BackgroundFillColor txtObj 3) ;; Green color (ACI color index 3) (vla-put-BackgroundFillGapFactor txtObj 1.0) ;; Border offset factor = 1 (vla-put-BackgroundFillUseDrawingBackgroundColor txtObj :vlax-false) ;; Uncheck "Use drawing background color" ) (princ "\nBackgroundFill property not supported for this object.") ) ;; Increment counter (setq i (1+ i)) ) (princ "\nBackground mask applied to selected text.") ) (princ "\nNo text objects selected.") ) (princ) ) Edited February 15 by SLW210 Added Code Tags! Quote
SLW210 Posted February 15 Posted February 15 Please use Code Tags in the future. (<> in the editor toolbar) Quote
GLAVCVS Posted February 15 Posted February 15 In these cases always write '(vl-load-com)' at the beginning, just in case. I don't know all the methods available in Visual Lisp by heart, and even less so without a PC in front of me. But it's possible that the method isn't implemented. Try setting the property using (vlax-put-property txObj "BackGroundFillColor" 3) Quote
marko_ribar Posted February 15 Posted February 15 TEXT entities don't have BackgroundFill property, but MTEXT have... Here is my slight intervention to your code : (defun c:ApplyMaskGreen ( / ss i ent txtObj ) ;; Prompt the user to select text objects (setq ss (ssget '((0 . "TEXT,MTEXT")))) ;; Check if any text objects were selected (if ss (progn ;; Loop through each selected text object (setq i 0) (while (< i (sslength ss)) (setq ent (ssname ss i)) (setq txtObj (vlax-ename->vla-object ent)) ;; Apply background mask properties (if (vlax-property-available-p txtObj 'BackgroundFill) (progn (vla-put-BackgroundFill txtObj :vlax-true) (setpropertyvalue ent "BackgroundFillColor" "3") ;; (vla-put-BackgroundFillColor txtObj 3) ;; Green color (ACI color index 3) ;; (vla-put-BackgroundFillGapFactor txtObj 1.0) ;; Border offset factor = 1 ;; (vla-put-BackgroundFillUseDrawingBackgroundColor txtObj :vlax-false) ;; Uncheck "Use drawing background color" ) (princ "\nBackgroundFill property not supported for this object.") ) ;; Increment counter (setq i (1+ i)) ) (princ "\nBackground mask applied to selected text.") ) (princ "\nNo text objects selected.") ) (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.