Jump to content

Copy and Increment Text


cedwards

Recommended Posts

I was wondering if anyone has/or would like to make a lisp that copy's and increments text.

 

I would like the lisp to work like this:

1.) Select text to copy

2.) Do you want to copy and increment or just copy(I/C)

3.) Copy and increment selected text or just copy text to users selected location

4.) Keep coping text to users selected location until user keys increment(I)

5.) When the user keys increment - Increment text and copy to user selected location.

Keep repeating steps 4 & 5 until user cancels function. I would like the increment between numbers set to 2.

 

Any help would be greatly appreciated. I have tried the tcount command from the express menu and that is not want I'm needing.

 

Thanks,

Chris

Link to comment
Share on other sites

I have checked out the lisp there. They work nice but my problem with them is that I can't tell it when to increment. For example lets say I want to copy LP-1. I would like to be able to select it then copy it to like 3 locations then with the test to selected tell it to increment and then copy the incremented text to like 3 locations, etc.

Link to comment
Share on other sites

Yes I can toggle the counter but the counter number is not a set number. I would also like to be able the select the text that needs to be increment instead of typing it in the dialog box.

Link to comment
Share on other sites

  • 8 years later...

Hello all! I realize this is quite old, but it is the closest I've found to what I am looking for.

Lee Mac,

In your incremental text tool (which is obviously an amazing piece of work) is there a way to basically just predefine all of those things within the code so that I can utilize the dynamic placement that you show for this tool?

the application I will be using this for is basically this, I need something that will start at the letter "A" and go up to a possibility of "Z".

As you can see, your tool is a bit overwhelming for the task at hand for me.

I am basically looking for a way to trim it down to just type the command say, "ANTXT"

have a predefined style (i will include below) and just immediately be able to click each point to place A, B, C... and so on until the command is finished by hitting Enter.

 

The predefined text properties would be as such (not MText, Must be just Text):

Color: ByBlock

Layer: _NonPlot

Style: ROMANS

Justify: Middle Center

Height: 1/2"

 

while the justification is set to middle center, i would like them to insert according to the bottom left vertex that typically appears with Text objects.

 

Is this at all possible? is there an easy way to take from your tool to be able to accomplish this?

I have had pretty much no luck in finding any other LISP that meet this need without it being a larger more intensive program.

Link to comment
Share on other sites

Here's a quickie without the layer set to noplot:

 

(defun c:foo (/ p)
 (or *lastchar* (setq *lastchar* (ascii "A")))
 (while (setq p (getpoint "\nPick a point to place text: "))
   (progn (entmakex (list '(0 . "TEXT")
		   '(100 . "AcDbEntity")
		   (cons 8 "text")
		   '(100 . "AcDbText")
		   (cons 10 p)
		   '(40 . 0.5)
		   (cons 1 (chr *lastchar*))
		   '(50 . 0.0)
		   (cons 7
			 (if (tblobjname "Style" "Romans")
			   "Romans"
			   "Standard"
			 )
		   )
		   '(72 . 1)
		   (cons 11 p)
		   '(73 . 2)
	     )
   )
   (setq *lastchar* (setq *lastchar* (1+ *lastchar*)))
   (and (> *lastchar* 90) (setq *lastchar* 65))
   )
 )
 (princ)
)

Link to comment
Share on other sites

Wow thank you so much!! This is awesome.

Is there any way to get it to reset once the command is finished? It seems when I do the command once, and i have to maybe do it again, it starts on the last letter from the previous use of the command.

Link to comment
Share on other sites

That is perfect. Thank you so much!

 

Glad to help :) .. since you don't want the program to remember the last letter you could localize the *lastchar* variable like so:

(defun c:foo (/ *lastchar* p)
 ...

Link to comment
Share on other sites

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