See the top rated post in this thread. Click here

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

Thread: Routine to add text below existing text

  1. #1
    100 Club jhohman's Avatar
    Join Date
    2003-08
    Location
    Spring Hill, Florida
    Posts
    195
    Login to Give a bone
    0

    Lightbulb Routine to add text below existing text

    I am looking for a LISP routine that will allow me to input text by selecting an existing line of text and allow me to add text below the selected line in the same way that I could if I had continued typing. So, if I had a notation and leader on say a detail, the LISP would ask me to select the text I want to continue from and after I select the text it would place the start point one line below the selected text. I hope this is understandable, I had found a routine before that did this but cannot find it now, anybody have any ideas. Thanks.

  2. #2
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Routine to add text below existing text

    Hi

    Check out the following submission # EX001241 by Ed Jobe on the AUGI Exchange -

    Search AUGI Exchange Page

    If memory serves this Text utility has the functionality you're after, hopefully Ed can confirm this one-way or the other.

    Have a good one, Mike

  3. #3
    I could stop if I wanted to
    Join Date
    2003-05
    Posts
    335
    Login to Give a bone
    0

    Default Re: Routine to add text below existing text

    Jay,

    This is one that we use for Dtext. I don't know where we got it or who wrote it.

    Code:
     
    (defun c:CONTXT (/ uecho fht ent ins alignx alignp)
      (setq uecho (getvar "cmdecho"))
      (setvar "cmdecho" 0)
      (and
    	(setq ent (entsel "\nLast line of text: "))
    	(setq ent (entget (car ent)))
    	(= (*dxf* 0 ent) "TEXT")
    	(or (/= (*dxf* '72 ent) 3)
     (prompt "\nDoesn't work on ALIGNED text.")
    	)
    	(or (/= (*dxf* '72 ent) 5)
     (prompt "\nDoesn't work on FIT text.")
    	)
    	(progn
    	  (setq ins (*dxf* 10 ent)
    	 fht (/= 0.0 (*dxf* 40 (tblsearch "STYLE" (*dxf* 7 ent))))
    	  )
    	  (if (/= (*dxf* 8 ent) (getvar "clayer"))
     (command ".layer" "s" (*dxf* 8 ent) "")
    	  )
    	  (if (or (setq alignx (*dxf* (*dxf* 72 ent) '((1 . "c") (2 . "r") (4 . "m"))))
    	   (setq alignp (*dxf* (*dxf* 73 ent) '((1 . "b") (2 . "m") (3 . "t"))))
       )
     (setq ins (*dxf* 11 ent))
    	  )
    	  (if (not alignx)
     (setq alignx "l")
    	  )
    	  (if alignp
     (setq alignx (strcat alignp alignx))
    	  )
    	  (command ".text" "s" (*dxf* 7 ent))
    	  (if (/= alignx "l")
     (command alignx)
    	  )
    	  (command ins)
    	  (if (not fht)
     (command (*dxf* 40 ent))
    	  )
    	  (command (angtos (*dxf* 50 ent)) " ")
    	  (prompt "\nNew text: ")
    	  (command ".dtext" "")
    	)
      )
      (setvar "cmdecho" uecho)
      (princ)
    )
    Hope this helps,

  4. #4
    100 Club jhohman's Avatar
    Join Date
    2003-08
    Location
    Spring Hill, Florida
    Posts
    195
    Login to Give a bone
    0

    Question Re: Routine to add text below existing text

    Perhaps I am doing something wrong, but I get this after I try to use the LISP:

    Command: contxt

    Last line of text: ; error: no function definition: *DXF*


    It asks me to select the last line of text then returns to the command prompt after I select the text.

  5. #5
    100 Club
    Join Date
    2000-12
    Posts
    126
    Login to Give a bone
    1

    Default Re: Routine to add text below existing text

    Try adding a function like this and see if it works:
    (defun *dxf* (val ent)(cdr (assoc val ent)))

  6. #6
    100 Club jhohman's Avatar
    Join Date
    2003-08
    Location
    Spring Hill, Florida
    Posts
    195
    Login to Give a bone
    0

    Question Re: Routine to add text below existing text

    Quote Originally Posted by stig.madsen
    Try adding a function like this and see if it works:
    (defun *dxf* (val ent)(cdr (assoc val ent)))

    Where would I insert this function?? At the end?

  7. #7
    100 Club
    Join Date
    2000-12
    Posts
    126
    Login to Give a bone
    0

    Default Re: Routine to add text below existing text

    Anywhere .. just as long as it is loaded before you run c:CONTXT

  8. #8
    I could stop if I wanted to
    Join Date
    2003-05
    Posts
    335
    Login to Give a bone
    1

    Default Re: Routine to add text below existing text

    Stig's post will work, but here is the one I left out.

    Sorry.

    Code:
     (defun *dxf* (gcode elist)
      (cdr (assoc gcode elist))
    )

  9. #9
    100 Club jhohman's Avatar
    Join Date
    2003-08
    Location
    Spring Hill, Florida
    Posts
    195
    Login to Give a bone
    0

    Talking Re: Routine to add text below existing text

    Thanks alot guys, I really appreciate all the help.

  10. #10
    Member
    Join Date
    2012-05
    Posts
    4
    Login to Give a bone
    0

    Default Re: Routine to add text below existing text

    (defun c:CONTXT (/ uecho fht ent ins alignx alignp)
    (setq uecho (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (and
    (setq ent (entsel "\nLast line of text: "))
    (setq ent (entget (car ent)))
    (= (*dxf* 0 ent) "TEXT")
    (or (/= (*dxf* '72 ent) 3)
    (prompt "\nDoesn't work on ALIGNED text.")
    )
    (or (/= (*dxf* '72 ent) 5)
    (prompt "\nDoesn't work on FIT text.")
    )
    (progn
    (setq ins (*dxf* 10 ent)
    fht (/= 0.0 (*dxf* 40 (tblsearch "STYLE" (*dxf* 7 ent))))
    )
    (if (/= (*dxf* 8 ent) (getvar "clayer"))
    (command ".layer" "s" (*dxf* 8 ent) "")
    )
    (if (or (setq alignx (*dxf* (*dxf* 72 ent) '((1 . "c") (2 . "r") (4 . "m"))))
    (setq alignp (*dxf* (*dxf* 73 ent) '((1 . "b") (2 . "m") (3 . "t"))))
    )
    (setq ins (*dxf* 11 ent))
    )
    (if (not alignx)
    (setq alignx "l")
    )
    (if alignp
    (setq alignx (strcat alignp alignx))
    )
    (command ".text" "s" (*dxf* 7 ent))
    (if (/= alignx "l")
    (command alignx)
    )
    (command ins)
    (if (not fht)
    (command (*dxf* 40 ent))
    )
    (command (angtos (*dxf* 50 ent)) " ")
    (prompt "\nNew text: ")
    (command ".dtext" "")
    )
    )
    (setvar "cmdecho" uecho)
    (princ)
    )
    (defun *dxf* (val ent)(cdr (assoc val ent)))

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 5
    Last Post: 2016-08-11, 11:35 PM
  2. Replies: 1
    Last Post: 2014-08-08, 05:20 PM
  3. Replies: 3
    Last Post: 2013-12-13, 07:28 AM
  4. Help with text manipulation routine
    By jaredthrasher in forum AutoLISP
    Replies: 5
    Last Post: 2007-02-20, 08:01 AM
  5. Routine to replace text
    By methost in forum AutoLISP
    Replies: 7
    Last Post: 2005-02-18, 08:13 PM

Posting Permissions

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