Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

place numbers incrementally without using tcount

pmasonx
Participant

place numbers incrementally without using tcount

pmasonx
Participant
Participant

tcount is a bit too cumbersome - it requires previously placed text.

Is there a way to place sequential numbers at locations I choose --

i.e. place "1", then place "2" at another location, (then perhaps pan/zoom) and place "3", and so on - all this without hitting enter, spacebar, escape, just simply click the new location?  

0 Me gusta
Responder
Soluciones aceptadas (1)
779 Vistas
8 Respuestas
Respuestas (8)

Kent1Cooper
Consultant
Consultant
Solución aceptada

In simplest terms, try something like this [untested EDIT: tested now -- it works for me], assuming the desired Text height is current and the current Style does not have a fixed height:

 

(defun C:WHATEVER (/ int inspt)

  (setq int 0)

  (while (setq inspt (getpoint "\nInsertion point for next Text number: "))

    (command "_.text" "_mc" "_non" inspt "" "" (itoa (setq int (1+ int))))

  )

  (princ)

)

 

It can be made far more sophisticated in various ways, but there's a start.

Kent Cooper, AIA

blkcar
Enthusiast
Enthusiast

I found the code in this video works well. Also you can adjust starting number when required.

 

It is used in a block, however you could just make the text you want to use into a block & have it explode on placement.

 

https://www.youtube.com/watch?v=MNxrBlkrjVg&ab_channel=LazyArquitecto-AutoCAD

 

 

0 Me gusta

pendean
Community Legend
Community Legend
... and this freebie is petty easy to use all day long too https://apps.autodesk.com/ACD/en/Detail/Index?id=8051485828049059617&appLang=en&os=Win32_64
0 Me gusta

pmasonx
Participant
Participant

Kent1Cooper - thanks for your suggestion.  this looks like it should what I want, but the lisp didn't work.  any ideas?

0 Me gusta

Kent1Cooper
Consultant
Consultant

@pmasonx wrote:

.... the lisp didn't work.  ....


That is never enough information.  Did it not load?  Did it load, but the command name wasn't recognized?  Did it accept the command, but it didn't work as you expected?  What did it do?  What did it not do?  How far did it get?  Was there any message?  Is your current Text Style and height appropriate for seeing the result?  Does the current Style have a fixed height?  Etc., etc., etc.

Kent Cooper, AIA
0 Me gusta

pmasonx
Participant
Participant

hi, sorry not enuf info... the app loaded and ran, and prompted to place text, but when picking a location, no text numbers were placed.  So i tried another drawing and it worked fine.  I narrowed it down - the working drawing had "0" in the current (simplex) text style "height" field, and the non-working drawing had "0.10" in the same "height" field.  So i changed the non-working drawing text style simplex "height" to "0" and voila, it worked.

I don't know how this causes it to not work but it's an easy fix.  Thanks very much for your help.

 

0 Me gusta

Kent1Cooper
Consultant
Consultant

@pmasonx wrote:

.....I don't know how this causes it to not work ....


It's because when the Text Style definition has a fixed [i.e. non-zero] height, the Text command does not ask for a height.  The code was written to answer the prompt for height, so if that question is not asked, subsequent inputs are in answer to the wrong questions.

Kent Cooper, AIA

pmasonx
Participant
Participant

makes sense – thanks again kent!

0 Me gusta