Page 1 of 1

Automated part numbering

Posted: Tue Nov 12, 2024 9:03 am
by chancegarrison
Hello friends,
Does anyone know of a macro that automates part numbering?
It would be awesome to have a macro that selects the next available part number that you could input on the fly that also stores the previous input until changed.

For example, I make a new part for project XYZ-000. There are already parts for XYZ-000 that are named XYZ-000-001, XYZ-000-002.
When I click save, if a prompt opened that I could input "XYZ-000-" and the part was automatically named XYZ-000-003.

Re: Automated part numbering

Posted: Tue Nov 12, 2024 11:20 am
by tate876
You could set up a simple macro that checks the last number used in the format and adds 1 to it. For example, it could search for the highest number in your project (like XYZ-000-002), then prompt you for the prefix (XYZ-000-) and auto-generate the next number (XYZ-000-003). If you're using Excel or a similar program, it might be as easy as a simple formula, or if you're in a more coding-heavy environment, a quick script could do the job.

Re: Automated part numbering

Posted: Tue Nov 12, 2024 11:59 am
by chancegarrison
tate876 wrote: Tue Nov 12, 2024 11:20 am You could set up a simple macro that checks the last number used in the format and adds 1 to it. For example, it could search for the highest number in your project (like XYZ-000-002), then prompt you for the prefix (XYZ-000-) and auto-generate the next number (XYZ-000-003). If you're using Excel or a similar program, it might be as easy as a simple formula, or if you're in a more coding-heavy environment, a quick script could do the job.
Currently I just use save, then it opens the file directory where my files are saved and I scroll down until I see the last used number.

Re: Automated part numbering

Posted: Tue Nov 12, 2024 12:01 pm
by AlexLachance
We use CustomTools to do this, it has a SQL Database built for this purpose, though I'm sure if you're a one man team, something simple like @tate876 said would most likely be much more viable.

Re: Automated part numbering

Posted: Tue Nov 12, 2024 2:57 pm
by SPerman
You might be able to take this and modify it. It says it generates a random part number but you might be able to change it to generate a serialized number.

Revision control app macro (release)

Re: Automated part numbering

Posted: Wed Nov 13, 2024 12:59 am
by gupta9665
Check the macro by @artem here

Re: Automated part numbering

Posted: Thu Nov 14, 2024 3:10 pm
by chancegarrison
gupta9665 wrote: Wed Nov 13, 2024 12:59 am Check the macro by @artem here
Thanks Deepak!
Would it be possible to add a prompt to pop up when running the macro that allowed the user to input these values? That would be exactly what im looking for. The user would click save, be prompted to select a folder, then enter the base name to be searched within the folder (for example: PRT-001 is already used) so user enters PRT- and the macro automatically knows to save the new part as PRT-002.
Const NMB_SRC_FILE_PATH As String = "D:\prt.txt" 'path to store the current part index
Const NMB_FORMAT As String = "000" 'padding for the number, e.g. 001, 002, instead of 1, 2
Const BASE_NAME As String = "PRT-" 'Base prefix for file naming
image.png