lisp to remove certain part of MLEADER text

lisp to remove certain part of MLEADER text

Anonymous
Not applicable
3,342 Views
27 Replies
Message 1 of 28

lisp to remove certain part of MLEADER text

Anonymous
Not applicable

HI thanks for your time I have a problem of removing a certain part of mleader text the problem is as follows:

i am using AutoCad Plant 3d and it is generating an isometric drawing for the model

the iso.dwg conatins mtext different from the mtext that i can write normally in AutoCAD so that any lisp cannot apply on it becouse it canot see it

the problem details are follows

i am trying to remove 2 lines appears repeatedly in that mtext this two lines contains the Coordinates "E XXXXX"or"N XXXXX"or "S XXXXX"or "W XXXXX" (i.e any line in mtext start with [N or E or W or S] and space ) and the "X" Tends to variable number.

the problem is the lisp cannot see and apply the removal of the generated mtext because it is different from regular mtext althoug they have same name in property "mtext" but it seems that us belongs to mleader and the lisp cannot see it even if i have added "mleader" or "multileader" to the searchzone it the attached lisp.no changes happened although if there are regular mtext with the samecontent the lisp works on it so can any one helps me with this problem with some trick or lisp

the lisp and sample DWG is attached.

0 Likes
3,343 Views
27 Replies
Replies (27)
Message 2 of 28

Anonymous
Not applicable

Note

The lisp is done by the respectful member kentcooper

0 Likes
Message 3 of 28

paullimapa
Mentor
Mentor

Looking at the lisp file this line of code will give you the answer:

(setq teststr (strcat "\\P" dir " "))

 

It's looking for a matching \P string in the MText.

Once found it'll replace the string afterwards with nothing.

 

Since your MText does not include the \P string, nothing is replaced.

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store

 


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

Anonymous
Not applicable

thanks for your fast reply and whould you please tell me what to do? and if this line shall be replaced , with what ? 

again thanks for your fast reply and fogive me i am not an expert.

0 Likes
Message 5 of 28

Anonymous
Not applicable

Please note that the lisp works with the normal mtext not the exploded from multileader 

0 Likes
Message 6 of 28

paullimapa
Mentor
Mentor
Accepted solution

The MText you're having trouble with uses \n code for new line instead of \\P

So the lisp will have to be changed to look for \n code instead of \\P

See attached revised code which should work.

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 7 of 28

Anonymous
Not applicable

thanks alot it is works but there is some error in its operation it replaces also the elevation symbol i.e "EL+" to "WL+" i donot know why?

0 Likes
Message 8 of 28

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

thanks alot it is works but there is some error in its operation it replaces also the elevation symbol i.e "EL+" to "WL+" i donot know why?


I can't check here, but if the newline is really a single backslash followed by an n, in place of a double backslash followed by a P in standard Mtext, I expect you would also want to change the 3's in the settings of the 'mid' and 'end' variables to 2's.

 

When I'm at my place with a newer version, I'll take a shot at a version that can handle both kinds in one selection, if pli doesn't beat me to it.

Kent Cooper, AIA
Message 9 of 28

paullimapa
Mentor
Mentor
Accepted solution

Oops...forgot to reduce the text string position by one to accommodate for the difference with \\ vs \

Try revised lisp in attached ner.zip

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 10 of 28

Anonymous
Not applicable

yes thanks a lot now the "EL +" is adjusted but i want one last favour , I have another lisp is more general and the respectful member doni49 has send to me which removes any "E #####" and "N #####"or "S #####"or "W #####" need to be modified as per n code for this type of mtext and i can't modify it so could you please modify it to see this kind of mtext and send it to me again i am so grateful for your time and help you wouldn't believe how much would that save time to me and donot forget please that last correction that you have done

again thanks alot for your time

0 Likes
Message 11 of 28

Anonymous
Not applicable

thanks alot mr kentcooper for your time and i have one last quison for your LISP, sometimes the secound coordinates line donot have a Space ater the letter "E" i.e "E#####" in stead of "E #####" so could you please tell me how to overcome this issue becouse the code you send me skip this lines.

again thanks alot for your wffort and time.

0 Likes
Message 12 of 28

paullimapa
Mentor
Mentor
Accepted solution

In addition to the making the same previous revisions onto this fll.lsp, there's also an additional line that needed to be changed:
The fll.lsp searches for *[NEWS]#####* with no space between the direction and numbers.

Since your MText currently shows a space, the line of code to do the search needs to be changed to include a space:

*[NEWS] #####*

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


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

Anonymous
Not applicable

yes thanks alot it works and there is sometime the program generates the secound line without the space and the respectful mrs cooper told me that to remove that space the lisp will find the desiered line 

finally i want to thank you all for your effort for my annoying problem becouse AutoCAD plant 3D cannot generate the line continuation with elevation only it must attach the coordinates or donot provide all three lines and i have to remove them manually every time for each sheet.

0 Likes
Message 14 of 28

paullimapa
Mentor
Mentor
0 Likes
Message 15 of 28

alaa.ismail88
Observer
Observer

HI i am using plant 3d only and i have the same problem but i need to remove any line in the same mtext which begins with E or N or S or W  without any space after them and the NER lisp dosenot work except if there is space please help

thanks 

0 Likes
Message 16 of 28

paullimapa
Mentor
Mentor

Like the original poster, please post a sample of a drawing that contain the MText that shows the E or N or S or W without the space following so we can investigate.

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


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

alaa.ismail88
Observer
Observer

this is a sample dwg. for the the problem which i face

0 Likes
Message 18 of 28

paullimapa
Mentor
Mentor

Attached is the modified FLL.lsp.

Again the simple modification is in this line of code:

                  (if (not(wcmatch cline "*[NEWS] #####*\n")) ; NEWS followed by space

OR
                  (if (not(wcmatch cline "*[NEWS]#####*\n")) ; NEWS followed with no space

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


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

alaa.ismail88
Observer
Observer

thank you for your fast replay but this lsp works only when i select the mtext one by one but when i select all the mtext by writeing in the command line "fll" then "all" it dose not work????? 

 

thanks

0 Likes
Message 20 of 28

paullimapa
Mentor
Mentor

It fails because you do have some other MText that don't follow the given format.  The easiest thing to do would be to just select the MText that has the directional labels that need to be eliminated.

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


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