Replace Text Is it Possible

Replace Text Is it Possible

jaimuthu
Advocate Advocate
552 Views
8 Replies
Message 1 of 9

Replace Text Is it Possible

jaimuthu
Advocate
Advocate

I have more than 5000 hatch object with leader and text the text is show area of the hatch its area wrong, i want select all hatch exisitng leader text value is replace to correct  area of text here i attach file what i want 

0 Likes
Accepted solutions (2)
553 Views
8 Replies
Replies (8)
Message 2 of 9

vladimir_michl
Advisor
Advisor

It will be quite complicated to "follow the line" from the Text to the proper Object (hatch). It might be easier to use fields (maybe fields inside MLeader) to re-create the labels.

 

Vladimir Michl, www.arkance.world  -  www.cadforum.cz

 

Message 3 of 9

-didier-
Advisor
Advisor
Accepted solution

Bonjour @jaimuthu (depuis la France).

 

Here is the program I propose.
I tested it, and it works in your example environment.

I have redefined the alignment of the text to the right point and the width of the text so that it is only on one line


If you have any problems, I thank you for letting me know and we will discuss.

Here is the video of my screen :

 

 

 

 

Amicalement

Éternel débutant.. my site for learning : Programmer dans AutoCAD

DA

EESignature

0 Likes
Message 4 of 9

jaimuthu
Advocate
Advocate

great job

0 Likes
Message 5 of 9

jaimuthu
Advocate
Advocate

great job thanks for 1000000 times 

0 Likes
Message 6 of 9

-didier-
Advisor
Advisor

Bonjour @jaimuthu 

 

I’m happy if it’s useful.

Beware of units they can prohibit the selection that I imagined.

If you see any errors, please let me know and I will make adjustments.

 

Amicalement, from France.

Éternel débutant.. my site for learning : Programmer dans AutoCAD

DA

EESignature

0 Likes
Message 7 of 9

paullimapa
Mentor
Mentor
Accepted solution

excellent coding...I also added the following for @jaimuthu 

1. Place Text on specified Layer "TEXT" and Color "2" Yellow:

 

    (setq txtlyr "TEXT" ; layer for text
          txtcol "2"    ; color for text
    )

 

2. Created Field value for Hatches Layer & Area values so that the next time these change they're updated automatically:

 

;                (setq la (vlax-get-property h 'layer))
 (setq la(strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa(vla-get-ObjectID h)) ">%).Layer>%")) ; create layer as field
;                (setq ha (/ (vlax-get-property h 'area) 1000000.0))
 (setq ha(strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa(vla-get-ObjectID h)) ">%).Area \\f \"%lu2%pr2%ct8[1.000000000000000E-006]\">%")) ; create area as field
;                        (setq val (strcat "Layer: " la ", Area: " (rtos ha 2 2) " sq.m"))
                        (setq val (strcat "\\C" txtcol ";Layer: " la ", Area: " ha " sq.m")) ; layer & area as field in color
                        (vlax-put-property tex  'Layer txtlyr)

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 8 of 9

-didier-
Advisor
Advisor

Bonjour @paullimapa 

 

Thank you.

Your improvement is a perfect idea.

Amicalement

Éternel débutant.. my site for learning : Programmer dans AutoCAD

DA

EESignature

0 Likes
Message 9 of 9

paullimapa
Mentor
Mentor

You are welcome…cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes