numeric Increment along with multileader

numeric Increment along with multileader

ishaq03
Advocate Advocate
3,537 Views
18 Replies
Message 1 of 19

numeric Increment along with multileader

ishaq03
Advocate
Advocate

Please Provide me lisp where  I can control numeric Increment in Prefix Middle Suffix along with multi leader. For your reference I am attaching the Image file.   

0 Likes
Accepted solutions (1)
3,538 Views
18 Replies
Replies (18)
Message 2 of 19

pbejse
Mentor
Mentor

@ishaq03 wrote:

Please Provide me lisp where  I can control numeric Increment in Prefix Middle Suffix along with multi leader. For your reference I am attaching the Image file.   


 

The image you posted doesnt tell us much @ishaq03 

 

You mean user is prompt for all three?

Enter prefix: 

Enter Middle:

Enter Suffix: 

I assume those string values are separated by "-" and suffix is the only one that increments?

Will the user be selecting an existing Mleader and changing the value or create new Mleader for every increment?

 

Post a sample drawing please.

0 Likes
Message 3 of 19

ishaq03
Advocate
Advocate
I assume those string values are separated by "-" and suffix is the only one that increments. Yes I need the Increment in suffix only. and i want to be create new multileader for increment.
0 Likes
Message 4 of 19

pbejse
Mentor
Mentor

@ishaq03 wrote:
I assume those string values are separated by "-" and suffix is the only one that increments. Yes I need the Increment in suffix only. and i want to be create new multileader for increment.

We need to know if it works on an actual drawing @ishaq03 , the multileader style? the scale? etc..

Again, please post a sample drawing

 

0 Likes
Message 5 of 19

ishaq03
Advocate
Advocate

I attached the sample dwg as you requested.

0 Likes
Message 6 of 19

pbejse
Mentor
Mentor

@ishaq03 wrote:

I attached the sample dwg as you requested.


Thanks, that's good.

You have  "TP-RD-Z2-004"  as a value, 

  • Enter Prefix string value: TP
  • Enter Middle string value: RD 
  • Enter Suffix string value: Z2

Enter Start number: 1 ( and always 3 digits? i.e. 00, 012, 102? )

Then user starts clicking away placing the Mleader

 

If "TP-RD-Z2" will be the same during increment, why not just 

  • Enter string: TP-RD-Z2
  • Enter Start number: 1

 

0 Likes
Message 7 of 19

ishaq03
Advocate
Advocate

Please provide me numerical Increment After TP-RD-Z2 

0 Likes
Message 8 of 19

pbejse
Mentor
Mentor

@ishaq03 wrote:

Please provide me numerical Increment After TP-RD-Z2 


So there's only two prompts yes? One for string prefix AND the increment number?  There will be no need to to separate to three prompts. Do you agree?

 

0 Likes
Message 9 of 19

ishaq03
Advocate
Advocate
yes agreed.
0 Likes
Message 10 of 19

pbejse
Mentor
Mentor
Accepted solution

Here's a simple code

 

(defun c:IncAt ( / _padzeros Prefix startNos p1 p2)
(defun _padzeros ( s l)
	(if (< (strlen s) l) (_padzeros (strcat "0" s) l) s))      
      (if
            (and
                  (setq Prefix (getstring "\nEnter Prefix string value: " ))
                  (setq startNos (getint "\nEnter Start number: "))                 
                  )
            (while (and
                        (setq p1 (getpoint "\nPick target point"))
			(setq p2 (getpoint p1 "\nText Location"))
                        )
                  (command "_Mleader" "_non" (trans p1 1 0) "_non" (trans p2 1 0) "")
                  (vla-put-textstring (vlax-ename->vla-object (entlast))  
                        	(strcat Prefix "-" (_padzeros (itoa startNos) 3)))
                  (setq startNos (1+ startNos)))
            )
      (princ)
      )

 

Command: Incat

 

Let me know how it goes.

 

Message 11 of 19

ishaq03
Advocate
Advocate

Thanks Patrick Evangelista it's working perfectly as per my requirement. 

0 Likes
Message 12 of 19

pbejse
Mentor
Mentor

@ishaq03 wrote:

Thanks Patrick Evangelista it's working perfectly as per my requirement. 


 

Anytime @ishaq03 [(whispering) listen we dont use  names here  😁 ]  

 

0 Likes
Message 13 of 19

k.rakha
Explorer
Explorer

@pbejse It worked perfectly, but can be edited to include the text inside a circle block?

0 Likes
Message 14 of 19

Jafarali
Community Visitor
Community Visitor
how to use this lisp i need the same
I am new in lisp tools, can you help me
loded lisp tool and what is the commend for this list to active
0 Likes
Message 15 of 19

pbejse
Mentor
Mentor

@Jafarali wrote:
how to use this lisp i need the same
I am new in lisp tools, can you help me
loded lisp tool and what is the commend for this list to active

 

  • Copy the code at post # 15
  • Save the file as INCAT.lsp
  • Load the file using Appload.
Command: INCAT
Enter Prefix string value: BANANA
Enter Start number: 456

Pick target point
Text Location

 

Of course it depends on the current multileader style.

 

 

0 Likes
Message 16 of 19

pbejse
Mentor
Mentor

@k.rakha wrote:

@pbejse It worked perfectly, but can be edited to include the text inside a circle block?


(defun c:IncAt ( / _padzeros Prefix startNos p1 p2 ml attblock firstAtt BlockIDcoll)
(defun _padzeros ( s l)
	(if (< (strlen s) l) (_padzeros (strcat "0" s) l) s))      
      (if
            (and
                  (setq Prefix (getstring "\nEnter Prefix string value: " ))
                  (setq startNos (getint "\nEnter Start number: "))                 
                  )
            (while (and
                        (setq p1 (getpoint "\nPick target point"))
			(setq p2 (getpoint p1 "\nText Location"))
                        )
                  (command "_Mleader" "_non" (trans p1 1 0) "_non" (trans p2 1 0) "")
                  (setq ml (vlax-ename->vla-object (entlast)))
                  (setq nstr (strcat Prefix "-" (_padzeros (itoa startNos) 3)))
                  (cond
                        ((snvalid  (setq attblock  (vla-get-ContentBlockName ml)))
                          (setq mblk (vla-item (vla-get-blocks (vla-get-ActiveDocument (vlax-get-acad-object))) attblock))
                         (or firstAtt
                             (progn                                   
                         	(vlax-for itm mblk (setq BlockIDcoll (cons itm BlockIDcoll)))
                                (vl-some '(lambda (o)(and (eq (vla-get-ObjectName o) "AcDbAttributeDefinition")
                                                             (setq firstAtt (vla-get-ObjectID o))))
                                                     BlockIDcoll )
                                )
                             )
                         (vla-SetBlockAttributeValue ml firstAtt nstr)
                         )                                                 
                  	((vla-put-textstring ml  nstr))
                        )                  
                  (setq startNos (1+ startNos)))
            )
      (princ)
      )
0 Likes
Message 17 of 19

ishaq03
Advocate
Advocate

Dear Pbejse,
can we add Northing Easting Coordinates below the numbering via use the Insert field Formula, Means when Multileader pick point taken first row should be a numerical increment then below dynamically coordinates labels.
For your reference I am attaching a video Please check and give me your response as soon as possible.

0 Likes
Message 18 of 19

sooryaprabha9393
Community Visitor
Community Visitor

Can you add a provision for giving suffix also after the numer?

0 Likes
Message 19 of 19

pijus_s
Community Visitor
Community Visitor

Thank you for your work @pbejse 

0 Likes