Posted by Jeff Cope at 9 July, 2008,
12:40 am
Over the past few months I have received numerous emails from folks using the original PDMWE Number Generator. It is such a simple little app that I was pleasantly surprised at all of the nice feedback people gave me regarding it. To show my appreciation, I have modified the Number Generator to allow it to work with multiple serial number sequences ”on the fly.”
You have always had the ability to set up muliple serial number generators in PDMWorks Enterprise but now the user can decide at File/Folder creation time which serial number to use. An anticipated use case with this improved version of the tools is for users who have multiple categories of parts with numbers being assigned by category. Note: Even though the functionality has been expanded, the tool is still very easy to install and configure.
So how does it work?
The Number Generator is a PDMWorks Enterprise add-in that runs whenever a user presses a command button (from a data card) that is configured to “call” it. The Number Generator downloads the latest copy of the ListItems.xml file from your vault’s Options folder and checks it for List Items. Each <ListItem> element in the XML file has a <Name> element and corresponding <Value> element. The <Name> elements represent what the users sees in the Number Generator’s drop-down list and the <Value> elements represent the Serial Number sequence that is “called” whenever a user selects that item from the drop-down list. There is no reasonable limit to the number of serial number sequences that can be supported by the Number Generator. Just add a new <ListItem> node to the ListItems.xml file, being careful to type the exact name of the Serial Number sequence in the <Value> node.
Don’t be afraid of the xml. It is really simple. Here is the xml file that was used to develop and test the Number Generator. Notice that the text contained in the <Value> nodes of the ListItems are an exact match for the names of the Serial Number sequences in the vault.
Alright… Ready to get started? Good. Here are the high-level installation and configuration steps:
- Download and unzip the file containing the tool.
- Create any desired serial number sequences using the PDMWorks Enterprise Administration Tool.
- Add the included add-in to the PDMWorks Enterprise Add-ins using the PDMWorks Enterprise Administration Tool.
- Using Notepad or (better) an XML editor such as XML Notepad, edit the ListItems.xml file that is included in the Options folder to include your desired serial number sequences.
- Copy the included Options folder to the root of your PDMWorks Enterprise vault.
- Checkin the ListItems.xml file, if not done automatically.
- Give all users Read Only permissions to the Options folder.
- Add a command button to any data card you wish to run the Number Generator from and configure the command button to “call” the Number Generator.
- Test it out and if it works well for you, then add some nice feedback to this post. Otherwise, curse me under your breath and keep it to yourself.
Here are the detailed steps:
- Download the file containing the tool from here. Unzip it once it is downloaded. It should contain two dll files (Interop.EdmLib.dll and NumberGeneratorForPDMWE2008.dll) and an Options folder which in turn contains a single xml file (ListItems.xml).

- Create any desired serial number sequences using the PDMWorks Enterprise Administration Tool. Keep track of the names of the Serial Number sequences as you will need this information for step four.

- Add the included add-in to the PDMWorks Enterprise Add-ins using the PDMWorks Enterprise Administration Tool. Use the New button to add the Add-in’s dll files to the vault. Make sure you select BOTH dll files to add. Don’t worry about the warning message that PDMWorks Enterprise gives you after you add the dlls. The warning message is just letting you know that you have to reboot when updating the same Add-in to a later version. I changed the name of this add-in from the previous version so that won’t be an issue here.




- Using Notepad or (better) an XML editor such as XML Notepad, edit the ListItems.xml file that is included in the Options folder to include your desired serial number sequences. Notepad can be used but I am partial to XML Notepad as seen below. XML Notepad is a totally free utility from Microsoft and can be downloaded from here. If using Notepad, be very careful to preserve the format of the XML file. Each <ListItem> element tag must be closed by a corresponding </ListItem> element tag. The same goes true for the <Name> and <Value> element tags.

- Copy the included Options folder to the root of your PDMWorks Enterprise vault. I want to emphasize the “to the ROOT of your vault” part of that. If your vault’s local view is found at “C:\PDMWE\MyVault” then your Options folder should be found at “C:\PDMWE\MyVault\Options.”
- Checkin the ListItems.xml file, if not done automatically.
- Give all users Read Only permissions to the Options folder.
- Add a command button to any data card you wish to run the Number Generator from and configure the command button to “call” the Number Generator.

- Test it out and if it works well for you, then add some nice feedback to this post. Otherwise, curse me under your breath and keep it to yourself.


You can hit the “Copy” button to copy the auto-generated number to the clipboard. You can then paste it anywhere you want (e.g. filename, data card variable, etc…).

If you or someone you know use(s) this thing and find it helpful, then give us a holler in the comments section below. Thanks.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Works great when used inside the PDMWE File explorer. Works like a champ, easy to install and setup etc. Can you check on why it does not work from within the SW interface? So when I do an initial save on a SW file and put it into the vault, it does not work. I click the Add In Button on the data card and nothing seems to happen.
Other than that, AWESOME!
Daniel,
Thanks for letting me know. I will check it out. My guess is that SolidWorks somehow suppresses the callback since it happens in the midst of a SolidWorks command. I’ll debug it and let you know though.
Jeff
Jeff -
Works great! Thanks for sharing this valuable information.
However… our users don’t like the copy and paste function. We would really like to click a button and populate a card variable with the next available serial number. I’ve tried a few methods but haven’t been successful.
Thoughts?
-Ben
Hi Ben,
The software was originally written as you mentioned. An issue arose, however, in the case of Template Cards where accessing the datacard would crash the system because the file did not exist yet. There was no way at that time (PDMWE 2007) to distinguish between datacard type at runtime so we changed it to work as you see. At some point soon I will revisit.
Thanks for reading the site.
Regards,
Jeff
I’ve got the same comment as Ben… it would be nice to be able to have it populate the field on the card… otherwise it looks like a very very useful add-in for PDM.. I’m going to have to check it out.
Any chance at all that you could provide the vb source files for this add-in so I could modify it to insert the serial into a variable field on the “Template Input Form” card? Or even just send me the code that I can copy/paste? I’ve already got your PDMWE Add-In template, and it’s working wonderfully! So I could use it as the base and just paste your code in instead of having to have all the files.
If I can get it working successfully where it will insert the serial in the card automatically, then I’d be happy to send the modified code back to you.
Jeff,
Just tested the newly compiled addin with EPDM 2009 SP0 and it works like a champ. Thanks for the quick update!
Daniel
Jeff,
Just wondering why you moved away from defining the serial number within the “Name of addin” string (e.g. AUTONUMBER:SerialNumber). This functionality worked very well for us in the past and required less user interaction. Also, selecting the desired serial number from a drop down menu, as currently written, allows for multiple serial numbers to be generated, possibly in error which could lead to “lost” numbers in the series.
-Brian
Brian,
I changed the functionality in order to fulfill a request for functionality from another company. I figured I could do both with a single addin. You are correct about ‘lost’ numbers but that can be remedied as soon as someone comes along who is willing to pay for an enhanced version.
hi everyone!
thanks Jeff for sharing this add-in!
i was wondering if you have any advice on question i have from customer.
they want to generate solidworks part number with 2 pre-selected prefixes, i.e.
part number: cat_1-cat_2-cat_3 where cat_1 and cat_2 can be picked from drop down list and cat_3 is a serial running number. e.g. T9-V-001, T9-V-002, T9-G-001, etc.
as you can see, the trick would be to have the serial number running according to the prefix so we dont skip numbers… cat_1 and cat_2 define the type of part and the material.
thanks a lot in advance, would really appreciate any advice!