lisp to remove certain part of MLEADER text

lisp to remove certain part of MLEADER text

Anonymous
Not applicable
3,344 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,345 Views
27 Replies
Replies (27)
Message 21 of 28

paullimapa
Mentor
Mentor
Accepted solution

I've again modified the code to accommodate for MText that don't contain a \n in the properties.

This should allow you to do a Select ALL in response to the FLL.lsp code.

 

 

 

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 22 of 28

Anonymous
Not applicable

HI thanks again for your time and i want to inform you that everything is ok the lisps works fine but another problem shows up not related to the LISPS it is a Plant 3D generation issue , the problem is there is an empty line in this mtext shows in the middle always the third line not in all drawings so is there is any LISP i can use to remove that line if exsist?

thanks again for your time and effort

0 Likes
Message 23 of 28

Anonymous
Not applicable

Hi Mr Alaa i want to inform you that the last modified lisp from Mr pli iworks when i am selecting all even it works when applying it in routine, but do you know any other lisp can delete empty line appears rundomly in the iso drawings the sample of this problem is attached.

0 Likes
Message 24 of 28

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... do you know any other lisp can delete empty line appears rundomly in the iso drawings the sample of this problem is attached.


That has "\r\n" for each hard return in it.  I'm not sure what the \r part is doing, and in fact if I go into the Mtext editor, select the entire content, and change the justification to Centered [not by the Properties box for the Mtext object, but within the Editor], the \r's go away [and the code at the beginning changes].  In any case, this substitution of one "\r\n" in place of two in a row removed the blank line for me:

 

(setq txtobj (vlax-ename->vla-object (car (entsel "\nSelect Mtext to remove blank line: "))))

(vla-put-TextString txtobj (vl-string-subst "\r\n" "\r\n\r\n" (vla-get-TextString txtobj)))

Kent Cooper, AIA
0 Likes
Message 25 of 28

Anonymous
Not applicable

thanks again Mr kent for your time and please tell me which part of your NER lisp that i shall substitute knowing that i am not an expert i am just a beginner and if you have some reference that i can understand the lisp codes and how it works you will made great favor to me so i can understand the terms your are saying to me I am just a standard user for AutoCAD Plant 3D ,Facing some problems I know that i have been some times a Headache to you ans the other respectful members but believe me i donot want that evey time you sent to me the all Written LISP.

Again thanks for your time and being patient with me.

0 Likes
Message 26 of 28

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

thanks again Mr kent for your time and please tell me which part of your NER lisp that i shall substitute knowing that i am not an expert i am just a beginner and if you have some reference that i can understand the lisp codes and how it works you will made great favor to me so i can understand the terms your are saying to me I am just a standard user for AutoCAD Plant 3D ,Facing some problems I know that i have been some times a Headache to you ans the other respectful members but believe me i donot want that evey time you sent to me the all Written LISP.

Again thanks for your time and being patient with me.


I think [without testing it] that you could change any of them [mine or pli's versions] by taking out double hard returns from the original content before doing any of the processing [and staying with the (subst)/(entmod) approach rather than the VLA-Properties approach in my latest Post].  Try replacing this:

 

      (setq
        mtdata (entget (ssname mtss (setq n (1- n))))
        content (cdr (assoc 1 mtdata))
      ); setq

 

with this:

 

      (setq
        mtdata (entget (ssname mtss (setq n (1- n))))
        content (vl-string-subst "\r\n" "\r\n\r\n" (cdr (assoc 1 mtdata)))
        content (vl-string-subst "\n" "\n\n" content); replacing previous 'content' variable

      ); setq

 

That should cover any blank lines that are from doubles of either the "\n" alone or the "\r\n" combination in your latest sample drawing.  [I hope there aren't other such combinations that might occur.]  If you also want to cover any that may be the result of double "\\P\\P" in other Mtext, you can add another re-setting of the 'content' variable:

 

      (setq
        mtdata (entget (ssname mtss (setq n (1- n))))
        content (vl-string-subst "\r\n" "\r\n\r\n" (cdr (assoc 1 mtdata)))

        content (vl-string-subst "\n" "\n\n" content)

        content (vl-string-subst "\\P "\\P\\P" content)

      ); setq

Kent Cooper, AIA
Message 27 of 28

alaa.ismail88
Observer
Observer

yes it is working now with the all selection thanks Mr PLI ,Mr kENT and mr nabster for your time and effort.

0 Likes
Message 28 of 28

Anonymous
Not applicable

thanks for your fast reply Mr Kent and yes it works just fine , I have replaced the first part to Mr.Pli LISP version and now it removes the empty line if exsists now i donot have any more problems

0 Likes