Jump to content

Split Single line Mtext object into Two line Mtext based on / symbol


Recommended Posts

Posted (edited)

Hi Everyone

I have a lots of Mtext objects in my drawing file (as shown in below image),i want split into two lines (as shown in below image) and manual editing taken more time.

i want like this, if I click on the Mtext, the first digits (before /) comes in first line.then (/) should be removed, rest of the texts comes in second line, all text rotation should be zero (0), text height should be 2mm and style should be Aerial Black.

Before

asd.jpg

After

assd.jpg

 

Please help me anyone on this.

Please let me know is this possible?

Thanks in advance

Edited by gmmdinesh
Posted

Hi Everyone

I have a lots of Mtext objects in my drawing file (as shown in below image),i want split into two lines (as shown in below image) and manual editing taken more time.

i want like this, if I click on the Mtext, the first digits (before /) comes in first line.then (/) should be removed, rest of the texts comes in second line, all text rotation should be zero (0), text height should be 2mm and style should be Aerial Black.

Before

[ATTACH=CONFIG]62144[/ATTACH]

After

[ATTACH=CONFIG]62145[/ATTACH]

 

Please help me anyone on this.

Please let me know is this possible?

Thanks in advance

Posted

As start point..

(and (setq en (car (entsel)))
    (setq $ (vla-get-TextString (vlax-ename->vla-object en)))
    (vla-put-Textstring (vlax-ename->vla-object en) (vl-string-subst "\\P" "/" $))
    )

 

;have a look at dump properties

(vlax-dump-object (vlax-ename->vla-object en))
vla-put-height
vla-put-StyleName
;etc..

keep trying yourself

 

Don't know formatting Mtext?

Suggestion:

manually edit in MTEXT editor ARIAL BLACK etc..

then select entity look at Properties dialog -> TEXT -> Contents it will show format something like:

"{\\fArial Black|b0|i0|c0|p34; ....... }"

Tips: strcat

 

maybe Unformat is useful before applying any changes my $0.02

Posted

Why did you post it again !

 

It was answered in other post did you try the code I did. All the answers are there.

 

Administrator please merge.

Posted

Really sorry.. actually the answer thread not shown for me on that day..

Hi hanhphuc

I will try your code and get back to you.

Thanks

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