Jump to content

How can I prefix text consistently??


Recommended Posts

Posted

How about something like this:

 

(defun c:addm ( / ss )
 ;; Lee Mac  ~  21.05.10

 (if (setq ss (ssget "_X" '((0 . "TEXT,MTEXT") (8 . "text") (1 . "#*"))))
   (
     (lambda ( i / e )
       (while (setq e (ssname ss (setq i (1+ i))))
         (Update
           (SubstDXF 11 (cdr (assoc 10 (entget e)))
             (SubstDXF 73 2
               (SubstDXF 72 1
                 (SubstDXF 1
                   (strcat (cdr (assoc 1 (entget e))) "m") (entget e)
                 )
               )
             )
           )
         )
       )
     )
     -1
   )
 )
 (princ)
)


(defun SubstDXF ( code value elist )
 (entmod
   (subst
     (cons code value) (assoc code elist) elist
   )
 )
)

(defun Update ( elist )
 (entupd
   (cdr (assoc -1 elist))
 )
)

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    18

  • coombsie11

    10

  • jamesfear

    6

  • ML0940

    4

Posted

Cheers Lee,

 

I'll look into doing a math degree now. Thanks for the quick response, I'll test it at work and let you know if it worked! (due to not having cad at home haha)

 

 

James

Posted

Also I really like your T2M and got an idea that I can't write lol I was also wondering if you could do a like a combine 2 or 3 texts in one line without moving its postion if you know what I mean? I'll show you an example with the other thing I am having problems with.

 

I'll attach both the lisp and a picture example hopfully lol. and yeah I had trouble with loading the pic thats why its in a word doc lol.

 

Hey Lee,

 

The SUFFIX works perfect.

Did you get a chance to look at the above quote?? I think I told you not to worry about it but I am still having trouble with it lol. I'll send you a dwg with an example of what I'm trying to do.

 

Looked at a few Math Degrees but alot of them arn't suited to my work needs, might have to drop off to part time if I want to fully commit to Lisp writting ahaha which I do.

Example.dwg

Posted

Just a very quick written code:

 

(defun c:jt ( / ent ss )

 (if (setq ent (ssget "_+.:E:S" '((0 . "TEXT,MTEXT"))))
   (progn
     (setq ent (entget (ssname ent 0)))

     (if (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT"))))
       (
         (lambda ( i / e )
           (while (setq e (ssname ss (setq i (1+ i))))
             (setq ent
               (SubstDXF 1
                 (strcat (cdr (assoc 1 ent)) (cdr (assoc 1 (entget e)))) ent
               )
             )
             (entdel e)
           )
         )
         -1
       )
     )
     (Update ent)
   )
 )
 (princ)
)

(defun SubstDXF ( code value elist )
 (entmod
   (subst
     (cons code value) (assoc code elist) elist
   )
 )
)

(defun Update ( elist )
 (entupd
   (cdr (assoc -1 elist))
 )
)

 

Select first Text, then select all the text that you want to 'join' to it. :)

Posted

lengend! pretty good for a quicky "that's what she said" lol

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...