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

insert a default text within a selected rectangle

  • Thread starter Thread starter alessandrellij
  • Start date Start date

alessandrellij

Guest
how can I create a macro that once selected a square writes inside a default text? thanks to all those who will help me.
 
macro: autotextrect

look at the macro in vba, where you find "testopredefinito" insert what you need.
the polylines examined must have 4 sides and be closed.

bye
 

Attachments

Thank you, that's exactly what I was looking for. would be possible, having multiple squares formed by polylines insert an incremental numerical text (1, 2, 3, ...)? Thank you again.
 
Here it is, the variable count starts from 1 and is increased by 1 every time you write the text.

bye
 

Attachments

always larger, and I prosecute what I was trying to do, the only problem and that I have blocks constituted from a square (polyline) and text so I have to use explosions to run the macro, the blocks would be numbered from right to left and from above on, launching the macro numbering happens randomly, selecting each single block respecting the desired order and then proceeding to correct numbering
the thing is making me unpack, perhaps it would be better a macro that selected the block manually proceeds to the creation of the label with the counter.
Thank you very much.
 
this is the file in question, the first three blocks are inclusive of the text that should appear in the other blocks.
Thank you.
 

Attachments

launches the macro autotextrect, the texts write them by referring to the insertion point of the blocks, then you will find them moved very far to the left, in your case.

n.b.: if the previous routine you think can serve, rename the file because it replaces the previous one.

bye
 

Attachments

I tried to launch the macro but it doesn't give me any results, it goes running but no writing appears, what can I do?
Thank you for all the time you're dedicating.
 
make an extended zoom, the lyrics find them quite moved to the left.
This is due to the fact that the point of insertion of the block is not coincident with some summit of the entities that compose it.
I'll train your completed dwg.

Hi.
 

Attachments

perfect, I didn't see the text on the left but just what I needed. If I can still read a little bit of your patience the text I have to insert and compose: s 0001, s 0002, s 0003, ..... etc. the problem and that putting the numbers are of a magnitude 0.5 the "s" and of a different size 0.7 I tried everything but I can not assign greatness to a single text.
 
thisdrawing.modelspace.addmtext pt, 12, "{s\h0.70x;" & format(s + 1, "0000")

before starting the macro, set text style and height.
the highlighted part you can change it to your liking to set the text height that contains the numbers.
0.70 means that the height you set, for example 2, multiplied 0.70 by 1.40, so you get the s by 2 and the numbers by 1.40.

Hi.
 

Attachments

exhaustive and precise as always, finalizing I solved... or better you solved.
Thank you very much.
 

Forum statistics

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

Members online

No members online now.
Back
Top