See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Remove Text Mask On Select Dimension Objetcs

  1. #1
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Remove Text Mask On Select Dimension Objetcs

    Hi folks,

    I found this LISP routine below which works great to add a text mask to selected dimension objects (thanks Henrique Silva)

    What I need now is the reverse routine, so I can remove text masks from selected dimension objects.

    Code:
    (defun c:test (/ CNT ENT ENTDATA NEWENTDATA NUM SS1)  (vl-load-com)
      (setq    ss1 (ssget '((0 . "Dimension")))
        num (sslength ss1)
        cnt 0
      )
      (repeat num
        (setq ent (entget (ssname ss1 cnt)))
        (setq entdata '((-3 ("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 69) (1070 . 1) (1002 . "}")))))
        (setq newentdata (append ent entdata))
        (entmod newentdata)
        (setq cnt (1+ cnt))
      )
      (vl-cmdf "_draworder" ss1 "" "f") )
    Any help is as always, much appreciated.

  2. #2
    Member
    Join Date
    2006-12
    Location
    Cascais, Portugal
    Posts
    25
    Login to Give a bone
    0

    Default Re: Remove Text Mask On Select Dimension Objetcs

    Hi,

    to toggle dimension texto mask, perhaps something like this
    Code:
    (vl-load-com)
    (defun c:demo (/ ent entdata hnd i newentdata ss xdata)
      (if (setq ss (ssget '((0 . "Dimension"))))
        (repeat (setq i (sslength ss))
          (setq hnd	(ssname ss (setq i (1- i)))
    	    ent	(entget hnd '("ACAD"))
          )
          (if (or (not (setq xdata (assoc -3 ent)))
    	      (and (setq xdata (assoc -3 ent))
    		   (member '(1000 . "DSTYLE") (last xdata))
    		   (/= (cdr (assoc 1070 (reverse (last xdata)))) 1)
    		   (setq ent (vl-remove-if '(lambda (x) (= -3 (car x))) ent))
    	      );; and
    	  );; or
    	(setq entdata '((-3 ("ACAD" (1000 . "DSTYLE")(1002 . "{")(1070 . 69)(1070 . 1)(1002 . "}"))))
    	      newentdata (append ent entdata))
    	(setq ent (vl-remove-if '(lambda (x) (= -3 (car x))) ent)
    	      entdata '((-3 ("ACAD"(1000 . "DSTYLE")(1002 . "{")(1070 . 69)(1070 . 0)(1002 . "}"))))
    	      newentdata (append ent entdata))
    	);; if
          (entmod newentdata)
        );; repeat
      );; if
      (princ)
    );; demo
    Hope this helps
    Henrique

  3. #3
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Remove Text Mask On Select Dimension Objetcs

    Brilliant!!! Works like a charm.

    Thanks very much for your time and effort!

  4. #4
    Member
    Join Date
    2006-12
    Location
    Cascais, Portugal
    Posts
    25
    Login to Give a bone
    0

    Default Re: Remove Text Mask On Select Dimension Objetcs

    You're welcome, James
    Glad I could help

    Henrique

  5. #5
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Remove Text Mask On Select Dimension Objetcs

    How hard would it be to include Mtext and Multileaders in this routine?

    I though it might be as simple as changing the SSGET line to:

    Code:
      (if (setq ss (ssget '((0 . "Dimension,Multileader,Mtext"))))
    As you might have guessed, I'm wrong about that.

    Anyway, if its a big deal, don't sweat it. There are other text mask routines out there. Just though it might be nice to have one "catch all" command.

    Again, thanks for your time and effort.
    Last edited by jpcadconsulting347236; 2015-05-05 at 04:01 PM. Reason: Clarification

  6. #6
    Member
    Join Date
    2006-12
    Location
    Cascais, Portugal
    Posts
    25
    Login to Give a bone
    0

    Default Re: Remove Text Mask On Select Dimension Objetcs

    Quote Originally Posted by jpcadconsulting347236 View Post
    How hard would it be to include Mtext and Multileaders in this routine?
    I though it might be as simple as changing the SSGET line to:
    Code:
      (if (setq ss (ssget '((0 . "Dimension,Multileader,Mtext"))))
    As you might have guessed, I'm wrong about that.
    Anyway, if its a big deal, don't sweat it. There are other text mask routines out there. Just though it might be nice to have one "catch all" command.
    Again, thanks for your time and effort.
    James,

    quick and dirty, and not fully tested...
    Code:
    (vl-load-com)
    (defun c:TMask (/ ent entdata hnd i newentdata ob1 ss xdata)
      (if (setq ss (ssget "_:L" '((0 . "DIMENSION,MTEXT,MULTILEADER"))))
        (repeat (setq i (sslength ss))
          (setq hnd (ssname ss (setq i (1- i)))
                ent (entget hnd)
          )
          (cond ((= (cdr (assoc 0 ent)) "MTEXT")
                 (setq ob1 (vlax-ename->vla-object hnd))
                 (vlax-put ob1 'backgroundfill (~ (vlax-get ob1 'backgroundfill)))
                )
                ((= (cdr (assoc 0 ent)) "MULTILEADER")
                 (setq ob1 (vlax-ename->vla-object hnd))
                 (vlax-put ob1 'textbackgroundfill (~ (vlax-get ob1 'textbackgroundfill)))
                )
                (T
                 (setq ent (entget hnd '("ACAD")))
                 (if (or (not (setq xdata (assoc -3 ent)))
                         (and (setq xdata (assoc -3 ent))
                              (member '(1000 . "DSTYLE") (last xdata))
                              (/= (cdr (assoc 1070 (reverse (last xdata)))) 1)
                              (setq ent (vl-remove-if '(lambda (x) (= -3 (car x))) ent))
                         )
                     )
                   (setq entdata    '((-3 ("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 69) (1070 . 1) (1002 . "}"))))
                         newentdata (append ent entdata)
                   )
                   (setq ent        (vl-remove-if '(lambda (x) (= -3 (car x))) ent)
                         entdata    '((-3 ("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 69) (1070 . 0) (1002 . "}"))))
                         newentdata (append ent entdata)
                   )
                 )
                 (entmod newentdata)
                )
          )
        )
      )
      (princ)
    )
    I hope this helps.
    Henrique
    Last edited by hmsilva; 2015-05-05 at 07:37 PM. Reason: Text, removed from code

  7. #7
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Remove Text Mask On Select Dimension Objetcs

    Thanks again!!! I'm going to test now. I'll keep you posted.

  8. #8
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Remove Text Mask On Select Dimension Objetcs

    Works fine after the following edit: I had to remove TEXT from line 3 as I realize plain text does not support this function anyway...

    Code:
    (vl-load-com)
    (defun c:TMask (/ ent entdata hnd i newentdata ob1 ss xdata)
      (if (setq ss (ssget "_:L" '((0 . "DIMENSION,MTEXT,MULTILEADER"))))
        (repeat (setq i (sslength ss))
          (setq hnd (ssname ss (setq i (1- i)))
                ent (entget hnd)
          )
          (cond ((wcmatch (cdr (assoc 0 ent)) "*TEXT")
                 (setq ob1 (vlax-ename->vla-object hnd))
                 (vlax-put ob1 'backgroundfill (~ (vlax-get ob1 'backgroundfill)))
                )
                ((= (cdr (assoc 0 ent)) "MULTILEADER")
                 (setq ob1 (vlax-ename->vla-object hnd))
                 (vlax-put ob1 'textbackgroundfill (~ (vlax-get ob1 'textbackgroundfill)))
                )
                (T
                 (setq ent (entget hnd '("ACAD")))
                 (if (or (not (setq xdata (assoc -3 ent)))
                         (and (setq xdata (assoc -3 ent))
                              (member '(1000 . "DSTYLE") (last xdata))
                              (/= (cdr (assoc 1070 (reverse (last xdata)))) 1)
                              (setq ent (vl-remove-if '(lambda (x) (= -3 (car x))) ent))
                         )
                     )
                   (setq entdata    '((-3 ("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 69) (1070 . 1) (1002 . "}"))))
                         newentdata (append ent entdata)
                   )
                   (setq ent        (vl-remove-if '(lambda (x) (= -3 (car x))) ent)
                         entdata    '((-3 ("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 69) (1070 . 0) (1002 . "}"))))
                         newentdata (append ent entdata)
                   )
                 )
                 (entmod newentdata)
                )
          )
        )
      )
      (princ)
    )
    I seem to be making a habit of thanking your for your hard work!

  9. #9
    Member
    Join Date
    2006-12
    Location
    Cascais, Portugal
    Posts
    25
    Login to Give a bone
    0

    Default Re: Remove Text Mask On Select Dimension Objetcs


    Too much quick and dirty...
    Code revised.

    Henrique

  10. #10
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Remove Text Mask On Select Dimension Objetcs

    Well, once more I'm trying to modify your code to turn off all text mask globally... but as usual, I'm failing.

    Any insight would be helpful. it simply needs to turn off text mask in ALL Dims, Mleaders and Mtext. Should be simple... but not for me.

    I've replaced the line:

    Code:
      (if (setq ss (ssget "_:L" '((0 . "DIMENSION,MTEXT,MULTILEADER"))))
    With:

    Code:
      (if (setq ss (ssget "X" (list(cons 0 "DIMENSION,MTEXT,MULTILEADER"))))
    So that it simply selects all those objects without prompting for user input. However, after that, i can't really figure out what's happening...

    Thanks as always Henrique.
    Last edited by jpcadconsulting347236; 2015-05-12 at 04:01 PM. Reason: Aditional Information

Page 1 of 2 12 LastLast

Similar Threads

  1. Dimension Text Background Mask
    By Wish List System in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2014-03-05, 01:24 AM
  2. Dimension text mask model - not paper???
    By CADMama in forum AutoCAD General
    Replies: 1
    Last Post: 2010-10-20, 03:13 PM
  3. Text/Dimension Mask in Drawings
    By inventor.wishlist1738 in forum Inventor Wish List
    Replies: 0
    Last Post: 2010-09-16, 03:25 PM
  4. Dimension Text background mask
    By Grumpy in forum AutoCAD General
    Replies: 3
    Last Post: 2005-08-24, 12:21 PM
  5. Dimension Text Mask?
    By timothy.chapman in forum AutoCAD General
    Replies: 4
    Last Post: 2004-07-21, 02:29 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •