<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Extensible By Design &#187; Extensible By Design</title>
	<atom:link href="http://extensiblecad.com/words/category/com/feed/" rel="self" type="application/rss+xml" />
	<link>http://extensiblecad.com/words</link>
	<description>SolidWorks and PDMWorks Enterprise Development Blog</description>
	<lastBuildDate>Mon, 02 Feb 2009 09:02:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Who? Me?&#8230;PDMWorks Enterprise API Development Gotchas With .NET</title>
		<link>http://extensiblecad.com/words/2008/06/18/who-mepdmworks-enterprise-api-development-gotchas-with-net/</link>
		<comments>http://extensiblecad.com/words/2008/06/18/who-mepdmworks-enterprise-api-development-gotchas-with-net/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 17:49:24 +0000</pubDate>
		<dc:creator>Jeff Cope</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[PDMWE]]></category>
		<category><![CDATA[PDMWE API]]></category>
		<category><![CDATA[PDMWorks Enterprise]]></category>
		<category><![CDATA[.NET Development]]></category>
		<category><![CDATA[PDMWorks Enterprise API Development]]></category>

		<guid isPermaLink="false">http://extensiblecad.com/words/?p=99</guid>
		<description><![CDATA[A year or two ago I read a book that changed the game for me.  The book was called .NET Gotchas and it made me about  10x more effective as a developer.  The book details 75 common pitfalls with .NET development and explains how to avoid them.  I was knee-deep in a few of those [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://extensiblecad.com/words/wp-content/uploads/2008/06/homer-doh1.jpg"></a><a href="http://extensiblecad.com/words/wp-content/uploads/2008/06/homer-doh2.jpg"></a><a href="http://extensiblecad.com/words/wp-content/uploads/2008/06/rodney.jpg"><img class="alignleft alignnone size-medium wp-image-102" style="FLOAT: left; MARGIN: 5px 10px" title="rodney" src="http://extensiblecad.com/words/wp-content/uploads/2008/06/rodney-300x168.jpg" alt="PDMWorks Enterprise API Development Gotchas" width="300" height="168" /></a></p>
<p>A year or two ago I read a book that changed the game for me.  The book was called <a title=".NET Gotchas" href="http://labs.oreilly.com/stats/detail.xqy?fpi=0596009097" target="_blank">.NET Gotchas</a> and it made me about  10x more effective as a developer.  The book details 75 common pitfalls with .NET development and explains how to avoid them.  I was knee-deep in a few of those pitfalls when I found the book at my local library.  In fact, I was at the library specifically to get help for a few problems I was having with a PDMWE Addin project that I was working on at the time.  The addin was written for <span id="more-99"></span>.NET and even though the book was written based on an earlier version of the .NET Framework, it still did wonders for me and for my project. <br />
Time went on and eventually I found myself at a PDMWorks Enterprise Addin development breakout session at SolidWorks World 2008 in San Diego.  Although the presenter did a pretty good job explaining the process for creating,  editing and debugging an Addin for PDMWE, he told attendees to select the “Register for COM Interop” button in Visual Studio to register their Addin for Interop.  I knew at the time that this was a violation of <a title="Gotcha #73" href="http://labs.oreilly.com/stats/detail.xqy?fpi=0596009097" target="_blank">Gotcha #73 – Simply turning the switch for COM Interop is dangerous</a>.  I kept my mouth shut at the time but I made a note to self to write up a PDMWorks Enterprise-specific Gotcha column based on some of the things that have tripped me up during my three years of Conisio / PDMWorks Enterprise API development. </p>
<p> </p>
<p>Here are my top five:</p>
<p><a href="http://extensiblecad.com/words/wp-content/uploads/2008/06/homer-doh1.jpg"><img class="alignnone size-medium wp-image-100" style="margin: 5px; vertical-align: baseline;" title="homer-doh1" src="http://extensiblecad.com/words/wp-content/uploads/2008/06/homer-doh1.jpg" alt="PDMWorks Enterprise API Development Gotchas" width="115" height="106" /></a></p>
<p><strong>#1 –PDMWorks Enterprise doesn’t like COM Interop assemblies that don’t include “interop” in the filename.</strong></p>
<p><strong></strong><br />
When referencing COM libraries from managed code using Visual Studio’s Project, Add Reference method, Visual Studio automatically creates the COM Interop assemblies for you and by default adds .interop to the filename just before .dll. However, sometimes it is necessary to create your own COM interop assemblies (to support multiple versions of an app for instance). In this situation, the developer specifies the filename arbitrarily (e.g. mySolidWorks2007assembly.dll, mySolidWorks2008assembly.dll, etc…). Additionally, you may be using interop assemblies provided by the software OEM (side note – it is usually a good idea to use these if they are available) in which case the assemblies’ filenames might also not include interop. So, there are a few scenarios in which you may run into a situation where you have a COM interop assembly that doesn’t have .interop in the filename. This is normally not a problem but for some reason PDMWorks Enterprise (this was last tested on 2007 but I suspect the issue is present in 2008 as well) does not recognize the interop assembly as an interop assembly unless it has interop in the name. In this situation, PDMWorks Enterprise will fail to bring the assembly down to the client machine to load with your addin. This in turn causes various loading and binding issues and an Addin that doesn’t work.<br />
<strong>Solution:</strong></p>
<p>Use the Type Library Importer tool to create an interop assembly with the name you desire from a COM assembly. For example, typing</p>
<p><span style="color: #800080;">tlbimp.exe MyActiveX.dll /out:Interop.MyActiveX.dll</span></p>
<p>at the Visual Studio command prompt will generate a COM Interop assembly named Interop.MyActiveX.dll from a COM assembly called MyActiveX.dll.  If you need a strong-named interop assembly (also usually a good idea), then you should instead type</p>
<p><span style="color: #800080;">tlbimp.exe MyActiveX.dll /out:Interop.MyActiveX.dll/keyfile:MyKeyFile.snk</span></p>
<p>where MyKeyFile.snk is your company’s strong-name key.</p>
<p> </p>
<p><strong>#2 – Weakly named assemblies can cause security issues on Windows clients at run-time.</strong></p>
<p><strong></strong><br />
Microsoft introduced a number of security enhancements in .NET 2.0 that are meant to protect you from bad guys and boogie-men. These enhancements are specifically dealing with “trusted zones” and are generally helpful. However, if your assemblies were written in Visual Studio 2005 or later or were written in Visual Studio 2003 but don’t specify a pre-2.0 .NET framework in their .config file, then these enhancements will wreak havoc and mayhem on your addin.</p>
<p><strong>Solution:</strong></p>
<p>Unless you want to configure your assemblies as “trusted” on every machine, which by the way requires the .NET Framework Administration tool, then your best bet is to simply provide a strong-name to your assemblies. Note: Creating your assemblies in Visual Studio 2003 isn’t a good option due to the great enhancements in Visual Studio 2005 and Visual Studio 2008.</p>
<p><a href="http://extensiblecad.com/words/wp-content/uploads/2008/06/homer-doh2.jpg"><img class="alignnone size-medium wp-image-101" style="margin: 5px; vertical-align: baseline;" title="homer-doh2" src="http://extensiblecad.com/words/wp-content/uploads/2008/06/homer-doh2.jpg" alt="PDMWorks Enterprise API Development Gotchas" width="75" height="106" /></a></p>
<p><strong>#3 – Using COM interop assemblies in your addin causes assembly loading issues if the COM assembly isn’t installed on the client machine beforehand.</strong></p>
<p>COM Interop assemblies are really just wrappers for your COM assemblies. The COM assemblies still do most of the work. The wrapper just tells Windows to load the COM assembly using MSCOREE to marshal calls between your managed and unmanaged code. This means that the COM assembly must still be present on the machine running your addin. PDMWorks Enterprise will auto-magically download your COM Interop assembly (if it has interop in the filename) but this is not the case for the COM assembly itself. This is problematic in cases where you have so many clients using PDMWorks Enterprise that installing the COM assembly manually isn’t a good option. This issue usually presents itself via nasty assembly binding errors and will kill your Addin and anything else within a 50 meter kill-zone.</p>
<p><strong>Solution:</strong></p>
<p>Place a copy of the COM assembly in your PDMWorks Enterprise vault and write a PDMWorks Enterprise Addin to automatically install it in the Global Assembly Cache, GAC, on the PDMWorks Client. Once the COM assembly is deployed to the GAC on all clients, you should be able to run your addin with confidence. I haven’t tried doing this from the same Addin that requires the COM assembly but in theory it should be possible. You may have to explicitly load the assemblies in question using the System.Runtime.InteropServices and System.Reflection namespaces but I think it is possible.</p>
<p> </p>
<p><strong>#4 – Adding files directly to PDMWorks Enterprise-managed folders in Windows can put you on the hot seat.</strong><br />
Imagine this phone call to you at 8am on a Monday morning just as you arrive at the office: “Hi Jim, this is Bruce, VP of Operations at ACME Fab and I wanted to let you know that the PDMWorks Enterprise addin that you sold us is crashing PDMWorks Enterprise intermittently. All hell appears to have broken loose and I think we want our money back.” Those aren’t fun phone calls but you are prime candidate for one of those calls if you are adding / writing files directly to managed folders in Windows and relying on PDMWorks Enterprise’s hooks into Windows to add the files to the vault. File access permissions typically ensue depending on what SolidWorks Addins are loaded on the client and which way the end user is holding his or her mouth at the time. That is the extreme case though. The more common, though less severe, situation is where PDMWorks Enterprise and SolidWorks don’t crash but some of the files simply are not added to the vault (i.e. they are marked as a local file).</p>
<p><strong>Solution:</strong></p>
<p>Use a non-managed working directory (e.g. C:\MyPDMWEtempFolder\) to write your files to and then use the addfile API call from PDMWorks Enterprise to actually add the file to the vault.</p>
<p> </p>
<p><strong>#5 – Forgetting your assembly’s configuration file may cause heartburn.</strong></p>
<p>If you have specified Settings in your project (accessed in VB through my.settings) or a specific version of the .NET Framework for your addin, then those items are persisted by Visual Studio in the configuration file located in your application’s execution directory.  The file is usually named MyAssembly.dll.config where MyAssembly.dll is the filename of your Addin.  If you don’t add that to the PDMWorks Enterprise vault along with your addin via the PDMWorks Enterprise Administration tool, then those settings will not be available to your addin while it executes on the client machine.  If you have specified a setting, then chances are it is important to your application and will give you  and/or your end users chest pains if they are missing.</p>
<p><strong>Solution:</strong> </p>
<p>Add the MyAssembly.dll.config file to your addin (i.e. MyAssembly.dll) in the PDMWorks Enterprise Vault using the PDMWorks Enterprise Administration tool.  PDMWorks Enterprise will download it at runtime to the same directory as your assembly.</p>
<p> </p>
<p>There are numerous potential hazards to negotiate when writing a PDMWorks Enterprise Addin using .NET but those are my top five.  I hope you find them useful and if you do, then please don’t hesitate to give me some blog love in the comments section.  My ego is a powerful motivator to keep writing these articles : )</p>
	<p></p>
	<hr noshade style="margin:0;height:1px" />
	<small><p>&copy; Jeff Cope for <a href="http://extensiblecad.com/words">Extensible By Design</a>, 2008. |
	<a href="http://extensiblecad.com/words/2008/06/18/who-mepdmworks-enterprise-api-development-gotchas-with-net/">Permalink</a> |
	<a href="http://extensiblecad.com/words/2008/06/18/who-mepdmworks-enterprise-api-development-gotchas-with-net/#comments">9 comments</a> |
	Add to
	<a href="http://del.icio.us/post?url=http://extensiblecad.com/words/2008/06/18/who-mepdmworks-enterprise-api-development-gotchas-with-net/&amp;title=Who? Me?&#8230;PDMWorks Enterprise API Development Gotchas With .NET"><img src="http://yoursite.com/images/icons/delicious.gif" border="0"> del.icio.us</a>
	<a href="http://www.digg.com/submit"><img src="http://yoursite.com/images/digg.gif" border="0"> digg</a><br/>
	Who's linking ?
	<a href="http://www.technorati.com/search/http://extensiblecad.com/words/2008/06/18/who-mepdmworks-enterprise-api-development-gotchas-with-net/" title="Search on Technorati"><img src="http://yoursite.com/images/icons/technorati.gif" border="0">Technorati</a>
	<a href="http://www.blogpulse.com/search?query=http://extensiblecad.com/words/2008/06/18/who-mepdmworks-enterprise-api-development-gotchas-with-net/" title="Search on Blogpulse"><img src="http://yoursite.com/images/icons/blogpulse.gif" border="0">BlogPulse</a>
	<a href="http://google.com/blogsearch?q=http://extensiblecad.com/words/2008/06/18/who-mepdmworks-enterprise-api-development-gotchas-with-net/" title="Search on Google Blog Search"><img src="http://yoursite.com/images/icons/google.gif" border="0">Google</a><br/>
	Want more on these topics ? Browse the archive of posts filed under <a href="http://extensiblecad.com/words/category/net/" title="View all posts in .NET" rel="category tag">.NET</a>, <a href="http://extensiblecad.com/words/category/com/" title="View all posts in COM" rel="category tag">COM</a>, <a href="http://extensiblecad.com/words/category/pdmplm/pdmwe/" title="View all posts in PDMWE" rel="category tag">PDMWE</a>, <a href="http://extensiblecad.com/words/category/pdmplm/pdmwe/pdmwe-api/" title="View all posts in PDMWE API" rel="category tag">PDMWE API</a>, <a href="http://extensiblecad.com/words/category/pdmworks-enterprise/" title="View all posts in PDMWorks Enterprise" rel="category tag">PDMWorks Enterprise</a>.</small></p>
<p>Copyright 2007 <a href=http://extensiblecad.com/words>Extensible By Design.</a>  All rights reserved.</p>]]></content:encoded>
			<wfw:commentRss>http://extensiblecad.com/words/2008/06/18/who-mepdmworks-enterprise-api-development-gotchas-with-net/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Setting Up and Troubleshooting Your SolidWorks Add-in Development Environment.  Take off, eh&#8230;</title>
		<link>http://extensiblecad.com/words/2008/06/12/setting-up-and-troubleshooting-your-solidworks-add-in-development-environment-take-off-eh/</link>
		<comments>http://extensiblecad.com/words/2008/06/12/setting-up-and-troubleshooting-your-solidworks-add-in-development-environment-take-off-eh/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 05:31:31 +0000</pubDate>
		<dc:creator>Jeff Cope</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[SolidWorks]]></category>
		<category><![CDATA[SolidWorks API]]></category>

		<guid isPermaLink="false">http://extensiblecad.com/words/2008/06/12/setting-up-and-troubleshooting-your-solidworks-add-in-development-environment-take-off-eh/</guid>
		<description><![CDATA[  Writing Add-ins in SolidWorks can be tricky stuff as it involves class libraries, COM, interfaces, etc&#8230;  It can be argued whether it is easier or harder in .NET (ease of use of .NET versus pain in the rear of COM Interop) but your good friends at SolidWorks set out to make it easy on [...]]]></description>
			<content:encoded><![CDATA[<p> <img border="0" vspace="15" width="450" src="http://extensiblecad.com/words/wp-content/uploads/2007/12/mckenzie_bros.jpg" hspace="15" height="348" /></p>
<p>Writing Add-ins in SolidWorks can be tricky stuff as it involves class libraries, COM, interfaces, etc&#8230;  It can be argued whether it is easier or harder in .NET (ease of use of .NET versus pain in the rear of COM Interop) but your good friends at SolidWorks set out to make it easy on all of us by creating Visual Studio templates for quickly creating SolidWorks Add-ins.  <span id="more-85"></span>The templates are packaged with the SolidWorks API SDK, support VB and C# and are analagous to having a SolidWorks part template that already has some geometry in it, custom properties, material assigned, etc&#8230;  When it was introduced back in the day, it was a Godsend.  It does have its issues from time to time though.  For some reason, I have had trouble deploying both on SolidWorks 2007 and 2008.  The SolidWorks API SDK installer runs without errors but when I attempt to create a new SolidWorks Add-in, I see this unfriendly message:</p>
<p> <img border="0" vspace="10" align="middle" width="783" src="http://extensiblecad.com/words/wp-content/uploads/2008/06/solidworks-developmentenvironmentthree.png" hspace="10" alt="SolidWorks Add-in Template Error" height="142" /></p>
<p>The I have spoken to a few other developers and concluded that I am not the only one so I decided to write a post on it.  Besides, I go through this everytime I have to reinstall SolidWorks, which is just often enough to be a real pain but not quite often enough for me to ever remember the steps to fix the issue.  I should admit then I am writing this as much for myself as I am for you.  Here goes&#8230;</p>
<p> The Cause:</p>
<p>Based on the error message, you might get the impression that this is a trust or security issue.  That might lead you down a path of signing the dll with a strong name, configuring .NET security policy on your machine, etc&#8230; (i.e. the path to frustration).  To find the real cause, we must examine the Global Assembly Cache, GAC, to take a look at this SolidWorksTools dll file.  The GAC is where shared .NET assemblies are placed so that they can be made available to other applications.  On Windows XP, the GAC is located at &#8220;C:Windows\assemblies\&#8221;.  Taking a look at the GAC, we see that it contains a different version of the SolidWorksTools dll file than that which is expected by the SolidWorks Add-in Template for Visual Studio.  The version in the GAC is version 2.0.0.0 and not version 1.0.0.1, which is what the SolidWorks Add-in Template for Visual Studio is looking for.</p>
<p> <img border="0" vspace="10" align="middle" width="1014" src="http://extensiblecad.com/words/wp-content/uploads/2008/06/solidworks-developmentenvironmentone.png" hspace="10" height="724" /></p>
<p> If we take a look at the template itself, then we can see where the version is specified for the SolidWorks Add-in Template for Visual Studio.  FYI, the template is contained in a zip file (SWVBAddin.zip for Visual Basic) which in turn is contained in the &#8220;&#8230;Templates\Project Templates\&lt;Visual Basic or Visual C#&gt;&#8221; folder of your Visual Studio 2005 directory.  Note:  I have Visual Studio 2008 but it is still in the box so I&#8217;ll let you know once I try it if the templates go in the same place. </p>
<p><img border="0" vspace="15" width="844" src="http://extensiblecad.com/words/wp-content/uploads/2008/06/solidworks-developmentenvironmenteleven.png" hspace="15" alt="SWAddin.zip file containing SolidWorks Add-in Template" height="399" /></p>
<p>The zip file contains various bitmaps, icons, classes and modules as you would expect to see in an Add-in but it also a file called VBAddin.vstemplate which is a Visual Studio template file.  Once you open it, you see that indeed a different version of the SolidWorksTools dll file has been specified than the one which is installed in the GAC.  .</p>
<p> <img border="0" vspace="15" align="middle" width="870" src="http://extensiblecad.com/words/wp-content/uploads/2008/06/solidworks-developmentenvironmentfour.png" hspace="15" alt="SolidWorksTools dll issue" height="100" /></p>
<p>In theory, one should be able to update the VBAddin.vstemplate file above to refer to the insalled version of the SolidWorkTools dll file.  One of my favorite philosophers once explained why this might not work for me:</p>
<p> &#8221;In theory there is no difference between theory and practice.  In practice there is.&#8221;  &#8211; Yogi Berra</p>
<p>What I do is just to uninstall the SolidWorksTools dll file in the GAC (right mouse button on the file in the GAC and select uninstall) and replace it with the version 1.0.0.1 file that SolidWorks API support gave me the first time I ever reported this issue (a long time ago, in a galaxy far, far away&#8230;) .  You can do this by simply dropping the file in the GAC folder (e.g. C:\Windows\assemblies). </p>
<p>Once you add the version 1.0.0.1 SolidWorksTools dll file to the GAC, you can go into Visual Studio and attempt to create a new SolidWorks project from the SolidWorks Add-in Template for Visual Studio.</p>
<p> <img border="0" vspace="15" width="690" src="http://extensiblecad.com/words/wp-content/uploads/2008/06/solidworks-developmentenvironmenttwo.png" hspace="15" alt="SolidWorks Add-in Template for Visual Studio" height="478" /></p>
<p>And it works!  Now you can begin writing that Add-in (i.e. the one that is now a few days late while you fought with the SolidWorks SDK).</p>
<p>Note:  For any SolidWorks Add-ins that were previously compiling using the 1.0.0.1 dll, you will have to change your Visual Studio Project to reference the newer version.</p>
<p> Good luck.</p>
	<p></p>
	<hr noshade style="margin:0;height:1px" />
	<small><p>&copy; Jeff Cope for <a href="http://extensiblecad.com/words">Extensible By Design</a>, 2008. |
	<a href="http://extensiblecad.com/words/2008/06/12/setting-up-and-troubleshooting-your-solidworks-add-in-development-environment-take-off-eh/">Permalink</a> |
	<a href="http://extensiblecad.com/words/2008/06/12/setting-up-and-troubleshooting-your-solidworks-add-in-development-environment-take-off-eh/#comments">9 comments</a> |
	Add to
	<a href="http://del.icio.us/post?url=http://extensiblecad.com/words/2008/06/12/setting-up-and-troubleshooting-your-solidworks-add-in-development-environment-take-off-eh/&amp;title=Setting Up and Troubleshooting Your SolidWorks Add-in Development Environment.  Take off, eh&#8230;"><img src="http://yoursite.com/images/icons/delicious.gif" border="0"> del.icio.us</a>
	<a href="http://www.digg.com/submit"><img src="http://yoursite.com/images/digg.gif" border="0"> digg</a><br/>
	Who's linking ?
	<a href="http://www.technorati.com/search/http://extensiblecad.com/words/2008/06/12/setting-up-and-troubleshooting-your-solidworks-add-in-development-environment-take-off-eh/" title="Search on Technorati"><img src="http://yoursite.com/images/icons/technorati.gif" border="0">Technorati</a>
	<a href="http://www.blogpulse.com/search?query=http://extensiblecad.com/words/2008/06/12/setting-up-and-troubleshooting-your-solidworks-add-in-development-environment-take-off-eh/" title="Search on Blogpulse"><img src="http://yoursite.com/images/icons/blogpulse.gif" border="0">BlogPulse</a>
	<a href="http://google.com/blogsearch?q=http://extensiblecad.com/words/2008/06/12/setting-up-and-troubleshooting-your-solidworks-add-in-development-environment-take-off-eh/" title="Search on Google Blog Search"><img src="http://yoursite.com/images/icons/google.gif" border="0">Google</a><br/>
	Want more on these topics ? Browse the archive of posts filed under <a href="http://extensiblecad.com/words/category/net/" title="View all posts in .NET" rel="category tag">.NET</a>, <a href="http://extensiblecad.com/words/category/com/" title="View all posts in COM" rel="category tag">COM</a>, <a href="http://extensiblecad.com/words/category/solidworks/" title="View all posts in SolidWorks" rel="category tag">SolidWorks</a>, <a href="http://extensiblecad.com/words/category/solidworks/solidworks-api/" title="View all posts in SolidWorks API" rel="category tag">SolidWorks API</a>.</small></p>
<p>Copyright 2007 <a href=http://extensiblecad.com/words>Extensible By Design.</a>  All rights reserved.</p>]]></content:encoded>
			<wfw:commentRss>http://extensiblecad.com/words/2008/06/12/setting-up-and-troubleshooting-your-solidworks-add-in-development-environment-take-off-eh/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Free SolidWorks Add-In To Remind You To Eat Your Custom Properties</title>
		<link>http://extensiblecad.com/words/2008/02/23/free-solidworks-add-in-to-remind-you-to-eat-your-custom-properties/</link>
		<comments>http://extensiblecad.com/words/2008/02/23/free-solidworks-add-in-to-remind-you-to-eat-your-custom-properties/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 02:50:51 +0000</pubDate>
		<dc:creator>Jeff Cope</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[CAD]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[SolidWorks]]></category>
		<category><![CDATA[SolidWorks API]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://extensiblecad.com/words/2008/02/23/free-solidworks-add-in-to-remind-you-to-eat-your-custom-properties/</guid>
		<description><![CDATA[ In spite of all their positive benefits, which are many, more than a few SolidWorks users look upon custom properties with the same disdain that a pre-schooler would have for green leafy vegetables.  You can explain the benefits of custom properties, how they help you find things, how they lead to healthy drawing title blocks, [...]]]></description>
			<content:encoded><![CDATA[<p><img border="0" vspace="5" align="baseline" width="319" src="http://extensiblecad.com/words/wp-content/uploads/2008/02/pyramid.gif" hspace="5" height="249" /></p>
<p> In spite of all their positive benefits, which are many, more than a few SolidWorks users look upon custom properties with the same disdain that a pre-schooler would have for green leafy vegetables.  You can explain the benefits of custom properties, how they help you find things, how they lead to healthy drawing title blocks, how they improve PDM implementations, etc&#8230; until you are blue in the face and with some individuals you still won&#8217;t make a dent.  There might be a change for a few days even a few weeks but inevitably you are back to files with no custom properties filled out. </p>
<p>In order to increase the life-expectancy of CAD administrators everywhere, I have posted a free .NET Add-In for SolidWorks that will &#8220;remind&#8221; your users to enter certain custom properties whenever they create a new file or save an existing one (after the initial save).  The list of custom properties is configurable and</p>
<p> <span id="more-80"></span></p>
<p>the user cannot proceed with their file until they enter the custom properties.  I am sure the program can be improved upon but for those without SolidWorks API skills of their own this should be a nice little app.  Also, for those who do have SolidWorks API skills using Visual Basic.NET, I am more than happy to share the code if you request it.</p>
<p> The Add-In, called &#8220;Big Brother&#8221; is written for SolidWorks 2008 and targets the 2.0 .NET Framework, which means if you have SolidWorks 2008 installed on your machine then you can use it.</p>
<p> To get started,</p>
<p>1.  Download the installer package for Big Brother from <a target="_blank" href="http://extensiblecad.com/words/wp-content/uploads/2008/02/big-brother.msi" title="SolidWorks VB.NET Add-In">here.</a></p>
<p>2.  Run the installer, agreeing to the overly wordy license agreement on the way.</p>
<p><img border="0" vspace="5" align="baseline" width="503" src="http://extensiblecad.com/words/wp-content/uploads/2008/02/extensible_bigbrother03.gif" hspace="5" alt="SolidWorks API Add-In Written In Visual Basic.NET" height="414" /></p>
<p>3.  After installing the software, run the &#8220;Register Big Brother.bat&#8221; file in the installation directory.  Running this batch file will register Big Brother with COM and add the appropriate registry entries for SolidWorks to load Big Brother when SolidWorks is run.</p>
<p><img border="0" vspace="5" width="820" src="http://extensiblecad.com/words/wp-content/uploads/2008/02/extensible_bigbrother05.gif" hspace="5" alt=".NET Add-In for SolidWorks 2008 Using The SolidWorks API" height="416" /></p>
<p>4. This is an optional step but if you don&#8217;t already have a decent XML editor, then I recommend you<a target="_blank" href="http://www.microsoft.com/downloads/details.aspx?familyid=72D6AA49-787D-4118-BA5F-4F30FE913628&amp;displaylang=en" title="Download XML Notepad, A Free XML Editor"> download XML Notepad</a> which is a free XML editor from Microsoft.</p>
<p><img border="0" vspace="5" width="891" src="http://extensiblecad.com/words/wp-content/uploads/2008/02/extensible_bigbrother06.gif" hspace="5" alt="Download Microsoft XML Notepad" height="814" /></p>
<p>5.  Use XML Notepad to edit the XML configuration files in the installation directory.  The installation has three XML files which are used to configure which custom properties are managed by Big Brother for each of the three main part types in SolidWorks.</p>
<ul>
<li>AssemblyPropertiesToManage.XML &#8211; Represents custom properties for assemblies.</li>
<li>DrawingPropertiesToManage.XML &#8211; Represents custom properties for drawings.</li>
<li>PartPropertiesToManage.XML &#8211; Represents custom properties for parts.</li>
</ul>
<p><img border="0" vspace="5" width="744" src="http://extensiblecad.com/words/wp-content/uploads/2008/02/extensible_bigbrother07.gif" hspace="5" alt="XML Configuration Files For SolidWorks Add-In Written In Visual Basic.NET" height="558" /></p>
<p>Edit the list of custom properties to manage for each document type using XML Notepad.  Each &#8220;ExtProperty&#8221; node represents a custom property.  PropName represents the name of the custom property to be managed.  PropValue and PropType should not be touched.  Leave those alone.  Save the file(s) when finished.</p>
<p>6.  Open SolidWorks and create a new part.  After selecting your template, you should be prompted to verify or fill in the values for the custom properties in your PartPropertiesToManage.XML file.  The same thing should happen for subsequent file saves.  The original Save (for new documents) doessnot trigger the FileSaveNotify event.  I suspect that it is triggered by the FileSaveAsNotify event.  If anyone tries that and gets the answer then please let me know.</p>
<p><img border="0" vspace="5" width="800" src="http://extensiblecad.com/words/wp-content/uploads/2008/02/extensible_bigbrother09.gif" hspace="5" alt="SolidWorks API Add-In Written For .NET 2.0 Using Visual Basic" height="572" /></p>
<p>7.   Additional configuration of the Add-In may be performed by editing the &#8220;ExtensibleEventManager.dll.config&#8221; file, which you should also use XML Notepad to edit. </p>
<ul>
<li>If BigBrotherMode=True then it is mandatory that users enter values for all custom properties.  If BigBrotherMode=False then the dialog pops up as an FYI.</li>
<li>If CatchFileNewEvent=True then files are managed on FileNew in addition to FileSave.</li>
</ul>
	<p></p>
	<hr noshade style="margin:0;height:1px" />
	<small><p>&copy; Jeff Cope for <a href="http://extensiblecad.com/words">Extensible By Design</a>, 2008. |
	<a href="http://extensiblecad.com/words/2008/02/23/free-solidworks-add-in-to-remind-you-to-eat-your-custom-properties/">Permalink</a> |
	<a href="http://extensiblecad.com/words/2008/02/23/free-solidworks-add-in-to-remind-you-to-eat-your-custom-properties/#comments">12 comments</a> |
	Add to
	<a href="http://del.icio.us/post?url=http://extensiblecad.com/words/2008/02/23/free-solidworks-add-in-to-remind-you-to-eat-your-custom-properties/&amp;title=Free SolidWorks Add-In To Remind You To Eat Your Custom Properties"><img src="http://yoursite.com/images/icons/delicious.gif" border="0"> del.icio.us</a>
	<a href="http://www.digg.com/submit"><img src="http://yoursite.com/images/digg.gif" border="0"> digg</a><br/>
	Who's linking ?
	<a href="http://www.technorati.com/search/http://extensiblecad.com/words/2008/02/23/free-solidworks-add-in-to-remind-you-to-eat-your-custom-properties/" title="Search on Technorati"><img src="http://yoursite.com/images/icons/technorati.gif" border="0">Technorati</a>
	<a href="http://www.blogpulse.com/search?query=http://extensiblecad.com/words/2008/02/23/free-solidworks-add-in-to-remind-you-to-eat-your-custom-properties/" title="Search on Blogpulse"><img src="http://yoursite.com/images/icons/blogpulse.gif" border="0">BlogPulse</a>
	<a href="http://google.com/blogsearch?q=http://extensiblecad.com/words/2008/02/23/free-solidworks-add-in-to-remind-you-to-eat-your-custom-properties/" title="Search on Google Blog Search"><img src="http://yoursite.com/images/icons/google.gif" border="0">Google</a><br/>
	Want more on these topics ? Browse the archive of posts filed under <a href="http://extensiblecad.com/words/category/net/" title="View all posts in .NET" rel="category tag">.NET</a>, <a href="http://extensiblecad.com/words/category/cad/" title="View all posts in CAD" rel="category tag">CAD</a>, <a href="http://extensiblecad.com/words/category/com/" title="View all posts in COM" rel="category tag">COM</a>, <a href="http://extensiblecad.com/words/category/solidworks/" title="View all posts in SolidWorks" rel="category tag">SolidWorks</a>, <a href="http://extensiblecad.com/words/category/solidworks/solidworks-api/" title="View all posts in SolidWorks API" rel="category tag">SolidWorks API</a>, <a href="http://extensiblecad.com/words/category/xml/" title="View all posts in XML" rel="category tag">XML</a>.</small></p>
<p>Copyright 2007 <a href=http://extensiblecad.com/words>Extensible By Design.</a>  All rights reserved.</p>]]></content:encoded>
			<wfw:commentRss>http://extensiblecad.com/words/2008/02/23/free-solidworks-add-in-to-remind-you-to-eat-your-custom-properties/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Top Three Excuses For Not Switching To Visual Basic.NET (From Visual Basic 6.0 or VBA)</title>
		<link>http://extensiblecad.com/words/2007/11/25/top-three-excuses-for-not-switching-to-visual-basicnet-from-visual-basic-60-or-vba/</link>
		<comments>http://extensiblecad.com/words/2007/11/25/top-three-excuses-for-not-switching-to-visual-basicnet-from-visual-basic-60-or-vba/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 03:45:33 +0000</pubDate>
		<dc:creator>Jeff Cope</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[COM]]></category>

		<guid isPermaLink="false">http://extensiblecad.com/words/?p=51</guid>
		<description><![CDATA[Because so many SolidWorks API users appear to use either VBA or Visual Basic 6.0 as their primary development environment, I thought a post about upgrading to .NET might be in order.  There are endless possibilities for a topic even within that category but I feel that there are so many misconceptions about Visual Basic.NET [...]]]></description>
			<content:encoded><![CDATA[<p>Because so many SolidWorks API users appear to use either VBA or Visual Basic 6.0 as their primary development environment, I thought a post about upgrading to .NET might be in order.  There are endless possibilities for a topic even within that category but I feel that there are so many misconceptions about Visual Basic.NET amongst SolidWorks API users that it makes the most sense to use my little bit of time and real estate here to undo some of those misconceptions.  Those who do SolidWorks API development for their actual job should already know these but individuals who perform SolidWorks customization through the API as their &#8220;secondary job&#8221; or as a hobby might benefit from the post.</p>
<p> <span id="more-51"></span></p>
<p><strong>Excuse 1</strong> -Visual Basic.NET is expensive unlike VBA, which is free.</p>
<blockquote><p><strong>Truth </strong>- Visual Basic.NET is included in the free Visual Studio 2005 Express offering from Microsoft.  It is a scaled down version of the pay version but offers most of the capabilities in the pay version.  You will be able to do just about everything you need to do with the SolidWorks API except develop SolidWorks Add-ins.  For around $300 US, you can get a hold of Visual Studio 2005 Standard, which has all of the features of the Express version plus a few more, including the ability to create SolidWorks Add-ins.</p></blockquote>
<p><strong>Excuse 2</strong> &#8211; VBA is easier to use than Visual Basic.NET.</p>
<blockquote><p><strong>Truth</strong> &#8211; VBA has an advantage for very simple tasks but for more complex tasks, I think Visual Basic.NET has the advantage in the ease of use category.  Visual Basic.NET gives you access to the .NET Framework, a series of libraries that provide advanced capabilities for working with Windows, Windows applications, web applications and others.  The libraries that make up the .NET Framework are a significant improvement to the COM libraries that are available with VBA or Visual Basic 6.0.  Additionally, the development environment itself is improved over the VBA and Visual Basic 6.0 development environments.  Probably the biggest enhancement is the background compiliation error checking.  With this feature, Visual Basic.NET  alerts you to most errors as you type.  With the older VBA  environment, you found out about most compile errors only when you were brave enough to run the Macro.  With Visual Basic 6.0, you found out when you attempted to compile your application. </p></blockquote>
<p> <strong>Excuse 3</strong> &#8211; I will have to completely re-write all of my VBA Macros and Visual Basic 6.0 applications  in .NET if I want to use them with my .NET applications. </p>
<blockquote><p><strong>Truth</strong> &#8211; Visual Basic has a conversion wizard that will convert Visual Basic 6.0 and VBA code to Visual Basic.NET.   It is often a good idea to re-write your VBA and/or Visual Basic 6.0 stuff for .NET in order to take advantage of the full power of .NET but it is optional.  Re-writing for .NET will also help you to better understand the different way that things are done in .NET but again, this is optional.  Additionally, if you have ActiveX controls written in Visual Basic 6.0 (or any language that supports COM) then you can &#8220;plug in&#8221; those components to your .NET application. </p></blockquote>
	<p></p>
	<hr noshade style="margin:0;height:1px" />
	<small><p>&copy; Jeff Cope for <a href="http://extensiblecad.com/words">Extensible By Design</a>, 2007. |
	<a href="http://extensiblecad.com/words/2007/11/25/top-three-excuses-for-not-switching-to-visual-basicnet-from-visual-basic-60-or-vba/">Permalink</a> |
	<a href="http://extensiblecad.com/words/2007/11/25/top-three-excuses-for-not-switching-to-visual-basicnet-from-visual-basic-60-or-vba/#comments">6 comments</a> |
	Add to
	<a href="http://del.icio.us/post?url=http://extensiblecad.com/words/2007/11/25/top-three-excuses-for-not-switching-to-visual-basicnet-from-visual-basic-60-or-vba/&amp;title=Top Three Excuses For Not Switching To Visual Basic.NET (From Visual Basic 6.0 or VBA)"><img src="http://yoursite.com/images/icons/delicious.gif" border="0"> del.icio.us</a>
	<a href="http://www.digg.com/submit"><img src="http://yoursite.com/images/digg.gif" border="0"> digg</a><br/>
	Who's linking ?
	<a href="http://www.technorati.com/search/http://extensiblecad.com/words/2007/11/25/top-three-excuses-for-not-switching-to-visual-basicnet-from-visual-basic-60-or-vba/" title="Search on Technorati"><img src="http://yoursite.com/images/icons/technorati.gif" border="0">Technorati</a>
	<a href="http://www.blogpulse.com/search?query=http://extensiblecad.com/words/2007/11/25/top-three-excuses-for-not-switching-to-visual-basicnet-from-visual-basic-60-or-vba/" title="Search on Blogpulse"><img src="http://yoursite.com/images/icons/blogpulse.gif" border="0">BlogPulse</a>
	<a href="http://google.com/blogsearch?q=http://extensiblecad.com/words/2007/11/25/top-three-excuses-for-not-switching-to-visual-basicnet-from-visual-basic-60-or-vba/" title="Search on Google Blog Search"><img src="http://yoursite.com/images/icons/google.gif" border="0">Google</a><br/>
	Want more on these topics ? Browse the archive of posts filed under <a href="http://extensiblecad.com/words/category/net/" title="View all posts in .NET" rel="category tag">.NET</a>, <a href="http://extensiblecad.com/words/category/com/" title="View all posts in COM" rel="category tag">COM</a>.</small></p>
<p>Copyright 2007 <a href=http://extensiblecad.com/words>Extensible By Design.</a>  All rights reserved.</p>]]></content:encoded>
			<wfw:commentRss>http://extensiblecad.com/words/2007/11/25/top-three-excuses-for-not-switching-to-visual-basicnet-from-visual-basic-60-or-vba/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PDMWE API 201 &#8211; A Simple Addin To Pull Document Numbers On Demand</title>
		<link>http://extensiblecad.com/words/2007/11/20/pdmwe-api-201-a-simple-addin-to-pull-document-numbers-on-demand/</link>
		<comments>http://extensiblecad.com/words/2007/11/20/pdmwe-api-201-a-simple-addin-to-pull-document-numbers-on-demand/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 06:46:39 +0000</pubDate>
		<dc:creator>Jeff Cope</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[PDMWE]]></category>
		<category><![CDATA[PDMWE API]]></category>
		<category><![CDATA[PDMWorks Enterprise]]></category>

		<guid isPermaLink="false">http://extensiblecad.com/words/?p=37</guid>
		<description><![CDATA[What Does This Addin Do?  This Addin &#8220;listens&#8221; for Command Button events to be &#8220;fired&#8221; from data cards in PDMWorks Enterprise.  This could be File Cards (i.e. for existing files or folders) or Input Cards (i.e. for new files or folders).  If the command string of the Command Button matches our criteria, then the Addin will [...]]]></description>
			<content:encoded><![CDATA[<p><strong>What Does This Addin Do?</strong></p>
<p> This Addin &#8220;listens&#8221; for Command Button events to be &#8220;fired&#8221; from data cards in PDMWorks Enterprise.  This could be File Cards (i.e. for existing files or folders) or Input Cards (i.e. for new files or folders).  If the command string of the Command Button matches our criteria, then the Addin will pull the next Serial Number from a Serial Number sequence in the vault.  The best thing about the Addin is that the Serial Number sequence name is specified as part of the command string.  This means that the Addin can be configured very easily by a non-programmer to run on any number of different Serial Number sequences.  In other words, our Addin is Extensible (sorry, I couldn&#8217;t resist). </p>
<p> <strong>Why Do I Need A Custom PDMWorks Enterprise Addin For Handling Document Numbers When PDMWorks Enterprise Already Has &#8220;Serial Numbers&#8221; Functionality That Handles This?</strong></p>
<p> PDMWorks Enterprise is a great tool and the Serial Numbers functionality is very useful.  However, as implemented in PDMWorks Enterprise, the Serial Numbers are kind of wired directly in to the system and don&#8217;t allow much flexibility in terms of when and how they are used.  You either set your part number to be populated from the Serial Number sequence or you don&#8217;t.  There is no &#8220;let&#8217;s do it this way for this case and another way for this other case.&#8221;  By writing a very simple Addin, <span id="more-37"></span>we can set up our data cards to pull Serial Numbers when the user pushes a button of our choosing.  In other words, with a small amount of work, we allow the user to choose when to use a given number sequence.  I am tempted to say something here like &#8220;&#8230;and choice is good&#8230;&#8221; but I realize that not everyone will agree on that.  So I have decided to leave the freewill debates up to philosophers and priests while I tackle the PDMWorks Enterprise API.</p>
<p><strong><em>I Don’t Want To Learn Anything, Can I Just Have The Finished Addin?</em></strong></p>
<p>Yes.  <a href="http://www.extensiblecad.com/downloads/NumberGenerator_Binary.zip">You may download the compiled Addin from here. </a>  However, you will still need to see the section below on deploying the Addin. </p>
<p><em>Disclaimer:  No warranty is either expressed or implied for this Addin and the Addin is not in any way supported.  By downloading the Addin, you assume all responsibility for the Addin.</em><strong>How Hard Is This To Do?</strong></p>
<p>Writing a PDMWorks Enterprise Addin is surprisingly easy although deploying them correctly can sometimes be a challenge.  This article does assume though that you understand the basics of  creating Addins with Visual Basic.NET.  If you haven&#8217;t yet mastered the basics of creating Addins with VB.NET then you can brush up with the fairly decent tutorial that is included in the PDMWorks Enterprise API guide.  <img border="1" vspace="5" align="textTop" width="90" src="http://extensiblecad.com/words/wp-content/uploads/2007/11/api-help-file.PNG" hspace="5" height="18" style="width: 90px; height: 18px" /></p>
<p><img vspace="20" align="baseline" width="800" src="http://extensiblecad.com/words/wp-content/uploads/2007/11/api-help-create-addin.PNG" hspace="20" height="555" style="width: 800px; height: 555px" /></p>
<p><strong>What Version of PDMWorks Enterprise Was This Addin Written For?</strong>This Addin was written for and compiled against PDMWorks Enterprise 2007.  However, you should be able to recompile it against PDMWorks Enterprise 2008 without much trouble.</p>
<p> <strong>What Development Tools Do I Need To Write Such An Addin?</strong></p>
<p>Visual Studio 2005 Standard is definitely sufficient for creating COM addins and you can usually pick it up in the US for $300.  Currently, that would be like 5 Euros for you guys across the ocean.    I haven&#8217;t tried it, but it may be possible to use the Visual Basic 2005 Express (aka &#8220;the free version&#8221;) to write this by manually adding the COMVisible&lt;&#8230;&gt; tags where appropriate in the Addin.  Although I am too lazy to install VB 2005 Express to test this out, I did go ahead an put the COMVisible&lt;&#8230;&gt; tags in their appropriate (at least by my reckoning) places.  If anyone tries this, I would be thankful if you could post your results for posterity.</p>
<p><strong>Where Can I Find The Source Code For This Addin?</strong></p>
<p>You can find the Project for this Addin, with all source code, in a zip file <a href="http://www.extensiblecad.com/downloads/NumberGenerator_Source.zip">here.</a></p>
<p> <strong>How Do You Do It (High-Level)?</strong></p>
<ol>
<li> Follow the steps in the PDMWorks Enterprise API Guide to create a generic PDMWE Addin.  Note:  Yes I know this is cheating but it is getting late and I am starting to get pretty sleepy so I hope you will forgive the shortcut.  </li>
<li>Add a Serial Number sequence to your PDMWorks Enterprise vault.</li>
<li>Create a Windows Form in your application that will be used to provide the generated number back to the user.</li>
<li>Create or edit a datacard such that it has a Command Button to call the Addin.</li>
<li>Replace the generic OnCmd method in the generic Addin created at step 1 with an OnCmd method that accesses the next number in Serial Number sequence that is specified by the Command Button.</li>
<li>Debug endlessly until it “works” (on your machine)</li>
<li>Enlist a co-worker to test the Addin for you on their machine.  Note:  You can blame them later for inadequate testing coverage if the Addin doesn&#8217;t work properly : )</li>
</ol>
<p><strong>How Do You Do It (Detailed)?</strong></p>
<ol>
<li>Follow steps in API guide for creating a generic Addin.  (Sorry, you are on your own for this step) </li>
<li>Add a Serial Number sequence (or two or three or four &#8230;) to your vault.  You will need to login as an administrator to do that. <img vspace="20" align="textTop" width="431" src="http://extensiblecad.com/words/wp-content/uploads/2007/11/pdmwe-admin.PNG" hspace="20" height="497" style="width: 431px; height: 497px" />
<ul>
<li>Note:  Just expand your PDMWorks Enterprise Vault node in the PDMWorks Enterprise Administration tool and then right-click on the &#8220;Serial Numbers&#8221; item in the tree.  You can then add as many serial numbers as you need.  I decided to create four in my example to handle the case where different departments number their documents differently.<img vspace="20" align="bottom" width="596" src="http://extensiblecad.com/words/wp-content/uploads/2007/11/serialnumbers.PNG" hspace="20" height="341" style="width: 596px; height: 341px" /></li>
</ul>
</li>
<li>Create a Windows Form in your application that will be used to provide the generated number back to the user.  In this example, the form is already created for you. </li>
<li>Create or edit a datacard such that it has a Command Button to call the Addin.  You will need to set the Command type for the button equal to &#8220;Run Add-in.&#8221;  Also, notice the string in the &#8220;Name of add-in:&#8221; text box.  The string has the format of &#8220;Autonumber:&lt;Serial Number sequence name&gt;.  &#8220;Autonumber&#8221; is used to tell our Add-in which command buttons &#8220;belong&#8221; to it and the Serial Number sequence name tells our Add-in which Serial Number to pull the number from.  Make sure you save your changes.<img vspace="20" align="textTop" width="633" src="http://extensiblecad.com/words/wp-content/uploads/2007/11/txt-card-eng-nr.PNG" hspace="20" height="499" style="width: 633px; height: 499px" /></li>
<li>Replace the generic OnCmd method in the generic Addin created at step 1 with an OnCmd method that accesses the next number in Serial Number sequence that is specified by the Command Button.  You will want to modify your error messages to be more user-friendly than mine before deploying your version of the Add-in.  In the interests of time, I opted to simply write out the exceptions to strings and return those, in their entirety, in messageboxes to the user.  This is okay for a blog article but probably not okay for production.</li>
<li>Debug endlessly until it “works” (on your machine)
<ul>
<li>There are detailed instructions in the PDMWE API Guide on how to debug an Add-in.  Oversimplifying, you just right-click the &#8220;Add-ins&#8221; item and then select &#8220;Debug Add-ins.&#8221;  You will then browse to your top-level assembly (.dll file).  When debugging, you do not need to specify the files referenced by your assembly (.dll file).  <img vspace="20" align="textTop" width="298" src="http://extensiblecad.com/words/wp-content/uploads/2007/11/add-addin1.PNG" hspace="20" height="323" style="width: 298px; height: 323px" /></li>
</ul>
</li>
<li>Deploy the Addin
<ul>
<li>Right-click the &#8220;Add-ins&#8221; item and then select &#8220;Open.&#8221;  You will then browse to your top-level assembly (.dll file) AND its dependencies.  When running in Open mode, you DO NEED to specify the files referenced by your assembly (.dll file).  In this case, your top-level assembly (NumberGenerator.dll) references only Interop.EdmLib.dll.  This is the .NET wrapper for the PDMWorks Enterprise COM Library.<img vspace="20" align="textTop" width="428" src="http://extensiblecad.com/words/wp-content/uploads/2007/11/add-addin2.PNG" hspace="20" height="273" style="width: 428px; height: 273px" /></li>
<li>You will see a message telling you that you will have to Restart your machine any time you add a new version of your Add-in to the vault.  Note:  This is a real requirement and can cause much grief when you start developing applications that utilize numerous assemblies.<img vspace="20" width="554" src="http://extensiblecad.com/words/wp-content/uploads/2007/11/add-addin3.PNG" hspace="20" height="133" style="width: 554px; height: 133px" /></li>
</ul>
</li>
<li>Test it &#8220;one more time&#8221; just to be sure.  By pressing the &#8220;Engineering Doc#&#8221; button on the File Card in the example below, I am able to receive a message from the Add-in telling me that a new number has been generated and that I can copy the number to the clipboard by selecting the &#8220;Copy&#8221; button on the form.  Note:  You could write to the file variable instead of the copy/paste method but it would not work for Input Cards as there is not yet a file on which to access variables.</li>
<li><img vspace="20" width="641" src="http://extensiblecad.com/words/wp-content/uploads/2007/11/pastednumber.PNG" hspace="20" height="579" style="width: 641px; height: 579px" /><img vspace="20" align="textTop" width="524" src="http://extensiblecad.com/words/wp-content/uploads/2007/11/pdmwe-number-generator-dialog.PNG" hspace="20" height="160" style="width: 524px; height: 160px" /></li>
</ol>
<p>Good luck.  Let me know if this article was helpful.</p>
	<p></p>
	<hr noshade style="margin:0;height:1px" />
	<small><p>&copy; Jeff Cope for <a href="http://extensiblecad.com/words">Extensible By Design</a>, 2007. |
	<a href="http://extensiblecad.com/words/2007/11/20/pdmwe-api-201-a-simple-addin-to-pull-document-numbers-on-demand/">Permalink</a> |
	<a href="http://extensiblecad.com/words/2007/11/20/pdmwe-api-201-a-simple-addin-to-pull-document-numbers-on-demand/#comments">6 comments</a> |
	Add to
	<a href="http://del.icio.us/post?url=http://extensiblecad.com/words/2007/11/20/pdmwe-api-201-a-simple-addin-to-pull-document-numbers-on-demand/&amp;title=PDMWE API 201 &#8211; A Simple Addin To Pull Document Numbers On Demand"><img src="http://yoursite.com/images/icons/delicious.gif" border="0"> del.icio.us</a>
	<a href="http://www.digg.com/submit"><img src="http://yoursite.com/images/digg.gif" border="0"> digg</a><br/>
	Who's linking ?
	<a href="http://www.technorati.com/search/http://extensiblecad.com/words/2007/11/20/pdmwe-api-201-a-simple-addin-to-pull-document-numbers-on-demand/" title="Search on Technorati"><img src="http://yoursite.com/images/icons/technorati.gif" border="0">Technorati</a>
	<a href="http://www.blogpulse.com/search?query=http://extensiblecad.com/words/2007/11/20/pdmwe-api-201-a-simple-addin-to-pull-document-numbers-on-demand/" title="Search on Blogpulse"><img src="http://yoursite.com/images/icons/blogpulse.gif" border="0">BlogPulse</a>
	<a href="http://google.com/blogsearch?q=http://extensiblecad.com/words/2007/11/20/pdmwe-api-201-a-simple-addin-to-pull-document-numbers-on-demand/" title="Search on Google Blog Search"><img src="http://yoursite.com/images/icons/google.gif" border="0">Google</a><br/>
	Want more on these topics ? Browse the archive of posts filed under <a href="http://extensiblecad.com/words/category/net/" title="View all posts in .NET" rel="category tag">.NET</a>, <a href="http://extensiblecad.com/words/category/com/" title="View all posts in COM" rel="category tag">COM</a>, <a href="http://extensiblecad.com/words/category/pdmplm/pdmwe/" title="View all posts in PDMWE" rel="category tag">PDMWE</a>, <a href="http://extensiblecad.com/words/category/pdmplm/pdmwe/pdmwe-api/" title="View all posts in PDMWE API" rel="category tag">PDMWE API</a>, <a href="http://extensiblecad.com/words/category/pdmworks-enterprise/" title="View all posts in PDMWorks Enterprise" rel="category tag">PDMWorks Enterprise</a>.</small></p>
<p>Copyright 2007 <a href=http://extensiblecad.com/words>Extensible By Design.</a>  All rights reserved.</p>]]></content:encoded>
			<wfw:commentRss>http://extensiblecad.com/words/2007/11/20/pdmwe-api-201-a-simple-addin-to-pull-document-numbers-on-demand/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
