Lisp Customization for a renumber

Lisp Customization for a renumber

ryanrettig
Contributor Contributor
1,614 Views
9 Replies
Message 1 of 10

Lisp Customization for a renumber

ryanrettig
Contributor
Contributor

I have a renumber lisp file that I have attached. Currently it has a prefix, then you input the starting number and it will number from there. Example being if I am labeling equipment it could be SPK-101. With how it is currently written this would go to SPK-102, SPK-103 and so on. What I would like to accomplish is changing this so instead of it counting it goes up a letter in the alphabet. So it would no do SPK-101A, SPK-101B, SPK-101D I would just be typing SPK-101 in teh prefix and tell it what letter to start at and it adds the A, B, C, at the end. 

0 Likes
Accepted solutions (1)
1,615 Views
9 Replies
Replies (9)
Message 2 of 10

pendean
Community Legend
Community Legend
While you wait... any reason you don't want to consider this freebie from the Autodesk App store that does all of that and so much more https://apps.autodesk.com/ACD/en/Detail/Index?id=8051485828049059617&appLang=en&os=Win32_64
0 Likes
Message 3 of 10

ryanrettig
Contributor
Contributor

Because I did not know of its existence. I have been using these lisp files for so long I just think of making changes and not about the app store. Thank you I will give this one a try. 

0 Likes
Message 4 of 10

ryanrettig
Contributor
Contributor
I just tried it it appears to only place my block and change the attribute not just change the attribute on the blocks I already have placed in the drawing. I will continue to try it out but so far doesn't fit what I am trying to do. It also makes all visibility states on my blocks visible which means anything I place with it I have to go back and change the visibility states.
0 Likes
Message 5 of 10

Kent1Cooper
Consultant
Consultant

@ryanrettig wrote:

.... So it would no do SPK-101A, SPK-101B, SPK-101D I would just be typing SPK-101 in teh prefix and tell it what letter to start at and it adds the A, B, C, at the end. 


Is there any risk of ever getting to Z and needing to go further?  If so, should it go to SPK-101AA, ...AB, ...AC etc., or SPK-102A, ...102B, etc, or something else?

Kent Cooper, AIA
Message 6 of 10

ryanrettig
Contributor
Contributor

@Kent1Cooper Great question, in my experience going to z would cover what I need this for.  

0 Likes
Message 7 of 10

ryanrettig
Contributor
Contributor

Still looking for a solution on this one. 

0 Likes
Message 8 of 10

Kent1Cooper
Consultant
Consultant
Accepted solution

Try the attached [minimally tested on Text objects only].  I did NOT edit the comments/description at the top, which still talks in terms of incrementing numbers, and refers to a suffix part that has been edited out prior to your posting, nor did I change aspects of formatting that I would have done differently.  But it seems to work.

Kent Cooper, AIA
0 Likes
Message 9 of 10

ryanrettig
Contributor
Contributor

@Kent1Cooper Thank you, Tried it with block attribute text as well as standard text and works exactly how I hoping for. Thank you I will have to read through it to see what you did still learning how to write these and learning by editing ones I have or looking through other files I find. Thank you again. 

0 Likes
Message 10 of 10

Kent1Cooper
Consultant
Consultant

@ryanrettig wrote:

Thank you, ... works exactly how I hoping for. .... still learning how to write these .... 


You're welcome.  In this case, one of the things to be aware of, and to analyze in the differences between the two routines, is this:  The (getint) function in the original, for getting a number, returns nil if you hit Enter [as does (getreal), and (getpoint), and maybe some others].  But the (getstring) function in the edited version, needed to ask for a letter suffix instead, does not return nil on Enter, but rather returns a text string, though it's empty [""].  So there's a new variable for that User-input string, so that the routine can test whether that holds "", rather than whether it's nil [doesn't exist], and can assign a number accordingly to the number variable that gets incremented.

Kent Cooper, AIA