Need lisp to edit Mtext

Need lisp to edit Mtext

Anonymous
Not applicable
1,921 Views
10 Replies
Message 1 of 11

Need lisp to edit Mtext

Anonymous
Not applicable

Hi,

 

I need a lisp routine to edit a specific line in a multitext and set it to a numbered/Lettered style. Where can I find those properties and how do I change them?

 

Thanks,

Farid

0 Likes
1,922 Views
10 Replies
Replies (10)
Message 2 of 11

Kent1Cooper
Consultant
Consultant

By "a specific line" do you mean some specific text string as part of its contents?  Or [for example] the third line down from the top, whatever that contains?  If the latter, would it be the third line as the result of internal hard returns [a routine could find those] or just of word-wrapping [I'm not sure a routine could determine that, and it would vary if the defining-box width is changed]?  An image or small sample drawing with before and after would help.

Kent Cooper, AIA
0 Likes
Message 3 of 11

Anonymous
Not applicable

I have attached a screenshot of the before and after in CAD.

0 Likes
Message 4 of 11

Anonymous
Not applicable

Here is all the information I am getting from the entity. I`m not sure how to change some parts related to the numbering.

 

((-1 . <Entity name: 1c0034b8990>) (0 . "MTEXT") (5 . "32749") (102 . "{ACAD_XDICTIONARY") (360 . <Entity name: 1c0034b89a0>) (102 . "}") (330 . <Entity name: 1bfb60dc9f0>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "FTE-ELEC DETAILS") (62 . 4) (100 . "AcDbMText") (10 -34.3759 -154.35 0.0) (40 . 200.0) (41 . 15000.0) (46 . 0.0) (71 . 1) (72 . 5) (1 . "TITLE\\P \\PGENERAL\\P \\P\\pxi-3,l3,t3;A.\tLINE1\n\\PB.\tLINE 2 \n\\PC.\tLINE 3\\P\\pi0,l0,tz;\\PSPECIFIC\\P\\P\\pi-3,l3,t3;1.\tLINE 1\\P2.\tLINE 2\\P3.\tLINE 3\\P4.\tLINE 4") (7 . "FTE - Style") (210 0.0 0.0 1.0) (11 1.0 0.0 0.0) (42 . 1421.01) (43 . 5214.46) (50 . 0.0) (73 . 1) (44 . 1.0))

0 Likes
Message 5 of 11

Kent1Cooper
Consultant
Consultant

Here's how AutoCAD stores  the text content of your "after" Mtext object, which is in the (1 . "Text content") entry in entity data, or the TextString VLA property:

 

"TITLE\\P \\PGENERAL\\P \\P\\pxi-3,l3,t3;A.\tLINE1\n\\PB.\tLINE 2 \n\\PC.\tLINE 3\\P\\pi0,l0,tz;\\PSPECIFIC\\P\\P\\pi-3,l3,t3;1.\tLINE 1\\P2.\tLINE 2\\P3.\tLINE 3\\P4.\tLINE 4"

 

The \\P's are hard returns, and the \n's are new-line characters [why they're not also \\P's, I couldn't say, but it's probably related to being within bulleted content].  The \t's are Tabs.  The \\pxi-3,l3,t3; must be about the beginning of letter-designated bullets, the \\pi0,l0,tz; about the end  of those, and the \\pi-3,l3,t3; about the beginning of number-designated bullets [note the absence of the x that's in the letter-based one].  I don't know exactly what the components of those bullet-related codes mean.  The A. B. C. and 1. 2. 3. 4. bullets themselves look like  just plain text characters, but they're clearly under the influence of those bullet-triggering codes, because if you edit out a bulleted line, the subsequent lines get different bullet letters/ numbers.

 

It may  be possible to get a routine to inject those kinds of codes into the string content of Mtext that doesn't have them.  But having a routine find where to put them  would be a real challenge.  There would need to be some type of constants to look for.  I assume there would not  always be three and only three letter-designated ones, so it couldn't just count through a certain number of hard returns.  And I assume the "TITLE" would not be that word.  Would the headings "GENERAL" and "SPECIFIC" always be there, always exactly like that?  Would there always be blank lines between the letter-designated ones but not  between the number-designated ones?

Kent Cooper, AIA
0 Likes
Message 6 of 11

Anonymous
Not applicable

The word "General" is the only thing that exists in all the notes. "Specific" may not always be there. Also, the"Title" is supposed to be underlined and have a larger text height. vIt is variable. might be Mechanical Notes or Electrical notes or anything else. 

0 Likes
Message 7 of 11

ronjonp
Mentor
Mentor

If the data is variable then you'd have to specify start string and end string and not have anything in between that matches. At that point you might as well open in the mtext editor, highlight and apply bullet settings.

0 Likes
Message 8 of 11

Anonymous
Not applicable

I need to do this via lisp, but not the editor.

0 Likes
Message 9 of 11

ronjonp
Mentor
Mentor

Supply us with some rules that are always true and maybe it can be done.

0 Likes
Message 10 of 11

Anonymous
Not applicable

What I need to do includes a Mtext with the following format.

 

First line-> Underlined title with a height of 300 in 1:100 metric scale 

Second line-> space

third line-> GENERAL

4th to say 15th line-> Lettered sentences. (upper case)

16th line-> space

17th line -> "SPECIFIC" 

18 to 30th line-> Numbered list

0 Likes
Message 11 of 11

Anonymous
Not applicable

Is there any way to make this happen by keeping "General" and "Specific" as constants in the mtext?

0 Likes