Hatching text

Hatching text

mthcadman
Contributor Contributor
1,694 Views
5 Replies
Message 1 of 6

Hatching text

mthcadman
Contributor
Contributor

Hi,

 

I've searched several forums looking for a lisp routine that can hatch a text boundary but can't find anything. I need to hatch directly over text and/or mtext. Is there anything out there that will allow me to hatch the text within the boundaries that would normally be generated and used as a texmask (wipeout), or in the case of mtext...the text background boundary?

 

Thanks,

 

rob

0 Likes
1,695 Views
5 Replies
Replies (5)
Message 2 of 6

john.uhden
Mentor
Mentor

The HATCH command allows you to select objects (including text and mtext) within the hatch boundary to be "hatched around" just like mtext can have a background mask.  HatchEdit doesn't appear (at least in 2002) to allow adding internal objects, but there is an ActiveX method to do something like "addinternalloop" which I have tried and it works.

 

BTW, in newer (than 2002) releases you can add background masking to mtext so that if its draworder is "on top" of the hatch, it will mask out the hatching behind (depending on that variable I have forgotten).

 

In either case, moving the mtext will relocate the masking (or internal hatch boundary) as well, even if it's half inside and half outside.

 

The background masking may be better for some as the masking can be turned on/off as desired (though I despise indecision).

John F. Uhden

0 Likes
Message 3 of 6

mthcadman
Contributor
Contributor

Basically what I am trying to achieve is to be able to type in a command, select the text/mthext, and the predefined pattern will hatch over the text/mtext..end of command.

 

Rob

 

0 Likes
Message 4 of 6

john.uhden
Mentor
Mentor

Um, don't you want/need an outer boundary?  Or do you want to hatch just within the mtext boundary?  Seems a little strange to me, but I guess that could be done.  For it to behave like hatching it would probably need reactors.  I could do it, but don't really want to.

 

Might the hatching want to be of a solid color?  I think that's possible with the mtext background options, though not with plain text, but you could convert the text to mtext.

John F. Uhden

0 Likes
Message 5 of 6

dbroad
Mentor
Mentor

Picture worth thousand words... Unless you just want to obscure the text, show what you want.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 6 of 6

Kent1Cooper
Consultant
Consultant

@mthcadman wrote:

Basically what I am trying to achieve is to be able to type in a command, select the text/mthext, and the predefined pattern will hatch over the text/mtext..end of command.

.... 


The "raw" command-line-based Hatch command has a little-known feature that the following takes advantage of -- hitting Enter when it's asking you to select objects goes into draw-you-own-outline mode.  This one uses the Solid pattern -- if you want some other pattern, build in the appropriate answers to scale and rotation prompts, or others for a User-defined pattern.  And this one works properly only on orthogonally-oriented ones -- if you sometimes need it at other angles, it could be made to change the UCS to match them.  Also, for Mtext, it will use the defining box width, not the width of the actual contents -- there are routines around to change that box to match the width of the contents, that could be applied if necessary.  But as a start, in simplest terms:

 

(defun C:TH (/ ss txt LL UR); = Text Hatch
  (if (setq ss (ssget '((0 . "*TEXT"))))
    (repeat (setq n (sslength ss))
      (setq txt (ssname ss (setq n (1- n))))
      (vla-getboundingbox (vlax-ename->vla-object txt) 'minpt 'maxpt)
      (setq
        LL (vlax-safearray->list minpt)
        UR (vlax-safearray->list maxpt)
      ); setq
      (command "_.hatch" "_solid" "" "_no"
        LL (list (car UR) (cadr LL)) UR (list (car LL) (cadr UR))
        "_close" ""
      ); command
    ); repeat
  ); if
); defun
Kent Cooper, AIA