×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Text Lisp

Text Lisp

Text Lisp

(OP)
Does anyone have a lisp that can edit Mtext or regular text to put common things behind or in front of the text?  

Example:

I have a leader with text "a"(mtext or regular text) and I want it to read "a typ" or "a SEE DETAIL" or "2X a SEE Detail"

So I am looking for something that I can pick the text and then pick a prefix to apply to that text?  Just curios.

RE: Text Lisp


  Yes you can do that with a lisp
  program, but may not be worth it
  (time spent in writing routine)
  for single use only. It's good to
  do it via lisp when you are adding
  additonal text to multiple instances
  in mutltiple drawings.

   

RE: Text Lisp

(OP)
Well to get detailed I would like a button to click, a dialog box appears, asking letter to be assigned and any or none prefixes.  Like a bom utility without the cumbersome setting up or tracking.  

I have noticed some utilities for boms which would be nice, but for me and my use, a perfect thing would be to have buttons for assigning piece marks, a dialog pops up, type in the name and values to be put in the bom, for lengths to click a dimension and the length is put in the bom.

But for now I spend alot of time cleaning up drawings with putting typ, ns+fs, see deails text on existing text.  So that is what I was really looking for.

RE: Text Lisp

Not sure it this is what you want.  Save it somewhere as "CT.lsp".  In Autocad at the command line type (load"ct") and press enter.  Still at the command line, type CT and press enter.  Have some text in the drawing.  At the CT prompt, select the text you want to change, then type the text you want to replace then type the new text.  For instance, replace "a" with "a typ".

;
"CT"   Change text
;
(DEFUN chgterr (s)
   (if (/= s "Function cancelled")   ; If an error (such as CTRL-C) occurs
      (princ (strcat "\nError: " s)) ; while this command is active...
   )
   (setq p nil)                      ; Free selection set
   (setq *error* olderr)             ; Restore old *error* handler
   (princ)
)

;
(DEFUN C:CT (/ p l n e os as ns st s nsl osl sl si chf chm olderr) ; Correct spelling errors
   (setq olderr  *error*             ; Initialize variables
         *error* chgterr
         chm     0)
   (setq p (ssget))                  ; Select objects
   (if p (progn                      ; If any objects selected
      (while (= 0 (setq osl (strlen (setq os (getstring t "\nOld string: ")))))
            (princ "Null input invalid")
      )
      (setq nsl (strlen (setq ns (getstring t "\nNew string: "))))
      (setq l 0 n (sslength p))
      (while (< l n)                 ; For each selected object...
         (if (= "TEXT"               ; Look for TEXT entity type (group 0)
                (cdr (assoc 0 (setq e (entget (ssname p l))))))
            (progn
               (setq chf nil si 1)
               (setq s (cdr (setq as (assoc 1 e))))
               (while (= osl (setq sl (strlen
                             (setq st (substr s si osl)))))
                  (if (= st os)
                      (progn
                        (setq s (strcat (substr s 1 (1- si)) ns
                                        (substr s (+ si osl))))
                        (setq chf t) ; Found old string
                        (setq si (+ si nsl))
                      )
                      (setq si (1+ si))
                  )
               )
               (if chf (progn        ; Substitute new string for old
                  (setq e (subst (cons 1 s) as e))
                  (entmod e)         ; Modify the TEXT entity
                  (setq chm (1+ chm))
               ))
            )
         )
         (setq l (1+ l))
      )
   ))
   (princ "Changed ")                ; Print total lines changed
   (princ chm)
   (princ " text lines.")
   (terpri)
   (setq *error* olderr)             ; Restore old *error* handler
   (princ)
)

RE: Text Lisp


See if you can use this program by Brenda Larson entitled "Notes Made Easy".  Its in the February 1997 issue of Cadalyst magazine (Tips 1291A-D).  They can be downloaded at this site: http://new.cadalyst.com/code/browseyear.cfm?fullyear=1997#2

Some modification may be needed to fit your needs.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources