Jump to content

Recommended Posts

Posted

How can we find a missing number from a number sequence in a text layer using Autolisp.

 

For ex-

1

2

3

4

6

7

 

in the above sequence 5 number is missing. so we should find 5 and zoom in to its nearest number as 4.

 

Actually we need it for parcel numbering where no number should be miss.

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • subodh_gis

    13

  • pBe

    10

  • MSasu

    2

  • BlackBox

    1

Top Posters In This Topic

Posted Images

Posted

and bump the rest? i.e. 7 becomes 6 and 6 becomes 5?

Posted

Subodh_gis, are you willing to write that code, so looking for some hints or request someone to write it for you?

Posted
Subodh_gis, are you willing to write that code, so looking for some hints or request someone to write it for you?

 

:lol: I was about to write a demo code. lets wait for the OP to confirm his intent then.

Posted
Subodh_gis, are you willing to write that code, so looking for some hints or request someone to write it for you?

 

Requesting someone to write it for me.

Posted
Requesting someone to write it for me.

 

What about it boss? [MSasu], do you concur? :)

 

@Subodh_gis,

 

Anyhoo. you did not answer my question though

 

and bump the rest? i.e. 7 becomes 6 and 6 becomes 5?
Posted

It’s you time and benevolence, so please proceed at your wish my friend!

Sorry if my question sounded like a restriction. Is just that I really like to offer support to people that were willing to write the routines by themselves, so wanted to know if I may be involved.

Posted
What about it boss? [MSasu], do you concur? :)

 

@Subodh_gis,

 

Anyhoo. you did not answer my question though

 

No I just neet to find and zoom in.

Posted
and bump the rest? i.e. 7 becomes 6 and 6 becomes 5?

 

No I just neet to find and zoom in.

Posted

Sorry if my question sounded like a restriction. Is just that I really like to offer support to people that were willing to write the routines by themselves, so wanted to know if I may be involved.

 

No worries my friend :) I with you on that MSasu.

 

No I just neet to find and zoom in.

 

Find what? the next number of the missing digit? What if there are two missing digits? after the zoom then do what?

Posted
No worries my friend :) I with you on that MSasu.

 

 

 

Find what? the next number of the missing digit? What if there are two missing digits? after the zoom then do what?

 

thanks for your support

find missing numbers and make list if we click on any number of missing list then zoom in to previous number of missing number. if no missing then Simple msg that no missing found. nothing to do after zoom in we will manually edit it.

Capture.JPG

Posted
thanks for your support

find missing numbers and make list if we click on any number of missing list then zoom in to previous number of missing number. if no missing then Simple msg that no missing found. nothing to do after zoom in we will manually edit it.

 

It appears that you already have a program to find the missing numbers. What i was offering to you before was to auto-magically bump the numbers to accommodate the missing digits.

 

Your request just became more complicated with the addition of a list box.:D

Posted
No worries my friend :) I with you on that MSasu.

 

 

 

Find what? the next number of the missing digit? What if there are two missing digits? after the zoom then do what?

 

Thanks for your kind support

 

Find the missing numbers and make a list of them if we click on any of missing number then zoom in to previous number of that missing number. if no missing number found then simple msg that no missing found. after zoom nothing to do we will manually edit it.

Posted
It appears that you already have a program to find the missing numbers. What i was offering to you before was to auto-magically bump the numbers to accommodate the missing digits.

 

Your request just became more complicated with the addition of a list box.:D

 

 

any thing that we can in this situation list box is not necessary. any other suggestion to complete missing sequence.

Posted
any thing that we can in this situation list box is not necessary. any other suggestion to complete missing sequence.

 

Ok, now lets get down to business, are these TEXT entity? are they on a particular layer? will this be via selection [per block i suppose]?

 

Uhhhmm sample drawing?

Posted
Ok, now lets get down to business, are these TEXT entity? are they on a particular layer? will this be via selection [per block i suppose]?

 

Uhhhmm sample drawing?

 

yes they are text entity. they are in "TXT01_PARCEL" layer.

Posted (edited)

I see, still no sample drawing :)

 

Here's a simple code: forced to re-number everything regardless what is the missing digit

 

the OP "dont need this actually"

 

We can add a sub to find the lowest missing number and start from there [maybe later].

 

[b]***CODE MOVED TO POST # 24***[/b]

Edited by pBe
Posted
I see, still no sample drawing :)

 

Here's a simple code: forced to re-number everything regardless what is the missing digit

 

(defun c:filler	(/ _missing cont ss str i missed num)
 (if (setq cont nil
    ss	 (ssget "_:L" '((0 . "TEXT") (8 . "TXT01_PARCEL")))
     )
   (progn
     (repeat (setq i (sslength ss))
(setq str
       (cdr
	 (assoc 1 (entget (setq e (ssname ss (Setq i (1- i))))))
       )
)
(if (numberp (setq v (read str)))
  (setq cont (cons (list v e) cont))
)
     )
     (setq cont (vl-sort cont
		  '(lambda (j k)
		     (< (car j) (car k))
		   )
	 )
     )
     (if (> (car (last cont)) (length cont))
(progn
  (setq num 0)
  (foreach val cont
    (vla-put-textstring
      (vlax-ename->vla-object (cadr val))
      (itoa (setq num (1+ num)))
    )
  )
)
     )
   )
 )
 (princ)
)(vl-load-com)

 

We can add a sub to find the lowest missing number and start from there [maybe later].

 

 

 

I don't need this actually.

Posted
I don't need this actually.

 

Thats gratitude for you. :glare:

 

It's unfortunate, I was planning to re-write the code to meet other conditions and also to include a list box.

 

Post a sample drawing then.

Posted
Thats gratitude for you. :glare:

 

It's unfortunate, I was planning to re-write the code to meet other conditions and also to include a list box.

 

Post a sample drawing then.

 

Dear see the attached sample or can you come on Team Viewer so that i can show you.

sample.dwg

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