Jump to content

Recommended Posts

Posted

Hi all

i have some multitext and it contains many type of information with numbering and i was doing manual editing those numbering is their any lsp which gave me those numbering continuously like P1,P2,P3. sample file are attached.

 

 

image.thumb.png.f8e5ef89ecad26900dd3f0abb5af67e7.png

Numbring.dwg

Posted

If all the texts were the same apart from the Px number at the end this is quite easy, increment text, should be examples out there. However there is a text there with more than just the 9M/T/.....Px this becomes trickier. If you create all the texts, incrementing the last digit as you go, then do the special cases modifications, that is possible.

 

To help us out a bit, what do you want to do, I see the end result but how do you want to get there?

Posted

How are you making the text in the first place why are you not incrementing as you make it else need like PXXX can then find and increment.

Posted
17 hours ago, Steven P said:

If all the texts were the same apart from the Px number at the end this is quite easy, increment text, should be examples out there. However there is a text there with more than just the 9M/T/.....Px this becomes trickier. If you create all the texts, incrementing the last digit as you go, then do the special cases modifications, that is possible.

 

To help us out a bit, what do you want to do, I see the end result but how do you want to get there?

Please check attached dwg all the text are not same

Posted
8 hours ago, BIGAL said:

How are you making the text in the first place why are you not incrementing as you make it else need like PXXX can then find and increment.

how i replace xx in P1,P2,P3?

Posted

The question in this post has a command line text find and replace (no dialogue box) which you could modify perhaps? ( https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/find-and-replace-text/td-p/5649883 )

 

If the texts are all different - are you typing them in as you make the leader? then you won't save much time initially, might as well just type in the number, but if you need to change the number it could be faster. However I would also consider using the built in find and replace function.

 

However a lot depends on how you are creating the text to start with, how are you making the texts

Posted
13 hours ago, pmadhwal7 said:

Please check attached dwg all the text are not same

They are no the same, but all have this root 

 

(1 . "*224965-P*")

By selectsimilar command there are 54 

image.thumb.png.b6cefec7a5a23a210b26e4844d564107.png

 but with 

(SETQ PXX-SS (SSGET "x"
                      '((0 . "MTEXT")
                        (8 . "Structure")
                        (1 . "*-P*") ;52                                    
 ;(1 . "*224965-P*");; 52
 ;(1 . "9M/S/RCC/4.5M/0.65M/LT\\P22974 - 224965-P*");;16
                        (7 . "TVIPL_Dimension")))
        )

 

So maybe it can be splitted by "-",  the last will be 

 

("9M/T/RCC/4.5M/0.65M/LT\\P    22974 " " 224965" "P46") 
Then get the last and by 

(setq PXX (last PXX-list))

(setq xx (car( LM:ParseNumbers pxx)))

it will return an integer

46 in this case 

After all this considerations.

 

 

Please clear us , what do you want to do?

 

 

 

 

 

Posted

The simplest way is when make the mtext just add the -Px to it. This is very rough but works.

 

(defun c:addpx ( / x obj str)
(setq x 0) ; chnage this to enter value to start -1 
(while (setq ent (entsel "Pick mtext "))
(setq obj (vlax-ename->vla-object (car  ent)))
(setq str (strcat (vla-get-textstring obj) "-P" (rtos (setq x (1+ x)) 2 0)))
(vla-put-textstring obj str)
)
(princ)
)
(c:addpx)

 

As I said already how are you generating the mtext are you typing each entry ?

Posted

As it is not a before and after , all can do is to guess the task to do . 

The sample DWG hold all text , from   (1 . "9M/T/RCC/4.5M/0.65M/LT\\P22974 - 224965-P1) to    (1 . "9M/T/RCC/4.5M/0.65M/LT\\P22974 - 224965-P52) 

So please show us the BEFORE. 

 

Posted
On 12/24/2022 at 11:45 AM, BIGAL said:

The simplest way is when make the mtext just add the -Px to it. This is very rough but works.

 

(defun c:addpx ( / x obj str)
(setq x 0) ; chnage this to enter value to start -1 
(while (setq ent (entsel "Pick mtext "))
(setq obj (vlax-ename->vla-object (car  ent)))
(setq str (strcat (vla-get-textstring obj) "-P" (rtos (setq x (1+ x)) 2 0)))
(vla-put-textstring obj str)
)
(princ)
)
(c:addpx)

 

As I said already how are you generating the mtext are you typing each entry ?

Mtext coping from another dwg to current dwg

  • Like 1
Posted
11 hours ago, pmadhwal7 said:

Mtext copying from another dwg to current dwg

Please show us another and current. dwg 's

 

Posted

Still trying to understand what you do to get where you are - another drawing (where the text comes from as well) might help.

 

For example, if you were to copy and paste from another drawing in order pf Px in the new drawing you could do a paste new text, find and replace type of thing. if you didn't copy in Px order there would need to be a few rules as what increment to use (Does P4 from drawing 1 go to be P12 - we need to know what and why happens).

 

If you copy all the text and leaders then again, what is the rule to do the increments?

 

Looking at this again, are the Px increments in any order, for example P1 at the top, P1000 at the bottom? Again this is possible assuming that the original text has a consistent text string to replace (for example "-Px" and then a new line).

 

Willing to help out.. but we need a clue what you do

 

Posted
On 12/30/2022 at 6:00 AM, pmadhwal7 said:

this lisp working fine expect joint clouser and Loop Cable rest of text are change but only those two are creating problems

text numbering-2ctx+.lsp 7.92 kB · 1 download

 

Yes that will work if all the text is the same apart from the last digit, then you can copy and increment that as you go (just as a note, it might be worth adding in a link to the original post with the LISP - give credit for the work that was done). This can also be modified to only increment selected texts.

 

However it doesn't fulfil the original question, but if you are happy that it will do 90% for you that is OK. Otherwise as mentioned above we need to know the rules and processes you use manually to do this, how do you decide which P1, P2, P3 are, and so on

 

 

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