Extensible CAD Technologies
SolidWorks and PDMWorks Enterprise Development Blog

PDMWE Number Generator – Part Deaux

Posted by at 9 July, 2008, 12:40 am

PDMWorks Enterprise Number Generator - Part DeauxOver 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:

  1. Download and unzip the file containing the tool.
  2. Create any desired serial number sequences using the PDMWorks Enterprise Administration Tool. 
  3. Add the included add-in to the PDMWorks Enterprise Add-ins using the PDMWorks Enterprise Administration Tool. 
  4. 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.
  5. Copy the included Options folder to the root of your PDMWorks Enterprise vault.
  6. Checkin the ListItems.xml file, if not done automatically.
  7. Give all users Read Only permissions to the Options folder.
  8. 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.
  9. 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:

  1. 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).
  2. 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 Serial Numbers to your PDMWorks Enterprise vault
  3. 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.
  4. 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. 
  5. 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.”
  6. Checkin the ListItems.xml file, if not done automatically.
  7. Give all users Read Only permissions to the Options folder.
  8. 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.
  9. 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!
Category : .NET | PDMWE | PDMWE API | PDMWorks Enterprise | XML

12 Responses to “PDMWE Number Generator – Part Deaux”


Daniel Rohats July 31, 2008

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!

Jeff Cope July 31, 2008

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

BenG October 27, 2008

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

Jeff Cope October 27, 2008

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

Christina Seay October 29, 2008

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.

Christina Seay November 10, 2008

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.

Daniel Rohats November 14, 2008

Jeff,

Just tested the newly compiled addin with EPDM 2009 SP0 and it works like a champ. Thanks for the quick update!

Daniel

Brian Spaeth March 30, 2009

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

Jeff Cope June 15, 2009

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.

Christine October 20, 2010

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!

Rob Perrins June 1, 2012

Hi
Could this be made to work with SolidWorks workgroup PDM (not enterprise PDM)?

thx

Rob



Generate First-Article Inspection Reports From TIF, PDF and CAD Drawing Files With InspectionXpert. Generate First-Article Inspection Reports From SolidWorks Drawing Files With InspectionXpert.