Jump to content

Attribute w/ Background Mask


Pineapple

Recommended Posts

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    6

  • gilsoto13

    5

  • Pineapple

    3

  • rhatx

    3

Single-line attribute: I haven't figured it out, don't think there is a way.

 

Multi-line attribute: enter default value (click ...) should open a light version of mtext editor, right click and select background Mask, choose your settings and press ok.

Link to comment
Share on other sites

Im not sure what you mean, im new, but if your talking about what I think you are I want to know.

 

have you ever heard of the wipeout command? say you have a rectangle, using the wipeout command it will make everything inside that rectangle black without erasing whats behind it. Is that what you call a mask?

Link to comment
Share on other sites

Multi-line attribute: enter default value (click ...) should open a light version of mtext editor, right click and select background Mask, choose your settings and press ok.

 

This works perfectly! Thanks. I considered using a wipeout, but because I'm dealing with text, the size of the wipeout would need to change to accommodate the number of characters. The ideal way to handle this is with a Background Mask. You can set it for most multiline text objects like Mtext and Multileaders. Until now, I didn't even realize you could set attributes as Multiline. Thanks again!

Link to comment
Share on other sites

Are you after the TEXTMASK command?

 

Nah, I think that command just adds a Wipeout around the text. But the wipeout is fixed, so if I change the size of the text, the wipeout wouldn't change. "Background Mask" is exactly what I'm looking for. The only way I've found it is by going into _mtedit, right-clicking, and going to Background mask. The solution posted earlier worked great!

Link to comment
Share on other sites

Multiline Attributes came out in AutoCAD 2008...I forgot to mention this on my original post.

 

I have also seen wipeouts, 3Dface, solid, or regions used within a dynamic block with visibility states.

Link to comment
Share on other sites

"Background Mask" is exactly what I'm looking for. The only way I've found it is by going into _mtedit, right-clicking, and going to Background mask. The solution posted earlier worked great!

 

You can also access BACKGROUND MASK in the properties of an MTEXT object. I have properties open all the time, anchored to the left of my screen. That way I can select an MTEXT object and toggle the background mask directly.

 

That is the quickest way I have found to use BACKGROUND MASK.

Link to comment
Share on other sites

  • 1 year later...
merry christmas :)

;;; ------------------------------------------------------------------------
;;;    TextMaskToggle.lsp v1.2
;;;
;;;    Copyright© 03.10.09
;;;    Alan J. Thompson (alanjt)
;;;
;;;    Permission to use, copy, modify, and distribute this software
;;;    for any purpose and without fee is hereby granted, provided
;;;    that the above copyright notice appears in all copies and
;;;    that both that copyright notice and the limited warranty and
;;;    restricted rights notice below appear in all supporting
;;;    documentation.
;;;
;;;    Allows user to toggle the Textmask state of selected
;;;    Mtext and/or Multileaders.
;;;
;;;    Revision History:
;;;
;;;    v1.1 (03.16.09) Added ability to set offset (default is 1.0)
;;;    v1.2 (05.25.09) Minor cosmetic changes to coding and updated
;;;            subroutines.
;;;
;;; ------------------------------------------------------------------------

(defun c:TGM (/) (c:TextmaskToggle))
(defun c:TextMaskToggle (/             *error*       AT:SS->List
                        AT:Undo       #BackgroundOffset
                        #SSList       #Object       #Ent
                       )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SUBROUTINES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;error handler
 (defun *error* (msg)
   (AT:Undo "V" "E")
   (if
     (not
       (member
         msg
         '("console break" "Function cancelled" "quit / exit abort")
       ) ;_ member
     ) ;_ not
      (princ (strcat "\nError: " msg))
   ) ;_ if
 ) ;_ defun


;;; Convert selection set to list of ename or vla objects
;;; #Selection - SSGET selection set
;;; #VLAList - T for vla objects, nil for ename
;;; Alan J. Thompson, 04.20.09
 (defun AT:SS->List (#Selection #VlaList / #List)
   (and #Selection
        (setq #List (vl-remove-if
                      'listp
                      (mapcar 'cadr (ssnamex #Selection))
                    ) ;_ vl-remove-if
        ) ;_ setq
        (if #VlaList
          (setq #List (mapcar 'vlax-ename->vla-object #List))
        ) ;_ if
   ) ;_ and
   #List
 ) ;_ defun


;;; Undo Begin/End (Either VLA or Command)
;;; #CommandVLA - "V" for VLA OR "C" for Command
;;; #BeginEnd - "B" for Undo Begin OR "E" for Undo End
;;; Alan J. Thompson, 03.23.09
(defun AT:Undo (#CommandVLA #BeginEnd / #OldCmdecho)
 (if
   (and
     (member (strcase #CommandVLA) (list "C" "V"))
     (member (strcase #BeginEnd) (list "B" "E"))
   ) ;_ and
    (cond
      ;; COMMAND Undo Options
      ((eq "C" (strcase #CommandVLA))
       (setq #OldCmdecho (getvar "cmdecho"))
       (setvar "cmdecho" 0)
       (cond
         ;; Undo Begin
         ((eq "B" (strcase #BeginEnd)) (command "_.undo" "_begin"))
         ;; Undo End
         ((eq "E" (strcase #BeginEnd)) (command "_.undo" "_end"))
       ) ;_ cond
       (setvar "cmdecho" #OldCmdecho)
      )
      ;; VLA Undo Options
      ((eq "V" (strcase #CommandVLA))
       (cond
         ;; Undo Begin
         ((eq "B" (strcase #BeginEnd))
          (vla-StartUndoMark
            (vla-get-ActiveDocument
              (vlax-get-Acad-Object)
            ) ;_ vla-get-ActiveDocument
          ) ;_ vla-StartUndoMark
         )
         ;; Undo End
         ((eq "E" (strcase #BeginEnd))
          (vla-EndUndoMark
            (vla-get-ActiveDocument
              (vlax-get-Acad-Object)
            ) ;_ vla-get-ActiveDocument
          ) ;_ vla-EndUndoMark
         )
       ) ;_ cond
      )
    ) ;_ cond
 ) ;_ if
) ;_ defun


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MAIN ROUTINE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (vl-load-com)

 (AT:Undo "V" "B")
 ;; background offset setting
 (setq #BackgroundOffset 1.0)

 (cond
   ;; select mtext and multileaders
   ((setq #SSList
           (AT:SS->List (ssget ":L" '((0 . "MTEXT,MULTILEADER"))) T)
    ) ;_ setq
    ;; something selected, time to process data
    (mapcar
      '(lambda (x)
         (cond
           ;; mtext
           ((eq (vla-get-ObjectName x) "AcDbMText")
            (if (eq (vla-get-backgroundfill x) :vlax-false)
              (progn
                ;; set backgroundfill to true
                (vla-put-backgroundfill x :vlax-true)
                ;; convert object to ename and entmod offset
                (setq #Ent (entget (vlax-vla-object->ename x)))
                (entmod (subst (cons 45 #BackgroundOffset)
                               (assoc 45 #Ent)
                               #Ent
                        ) ;_ subst
                ) ;_ entmod
              ) ;_ progn
              ;; set backgroundfill to false
              (vla-put-backgroundfill x :vlax-false)
            ) ;_ if
           )
           ;; multileader
           ((eq (vla-get-Objectname x) "AcDbMLeader")
            (if (eq (vla-get-TextBackgroundFill x) :vlax-false)
              (progn
                ;; set background fill to true
                (vla-put-TextBackgroundFill x :vlax-true)
                ;; convert object to ename and entmod offset
                (setq #Ent (entget (vlax-vla-object->ename x)))
                (entmod (subst (cons 141 #BackgroundOffset)
                               (assoc 141 #Ent)
                               #Ent
                        ) ;_ subst
                ) ;_ entmod
              ) ;_ progn
              ;; set backgroundfill to false
              (vla-put-TextBackgroundFill x :vlax-false)
            ) ;_ if
           )
         ) ;_ cond
       ) ;_ lambda
      #SSList
    ) ;_ mapcar
   )
 ) ;_ cond

 (AT:Undo "V" "E")

 (princ)
) ;_ defun

 

I can see it will add the background mask to all mtext selected, as we may use the textmask for all text and mtext ...

 

But I am trying to go further here.. I am stuck and I guess this is the ending wall for the moment.

------------------------------------

I am trying to make an attribute block with mask, I did it the way with multiline attribute, and works, but it is necessary to set the background mask by right clicking and going to the properties in every new block we insert from an outside block drawing… If we have the block inside, we can copy it multiple times, but

 

Do you know if it’s possible to set the background mask property to the multilined attribute and leave it as if it was an mtext property?

(To avoid setting the mask everytime we insert the block from outside the current drawing)

Edited by gilsoto13
Link to comment
Share on other sites

yes, when you create the multiline attribute, and set the default. on the far right of the editor, you will see a down arrow, click on that, and you can set "Background Mask"

 

I can see it will add the background mask to all mtext selected, as we may use the textmask for all text and mtext ...

 

But I am trying to go further here.. I am stuck and I guess this is the ending wall for the moment.

------------------------------------

I am trying to make an attribute block with mask, I did it the way with multiline attribute, and works, but it is necessary to set the background mask by right clicking and going to the properties in every new block we insert from an outside block drawing… If we have the block inside, we can copy it multiple times, but

 

Do you know if it’s possible to set the background mask property to the multilined attribute and leave it as if it was an mtext property?

(To avoid setting the mask everytime we insert the block from outside the current drawing)

Link to comment
Share on other sites

yes, when you create the multiline attribute, and set the default. on the far right of the editor, you will see a down arrow, click on that, and you can set "Background Mask"

 

aAAAAnnenee... I couldn´t find it (before)... Thanks a la... Alan.

 

You made my day again.. Now there's no limit for our masked standard blocks.

EXAMPLE.dwg

Link to comment
Share on other sites

aAAAAnnenee... I couldn´t find it (before)... Thanks a la... Alan.

 

You made my day again.. Now there's no limit for our masked standard blocks.

glad you got what you wanted :)

nice block too.

Link to comment
Share on other sites

Ok, got the background mask to work, now how do I pass text to this attrib via lisp?

(vlax-safearray->list
 (vlax-variant-value
   (vla-getattributes
     (vlax-ename->vla-object
       (car
         (entsel))))))

 

From there, you can foreach through them.

Link to comment
Share on other sites

hmmm, unfortunately I am not familiar with active x? programming, just a simple lisp guy. The routine I am working on inserts a block with an attribute on a line to designate the piping system type. The user is prompted for the letter(s) at the start of the lisp then the insert command is run and the block is inserted at a point on the line.

Link to comment
Share on other sites

hmmm, unfortunately I am not familiar with active x? programming, just a simple lisp guy. The routine I am working on inserts a block with an attribute on a line to designate the piping system type. The user is prompted for the letter(s) at the start of the lisp then the insert command is run and the block is inserted at a point on the line.

LoL

I completely misread via lisp as Visual Lisp. If you are just using the command to insert your blocks, have your 'attdia' variable on and it will prompt you for the attribute values when it inserts them. From there, you could input the defined data.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...