Author Topic: Idea for a LISP: Outlining Text  (Read 6383 times)

0 Members and 1 Guest are viewing this topic.

tcdan

  • Guest
Idea for a LISP: Outlining Text
« on: June 01, 2005, 05:44:34 PM »
Yeah, just thought I'd see if anyone has done this or would like to try it out.

The Problem
Sometimes I plot color text on a color map or background which makes the text slightly difficult to read.  However, I would not like to change the color of the text to make it readable.

Solution
Create a white or black outline around the text.
Maybe this could be done by creating 2 copies of all of your text in the document and setting one copy to be a black or white outline with TEXTFILL.

So is it possible?

dubb

  • Swamp Rat
  • Posts: 1105
Idea for a LISP: Outlining Text
« Reply #1 on: June 01, 2005, 06:19:43 PM »
if you have a .ctb files you can set any layer to print out any color....does this help?

tcdan

  • Guest
Idea for a LISP: Outlining Text
« Reply #2 on: June 01, 2005, 07:49:36 PM »
Quote
if you have a .ctb files you can set any layer to print out any color....does this help?


No not really.  I can change the color of the text, but that won't fix the problem because I'm laying it over a raster image which has both dark and light colors in it.  I want the color of the text to stay consistent.  So having an outline around the text provides the needed contrast for the text to show up clearly.

I don't really know how playing with TEXTFILL would help, however, because it cannot take on both values simultaneously in the same dwg that I know of. . .

sourdough

  • Bull Frog
  • Posts: 367
Hey I know someone here that can help
« Reply #3 on: June 01, 2005, 10:32:58 PM »
CAB showed me a prototype of boxes that can be applied to text that
aren't ordinary and in many different styles... you can reach him soon. I
believe he might be on vacation, but maybe back soon. or just do a search he has an abundance of posts with really great solutions.

Mike in Alaska
LDC 2009/C3D 2010/C3D 2011/C3D 2016

Win 10 64bit

daron

  • Guest
Idea for a LISP: Outlining Text
« Reply #4 on: June 02, 2005, 07:39:06 AM »
vla-get-boundingbox.

Craig

  • Guest
Idea for a LISP: Outlining Text
« Reply #5 on: June 02, 2005, 08:10:15 AM »
Here's one that might do what you need or you can adjust it to fit your needs. I've put the header in here as well since it's not my program

Code: [Select]
;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
;º                        Central Associated Engineers                        º
;º                   446 East High St. Lexington, KY 40507                    º
;º                              (606) 231-9831                                º
;ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
;º TXTBOXED.LSP  º  Written by: Michael L. Jenkins      º  Date: 4-8-91       º
;ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
;º Comments : A routine to draw a box around a string. Can be used for room   º
;º            schedules, to put a label in a pipe line using the MEASURE      º
;º            command and the entities that this creates as the block and     º
;º            for breaking out hatch around text. It uses the current style.  º
;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
(defun C:TXTBOXED (/ center string above below right left)      ;setup
(princ)                                                         ;print a line
(setq THGT (getvar "TEXTSIZE"))
(prompt "\nThis is a routine to draw a box around a string.")
(setq center (getpoint "\nPlease pick the center of the box.")) ;get a point
(setq THGT (getdist (strcat "\nPlease enter the text height <"  ;get the height
                     (rtos THGT) ">:")))
(if (= thgt nil) (setq thgt (getvar "textsize")))
(setq string (getstring T "\nPlease enter your text string : "));get the string
(setq lgth (strlen string))                                     ;find string
(setq ontop (+ (cadr center) (* 0.8842 THGT)))                  ;length
(setq under (- (cadr center) (* 0.8842 THGT)))
(setq right (+ (car center) (* 0.55 (* THGT lgth))))
(setq left (- (car center) (* 0.55 (* THGT lgth))))
(command "PLINE" (list left under)
                 "W"
                 "0"
                 "0"
                 (list right under)
                 (list right ontop)
                 (list left ontop)
                 "C"
)
(command "TEXT" "M" center THGT "0" string
)
(prin1)                                                         ;clean exit
)

Craig

  • Guest
Idea for a LISP: Outlining Text
« Reply #6 on: June 02, 2005, 08:13:30 AM »
And here's another as well. Hope one of these can help you out.

Code: [Select]
(setvar "cmdecho" 0)
(vl-load-com)
(prompt
  "\nEntity-Box Loaded.......  Start with     Command:entity-box"
) ;_ end of prompt
;;;---DIMENSION---  
(defun do-dim ()
  (setq dim-gap
(vlax-make-variant
  (* -1 (vla-get-textgap vla-ename))
  vlax-vbString
) ;_ end of vlax-make-variant
  ) ;_ end of setq
  (vla-put-textgap vla-ename dim-gap)
) ;_ end of defun
;;;---TEXT---
(defun do-text
       (/ p0 p1 p2 p3 p4 t1 t2 sinrot cosrot list1 list2 margin ang)
  (setq e-list (entget ename))
  (setq p0     (cdr (assoc 10 e-list))
ang    (cdr (assoc 50 e-list))
margin (* 0.425 (cdr (assoc 40 e-list)))
list1  (list (- margin) (- margin) 0.0)
list2  (list margin margin 0.0)
sinrot (sin ang)
cosrot (cos ang)
t1     (mapcar '+ (car (textbox e-list)) list1)
t2     (mapcar '+ (cadr (textbox e-list)) list2)
p1     (list
(+ (car p0) (- (* (car t1) cosrot) (* (cadr t1) sinrot)))
(+ (cadr p0) (+ (* (car t1) sinrot) (* (cadr t1) cosrot)))
      ) ;_ end of list
p2     (list
(+ (car p0) (- (* (car t2) cosrot) (* (cadr t1) sinrot)))
(+ (cadr p0) (+ (* (car t2) sinrot) (* (cadr t1) cosrot)))
      ) ;_ end of list
p3     (list
(+ (car p0) (- (* (car t2) cosrot) (* (cadr t2) sinrot)))
(+ (cadr p0) (+ (* (car t2) sinrot) (* (cadr t2) cosrot)))
      ) ;_ end of list
p4     (list
(+ (car p0) (- (* (car t1) cosrot) (* (cadr t2) sinrot)))
(+ (cadr p0) (+ (* (car t1) sinrot) (* (cadr t2) cosrot)))
      ) ;_ end of list
  ) ;_ end of setq
  (command "pline" p1 "w" "0" "0" p2 p3 p4 "c")
) ;_ end of defun
;;;---MTEXT---
(defun do-mtext (/ minpoint maxpoint t1a t2a list1 list2 margin)
  (vla-GetBoundingBox vla-ename 'minpoint 'maxpoint)
  (setq t1a (vlax-safearray->list minpoint))
  (setq t2a (vlax-safearray->list maxpoint))
  (setq e-list (entget ename))
  (setq margin (* 0.425 (cdr (assoc 40 e-list)))
list1  (list (- margin) (- margin) 0.0)
list2  (list margin margin 0.0)
t1a    (mapcar '+ t1a list1)
t2a    (mapcar '+ t2a list2)
  ) ;_ end of setq
  (command ".rectangle" t1a t2a)
) ;_ end of defun

;;;-----------MAIN-------------
(defun c:entity-box ()
  (setvar "cmdecho" 0)
  (setq oldosnap (getvar "osmode"))
  (setvar "osmode" 0)
  (vl-load-com)
  (initget 1)
  (setq ename (car (entsel "\nPick an Entity:")))
  (if ename
    (progn
      (setq vla-ename (vlax-ename->vla-object ename))
      (cond ((vlax-property-available-p vla-ename "textgap") (do-dim))
   ((= "AcDbText" (vla-get-objectname vla-ename)) (do-text))
   ((= "AcDbMText" (vla-get-objectname vla-ename)) (do-mtext))
   (T (alert "Not possible....."))
      ) ;_ end of cond
    ) ;_ end of progn
    (alert "You did not select anything")
  ) ;_ end of if
  (setvar "osmode" oldosnap)
  (princ)
) ;_ end of defun

tcdan

  • Guest
Idea for a LISP: Outlining Text
« Reply #7 on: June 02, 2005, 11:48:50 AM »
Thanks guys, but I think all of those ideas are for making a box around the text not an outline.  I'm saying an actual outline of the text itself, as if you stenciled around the text characters in a color other than the text.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Idea for a LISP: Outlining Text
« Reply #8 on: June 02, 2005, 12:26:20 PM »
Perhaps a small screen shot would help. :)
TheSwamp.org  (serving the CAD community since 2003)

Craig

  • Guest
Idea for a LISP: Outlining Text
« Reply #9 on: June 02, 2005, 12:30:11 PM »
Quote from: tcdan
I'm saying an actual outline of the text itself, as if you stenciled around the text characters in a color other than the text.


Oh sorry, I get you now. That would be interesting to see done

ronjonp

  • Needs a day job
  • Posts: 7531
Idea for a LISP: Outlining Text
« Reply #10 on: June 02, 2005, 12:31:05 PM »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Craig

  • Guest
Idea for a LISP: Outlining Text
« Reply #11 on: June 02, 2005, 12:34:10 PM »
Mark' I'm assuming tcdan means something like

or

tcdan

  • Guest
Idea for a LISP: Outlining Text
« Reply #12 on: June 02, 2005, 02:56:23 PM »
Yeah - that's it exactly.

mohobrien

  • Guest
Idea for a LISP: Outlining Text
« Reply #13 on: June 02, 2005, 06:46:33 PM »

This way is only with the map api
1)copy the text
2)explode the copied text to plines (express tools)
3)clean the plines to break all crossings
4)create a network topology
5)create a buffer topology
6)delete the network topology
7)replace it with the original text
8)hatch the buffer to suit.

There has to be a better way!

Can't figure how to show the bmp. Its pretty ugly anyway.

*edited link and image file - keb*

tcdan

  • Guest
Idea for a LISP: Outlining Text
« Reply #14 on: June 03, 2005, 06:34:46 PM »
mohobrien - That looks interesting but for one thing I don't have the express tools.