• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

lisp to insert progressive numbers with preview on the pointer

  • Thread starter Thread starter FranzFanton
  • Start date Start date

FranzFanton

Guest
Hello everyone!
I tried to search but I don't find useful examples to solve my need.
I work with the cad using it to master regional technical cards, and I would like to automate with lisp the numbering of buildings progressively. I have already done a file lisp that at each click inserts a progressive number at the point of the cilck. I'd like to see the number I'm going to preview on the pointer cross. the desired effect is similar to what happens when moving any entity. ..remains displayed, a little in transparency, on the pointer, and so I can know his encumbrance at the moment when they reposition it.

Does anyone have a tip?

Thank you all in advance!
:smile:
 
Thank you so much!
very large and complete suites! I will spray in the code the function that shows the text on the cursor!
Thank you!
 
Unfortunately not yet...:-(it is not easy to understand the code because very articulated...you have some specific tip?
Bye!
 
Unfortunately not yet...:-(it is not easy to understand the code because very articulated...you have some specific tip?
Bye!
I am also interested in displaying the preview on the pointer of what will be written. I tried to figure something out, but I didn't know the lisp, I got the chief in the brackets.
If you can handle something, you'll do what you like if you bring it back here.

Hi.
 
Hello, everyone!
So, I wanted to go a little deeper into it and I wrote to Mr. "lee mac programming", which implemented the "incremental numbering suite", and asked him if kindly he could give me some tips on the particular function he used to have the preview of what I will insert on the pointer. is really a very kind and helpful person and answered me with very helpful tips that I bring back:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
the foremost function underlying the ability to create a dynamic visual effect in autocad is the grread function. this function simply pauses for any form of user input (be it mouse movement, mouse clicks, or keyboard entry), and then returns a list describing the form of input registered coupled with some data about such input.

the grread function has been discussed extensively at the swamp programming forum and there are numerous examples to be studied from the threads at that forum (many of which i have contributed). specifically for your task i would suggest that you read this thread, in which i demonstrate how to utilise grread to display text at the cursor during placement.

however, note that since grread simply pauses for user input, the user has no access to the standard autocad drawing aids (such as object snap / orthomode / tracking etc.), hence, although the dynamic effect is impressive, many programs utilising the grread function become impractical in real-world applications. for this reason, i would also suggest looking into using a temporary block in conjunction with the standard autocad insert command to display the text dynamically at the cursor, since this method allows the use of all standard drawing aids. this method is also described in the thread provided above.

for general examples of how to use grread, i would recommend reading every page of this epic thread, in which users have contributed a wealth of examples of programs using the function.

i hope this helps you in your task.

kind regards,

lee
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
in particular there is a list of "examples" that I still have to deepen but that seems to do what I was looking for!

If I find anything else I'll give you! !
Hi!
 
when I happen to have this need I always use a block, or I turn into block the object that I have to insert and explode it at the exit.
for the use you have to make code may have these likeness:
Code:
[color=RED]([/color][color=BLUE]defun[/color] [color=BLUE]c:test1[/color] [color=RED]([/color][color=BLUE]/[/color] i [color=RED])[/color]
[color=RED]([/color][color=BLUE]if[/color] [color=RED]([/color][color=BLUE]sec[/color] i [color=RED]([/color][color=BLUE]Tinted[/color] [color=#a52a2a]"Initial number: "[/color][color=RED]))[/color]
[color=RED]([/color][color=BLUE]while[/color]
[color=RED]([/color][color=BLUE]entmake[/color] [color=DARKRED]'[/color][color=RED](([/color][color=#009900][/color] [color=DARKRED].[/color] [color=#a52a2a]"Block"[/color][color=RED])([/color][color=#009900]2[/color] [color=DARKRED].[/color] [color=#a52a2a]"T"[/color][color=RED])([/color][color=#009900]70[/color] [color=DARKRED].[/color] [color=#009900][/color][color=RED])([/color][color=#009900]10[/color] [color=#009999]0.0[/color] [color=#009999]0.0[/color] [color=#009999]0.0[/color][color=RED])))[/color]
[color=RED]([/color][color=BLUE]entmake[/color]
[color=RED]([/color][color=BLUE]list[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900][/color] [color=#a52a2a]"text"[/color][color=RED])[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]8[/color] [color=RED]([/color][color=BLUE]Goats[/color] [color=DARKRED]'[/color]clayer[color=RED]))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]7[/color] [color=RED]([/color][color=BLUE]Goats[/color] [color=DARKRED]'[/color]textile[color=RED]))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]10[/color] [color=DARKRED]'[/color][color=RED]([/color][color=#009999]0.0[/color] [color=#009999]0.0[/color][color=RED]))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]40[/color] [color=RED]([/color][color=BLUE]Goats[/color] [color=DARKRED]'[/color]textsize[color=RED]))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]1[/color] [color=RED]([/color][color=BLUE]is this[/color] i[color=RED]))[/color]
[color=RED])[/color]
[color=RED])[/color]
[color=RED]([/color][color=BLUE]entmake[/color] [color=DARKRED]'[/color][color=RED](([/color][color=#009900][/color] [color=DARKRED].[/color] [color=#a52a2a]"end"[/color][color=RED])))[/color]
[color=RED]([/color][color=BLUE]prompt[/color] [color=#a52a2a]"text insertion point:"[/color] [color=RED])[/color]
[color=RED]([/color][color=BLUE]command[/color] [color=#a52a2a]"_-insert"[/color] [color=#a52a2a]"T"[/color] [color=BLUE]pause[/color] [color=#a52a2a]"1"[/color] [color=#a52a2a]"1"[/color] [color=#a52a2a]"0"[/color][color=RED])[/color]
[color=RED]([/color][color=BLUE]command[/color] [color=#a52a2a]"_explode"[/color] [color=RED]([/color][color=BLUE]entlast[/color][color=RED]))[/color]
[color=RED]([/color][color=BLUE]sec[/color] i [color=RED]([/color][color=BLUE]1+[/color] i[color=RED]))[/color]
[color=RED])[/color]
[color=RED]([/color][color=BLUE]Prince[/color][color=RED])[/color]
[color=RED])[/color]
[color=RED]([/color][color=BLUE]Prince[/color][color=RED])[/color][color=RED])[/color]
seldom happened to me also to place it by cutting it and pasting it (without creating the block), for example:
Code:
[color=RED]([/color][color=BLUE]defun[/color] [color=BLUE]c:test2[/color] [color=RED]([/color][color=BLUE]/[/color] i [color=BLUE]tt[/color] [color=RED])[/color]
[color=RED]([/color][color=BLUE]sec[/color] [color=BLUE]tt[/color] [color=BLUE]t[/color][color=RED])[/color]
[color=RED]([/color][color=BLUE]if[/color] [color=RED]([/color][color=BLUE]sec[/color] i [color=RED]([/color][color=BLUE]Tinted[/color] [color=#a52a2a]"Initial number: "[/color][color=RED]))[/color]
[color=RED]([/color][color=BLUE]while[/color] [color=BLUE]tt[/color]
[color=RED]([/color][color=BLUE]prompt[/color] [color=#a52a2a]"text insertion point:"[/color] [color=RED])[/color]
[color=RED]([/color][color=BLUE]sec[/color] [color=BLUE]tt[/color]
[color=RED]([/color][color=BLUE]entmakex[/color]
[color=RED]([/color][color=BLUE]list[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900][/color] [color=#a52a2a]"text"[/color][color=RED])[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]8[/color] [color=RED]([/color][color=BLUE]Goats[/color] [color=DARKRED]'[/color]clayer[color=RED]))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]7[/color] [color=RED]([/color][color=BLUE]Goats[/color] [color=#a52a2a]"textstyle"[/color][color=RED]))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]10[/color] [color=DARKRED]'[/color][color=RED]([/color][color=#009999]0.0[/color] [color=#009999]0.0[/color][color=RED]))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]40[/color] [color=RED]([/color][color=BLUE]Goats[/color] [color=DARKRED]'[/color]textsize[color=RED]))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]1[/color] [color=RED]([/color][color=BLUE]is this[/color] i[color=RED]))[/color]
[color=RED])[/color]
[color=RED])[/color]
[color=RED])[/color]
[color=RED]([/color][color=BLUE]command[/color] [color=#a52a2a]_ cutclip[/color] [color=BLUE]tt[/color] [color=#a52a2a]""[/color] [color=#a52a2a]"_pasteclip"[/color] [color=BLUE]pause[/color][color=RED])[/color]
[color=RED]([/color][color=BLUE]sec[/color] i [color=RED]([/color][color=BLUE]1+[/color] i[color=RED]))[/color]
[color=RED])[/color]
[color=RED]([/color][color=BLUE]Prince[/color][color=RED])[/color]
[color=RED])[/color]
[color=RED]([/color][color=BLUE]Prince[/color][color=RED])[/color][color=RED])[/color]
the solution with grread could instead be such a thing:
Code:
[color=RED]([/color][color=BLUE]defun[/color] [color=BLUE]c:test3[/color] [color=RED]([/color][color=BLUE]/[/color] i pt[color=RED])[/color]
[color=RED]([/color][color=BLUE]if[/color] [color=RED]([/color][color=BLUE]sec[/color] i [color=RED]([/color][color=BLUE]Tinted[/color] [color=#a52a2a]"Initial number: "[/color][color=RED]))[/color]
[color=RED]([/color][color=BLUE]while[/color]
[color=RED]([/color][color=BLUE]sec[/color] [color=BLUE]tt[/color]
[color=RED]([/color][color=BLUE]vlax-ename->vla-object[/color]
[color=RED]([/color][color=BLUE]entmakex[/color]
[color=RED]([/color][color=BLUE]list[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900][/color] [color=#a52a2a]"text"[/color][color=RED])[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]8[/color] [color=RED]([/color][color=BLUE]Goats[/color] [color=DARKRED]'[/color]clayer[color=RED]))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]7[/color] [color=RED]([/color][color=BLUE]Goats[/color] [color=#a52a2a]"textstyle"[/color][color=RED]))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]10[/color] [color=RED]([/color][color=BLUE]cadr[/color] [color=RED]([/color][color=BLUE]♪[/color] [color=BLUE]t[/color][color=RED])))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]40[/color] [color=RED]([/color][color=BLUE]Goats[/color] [color=DARKRED]'[/color]textsize[color=RED]))[/color]
[color=RED]([/color][color=BLUE]cons[/color] [color=#009900]1[/color] [color=RED]([/color][color=BLUE]is this[/color] i[color=RED]))[/color]
[color=RED])[/color]
[color=RED])[/color]
[color=RED])[/color]
[color=RED])[/color]
[color=RED]([/color][color=BLUE]while[/color] [color=RED]([/color][color=BLUE]=[/color] [color=RED]([/color][color=BLUE]car[/color] [color=RED]([/color][color=BLUE]sec[/color] pt [color=RED]([/color][color=BLUE]♪[/color] [color=BLUE]t[/color][color=RED])))[/color] [color=#009900]5[/color][color=RED])[/color]
[color=RED]([/color][color=BLUE]vla-put-integrationpoint[/color] [color=BLUE]tt[/color] [color=RED]([/color][color=BLUE]vlax-3d-point[/color] [color=RED]([/color][color=BLUE]cadr[/color] pt[color=RED])))[/color]
[color=RED])[/color]
[color=RED]([/color][color=BLUE]sec[/color] i [color=RED]([/color][color=BLUE]1+[/color] i[color=RED]))[/color]
[color=RED])[/color]
[color=RED])[/color][color=RED])[/color]
some considerations. . .
the first two examples allow the insertion with the use of osnap.
the first, in the case of a text, allows to set the justification.
I've never used this kind of cold insertion, at the moment I can't think of anything to get out of the command elegantly if I don't press esc.

:smile:
 
more than a month late than the last post, I saw him a couple of days ago.
the attached command is the final cherry of the gp post and in summary what franzfanton wanted, in fact now it comes out elegantly typing any key of the keyboard.

the function has been structured differently, basically every time you create a new text, it is deleted the previous one, otherwise I would get a splinter of infinite numbers as I move with the mouse. only the text entered with the selection is saved and with any key of the keyboard comes out silently deleting the text in preview.
 

Attachments

hello to all there is the possibility with this program to insert numbers/letters with the snap along a polyline?
Thank you.
 
Hello, I tried this lisp but the osnap is not used... is it possible to enable it by changing the programming?
more than a month late than the last post, I saw him a couple of days ago.
the attached command is the final cherry of the gp post and in summary what franzfanton wanted, in fact now it comes out elegantly typing any key of the keyboard.

the function has been structured differently, basically every time you create a new text, it is deleted the previous one, otherwise I would get a splinter of infinite numbers as I move with the mouse. only the text entered with the selection is saved and with any key of the keyboard comes out silently deleting the text in preview.
 
Hello, I tried this lisp but the osnap is not used... is it possible to enable it by changing the programming?
I'm sorry, I looked at the list, but I'm not able to... you can try to contact directly "lee-mac"
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top