<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
    <title>Mod the Machine</title>
    
    <link rel="hub" href="http://hubbub.api.typepad.com/" />
    <link rel="alternate" type="text/html" href="http://modthemachine.typepad.com/my_weblog/" />
    <id>tag:typepad.com,2003:weblog-1713640</id>
    <updated>2009-10-14T16:18:15-07:00</updated>
    <subtitle>Discussing Autodesk Inventor's Application Programming Interface (API)</subtitle>
    <generator uri="http://www.typepad.com/">TypePad</generator>
    <link rel="self" href="http://feeds.feedburner.com/modthemachine" type="application/atom+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry>
        <title>Drawing Automation</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/modthemachine/~3/MoionzJqdN4/drawing-automation.html" />
        <link rel="replies" type="text/html" href="http://modthemachine.typepad.com/my_weblog/2009/10/drawing-automation.html" thr:count="2" thr:updated="2009-10-23T11:59:16-07:00" />
        <id>tag:typepad.com,2003:post-6a00e553fcbfc688340120a63d25a8970c</id>
        <published>2009-10-14T16:18:15-07:00</published>
        <updated>2009-10-14T16:18:15-07:00</updated>
        <summary>I gave a high-level presentation about automating drawings in Inventor at AU 2007. The most useful information from that presentation is the sample programs, but apparently they aren’t available from the AU website since I’ve had a couple of requests...</summary>
        <author>
            <name>Brian Ekins</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://modthemachine.typepad.com/my_weblog/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>I gave a high-level presentation about automating drawings in Inventor at AU 2007.  The most useful information from that presentation is the sample programs, but apparently they aren’t available from the AU website since I’ve had a couple of requests for them recently.  Remember this is from a couple of years ago and Inventor now supports some things that it didn’t then.  Here’s a <a href="http://modthemachine.typepad.com/files/Drawing%20Automation.zip">download</a> that contains the original class handout plus all of the sample programs.</p></div>
</content>


    <feedburner:origLink>http://modthemachine.typepad.com/my_weblog/2009/10/drawing-automation.html</feedburner:origLink></entry>
    <entry>
        <title>Update to Visual Basic 6 Add-Ins and 64-Bit Windows</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/modthemachine/~3/TPJZkJF9Kf0/update-to-visual-basic-6-add-ins-and-64-bit-windows.html" />
        <link rel="replies" type="text/html" href="http://modthemachine.typepad.com/my_weblog/2009/10/update-to-visual-basic-6-add-ins-and-64-bit-windows.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00e553fcbfc688340120a63d0fc5970c</id>
        <published>2009-10-14T15:42:04-07:00</published>
        <updated>2009-10-14T15:42:04-07:00</updated>
        <summary>I recently made a post discussing the issues around Add-Ins written using Visual Basic 6 and 64-bit Windows. I made the mistake of not testing it completely before making that post. Everything in the original posting is correct but it’s...</summary>
        <author>
            <name>Brian Ekins</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://modthemachine.typepad.com/my_weblog/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>I recently made a post discussing the issues around Add-Ins written using Visual Basic 6 and 64-bit Windows.  I made the mistake of not testing it completely before making that post.  Everything in the original posting is correct but it’s incomplete because I hadn’t thought through the registration process.  I’ve update the <a href="http://modthemachine.typepad.com/my_weblog/2009/10/visual-basic-6-add-ins-and-64-bit.html">original post</a> to add more information to cover registering your Add-In on the 64-bit machine.</p></div>
</content>


    <feedburner:origLink>http://modthemachine.typepad.com/my_weblog/2009/10/update-to-visual-basic-6-add-ins-and-64-bit-windows.html</feedburner:origLink></entry>
    <entry>
        <title>Visual Basic 6 Add-Ins and 64-Bit</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/modthemachine/~3/w-my1Y4hCxk/visual-basic-6-add-ins-and-64-bit.html" />
        <link rel="replies" type="text/html" href="http://modthemachine.typepad.com/my_weblog/2009/10/visual-basic-6-add-ins-and-64-bit.html" thr:count="1" thr:updated="2009-10-08T06:39:47-07:00" />
        <id>tag:typepad.com,2003:post-6a00e553fcbfc688340120a5b1f762970b</id>
        <published>2009-10-01T11:39:05-07:00</published>
        <updated>2009-10-14T15:38:15-07:00</updated>
        <summary>I saw a question in the customization newsgroup where someone has an Add-In written using Visual Basic 6 and wants to use that add-in with the 64-bit version of Inventor. In doing this there are some issues to be aware...</summary>
        <author>
            <name>Brian Ekins</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://modthemachine.typepad.com/my_weblog/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>I saw a question in the customization newsgroup where someone has an Add-In written using Visual Basic 6 and wants to use that add-in with the 64-bit version of Inventor.  In doing this there are some issues to be aware of:</p>  <ul>   <li>64-bit Windows can run both 32-bit and 64-bit applications (exe’s and dll’s). </li>    <li>Visual Basic 6 can only create 32-bit applications (exe’s and dll’s). </li>    <li>A 64-bit exe can only load 64-bit dll’s.  It cannot use 32-bit dll’s. </li> </ul>  <p>In this case, Inventor is a 64-bit exe and the Add-In is a dll.  A VB 6 Add-In will be a 32-bit dll.  Based on the statements above, this means that it can’t be used by 64-bit Inventor since that results in a 64-bit exe trying to load a 32-bit dll.  There are two possible solutions; change the add-in to be an exe instead of a dll or convert the add-in to .Net where you have the ability to create a 64-bit dll.</p>  <p> </p>  <p><strong>Changing a VB 6 Add-In from a DLL to an EXE</strong>     <br />Changing an existing VB 6 Add-In from a dll to an exe is very easy.  Open the project and use the <strong>Properties</strong> command in the <strong>Project</strong> menu to display the dialog shown below.  Change the project type from “AcitveX DLL” to “ActiveX EXE”.  Recompile and now you have an exe Add-in.  However, continue reading…</p>  <p><a href="http://modthemachine.typepad.com/.a/6a00e553fcbfc688340120a63d0d93970c-pi"><img title="VB6_DLLtoEXE" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="321" alt="VB6_DLLtoEXE" src="http://modthemachine.typepad.com/.a/6a00e553fcbfc688340120a63d0d96970c-pi" width="354" border="0" /></a> </p>  <p>There are two things to be aware of when converting a dll Add-In to an exe Add-In.  The first is that the performance of the exe Add-In won’t be as good as the dll Add-In.  A dll Add-In is loaded into Inventor’s process space and API calls are made directly.  An exe Add-In runs in its own process space and is separate from Inventor.  This requires API calls to be <em>marshaled</em> between the two processes which is not as efficient.  How much slower it is will differ from Add-In to Add-In because it depends on what kind of API calls you’re making.</p>  <p>The second issue is more of a problem and is a side-effect of the fact that data has to be marshaled between the two processes.  Inventor’s API relies on Microsoft technology to do the marshaling between the two processes.  Unfortunately, this technology doesn’t support the marshaling of bitmap data.  This means that any Inventor API calls you make where an IPictureDisp object is passed as an argument won’t work with an exe Add-In.  </p>  <p>Their are only a few calls in Inventor’s API that work with bitmaps but one of these is a function that most Add-Ins use.  That’s the AddButtonDefinition method that’s used to create a button for the user-interface.  An exe Add-In won’t be able to have icons on its buttons because of this limitation.  Icons are optional so you can remove those arguments from the AddButtonDefinition call and then the Add-In should function correctly but you’ll only have text on the button instead of an icon.</p>  <p>Another area of the API where a bitmap is used is when getting or setting the thumbnail image for a document.  This will fail for an exe Add-In.</p>  <p>Using the VB6 version of the SimpleAddIn sample that’s delivered as part of Inventor’s SDK, here are the changes that are required to make it work on 64-bit Windows.</p>  <ol>   <li>Change the project type to ActiveX EXE, as explained above.      <br /></li>    <li>Comment out the lines that load the bitmaps for the icons.      <div style="font-size: 8pt; background: #eeeeee; color: black; line-height: 140%; font-family: courier new">       <p>Dim oIcon1 As IPictureDisp          <br /><font color="#0000ff"><strong>'    Dim oIcon2 As IPictureDisp              <br />'    Dim oIcon3 As IPictureDisp               <br />'    Set oIcon1 = LoadPicture(App.Path &amp; "\AddSlotOption.ico")               <br />'    Set oIcon2 = LoadPicture(App.Path &amp; "\Slot.ico")               <br />'    Set oIcon3 = LoadPicture(App.Path &amp; "\Toggle.ico")               <br /></strong></font></p>     </div>      <p><font color="#0000ff"><strong /></font></p>   </li>    <li>Edit the lines where the buttons are created to remove the icons.  The following three lines (please pay attention to the line wrapping) are changed from this:      <p />      <div style="font-size: 8pt; background: #eeeeee; color: black; line-height: 140%; font-family: courier new">Set oButtonDefAddOption = ..., "Add slot option", oIcon1, oIcon1)        <br />Set oButtonDefDrawSlot = ... , "Draw Slot", oIcon2, oIcon2)         <br />Set oButtonDefToggleSlotState = ..., "Toggle Slot State", oIcon3, oIcon3) </div>      <p />      <p>to this:</p>      <p />      <div style="font-size: 8pt; background: #eeeeee; color: black; line-height: 140%; font-family: courier new">Set oButtonDefAddOption = ..., "Add slot option")   <br />Set oButtonDefDrawSlot = ... , "Draw Slot")  <br />Set oButtonDefToggleSlotState = ..., "Toggle Slot State")</div>      <p />      <p>This is possible because the icon arguments are optional.</p>   </li>    <li>Compile the Add-In to create the EXE version of it and run the the registration file to register it, (AddInSample.reg in the case of the example Add-In).      <br /></li>    <li>Run Inventor to make sure the Add-In is loading and working correctly on a 32-bit system.      <br />      <br />The tricky part now is getting this Add-In to register correctly on a 64-bit system.  Since it’s a 32-bit application, by default it will register itself in the 32-bit section of the registry on a 64-bit system, but Inventor will only look for Add-Ins in the main section of the registry, which is the 64-bit section in this case.  The following steps illustrate one way to get the registration in the correct area on the 64-bit system.       <br /></li>    <li>Find out the CLSID for your Add-In.  There are two ways to find this out.  If you’re already using a .reg file to register your Add-In, it will be in that.  Here’s the second line from the AddInSample.reg file that’s part of the sample.      <p><font face="Arial Narrow">[HKEY_CLASSES_ROOT\CLSID\{DB59D9A7-EE4C-434A-BB5A-F93E8866E872}]</font></p>      <p>The “{DB59D9A7-EE4C-434A-BB5A-F93E8866E872}” portion of the line is the CLSID of the Add-In.  Just remembering the first 3 or 4 characters is enough for what you need to do in the subsequent steps.</p>      <p>The other way to find out the CLSID is to look it up in the registry.  First, you need to know what to look up.  You can use the ProgID of your Add-In.  This is determined by the name of your project and the name of the class that supports the Add-In interface.  You can see these in the Properties window inside Visual Basic.  In this case the ProgID of the Add-In will be “AddInSample.clsSampleAddIn”.</p>      <p><a href="http://modthemachine.typepad.com/.a/6a00e553fcbfc688340120a5e697fb970b-pi"><img title="AddInName" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="137" alt="AddInName" src="http://modthemachine.typepad.com/.a/6a00e553fcbfc688340120a5e697fe970b-pi" width="290" border="0" /></a> </p>      <p>Run RegEdit and look in the HKEY_CLASSES_ROOT section for the ProgID of your Add-In.  This is shown below for the sample Add-In.</p>      <p><a href="http://modthemachine.typepad.com/.a/6a00e553fcbfc688340120a63d0d9a970c-pi"><img title="CLSID_Lookup" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="173" alt="CLSID_Lookup" src="http://modthemachine.typepad.com/.a/6a00e553fcbfc688340120a63d0d9e970c-pi" width="404" border="0" /></a></p>      <p>Once you’ve found the ProgID for the Add-In, expand the key in the registry and then expand the Clsid key and select “Clsid”.  In the right-hand portion of the Registry Editor you’ll see the CLSID of your Add-in.</p>   </li>    <li>Now using the Registry Editor, find the HKEY_CLASSES_ROOT\CLSID section of the registry.  Within this key, find the CLSID for your Add-In.  The picture below shows this key selected in the browser and expanded so you can see its subkeys.  You can verify that you have the correct registry key by checking on the right-hand side of the Registry Editor to see if the ProgID matches the one for your Add-In.<a href="http://modthemachine.typepad.com/.a/6a00e553fcbfc688340120a5e69807970b-pi">        <br />        <br /><img title="Add-InRegKey" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="187" alt="Add-InRegKey" src="http://modthemachine.typepad.com/.a/6a00e553fcbfc688340120a5e6980a970b-pi" width="404" border="0" /></a>       <br /></li>    <li>Right-click on the CLSID key of your Add-In and choose Export, as shown below.  Specify a name and save the .reg file.      <br /><a href="http://modthemachine.typepad.com/.a/6a00e553fcbfc688340120a5e69811970b-pi"><img title="RegistryExport" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="315" alt="RegistryExport" src="http://modthemachine.typepad.com/.a/6a00e553fcbfc688340120a5e69816970b-pi" width="346" border="0" /></a>       <br /></li>    <li>Copy the Add-In to the 64-bit system by copying the EXE, the reg file you just created in the previous step, and any other files your Add-in might require.  The SimpleAddIn sample doesn’t need anything except these two files but your Add-In may need some other files.      <br /></li>    <li>Edit the .reg file so that it contains the correct path for your Add-In as it exists on the 64-bit system.  You’ll need to edit one line in the .reg file to correct the path.  The edited portion is highlighted below.  Notice how the backslashes of the actual path are replaced with double back slashes.      <p><font face="Arial Narrow">[HKEY_CLASSES_ROOT\CLSID\{DB59D9A7-…-F93E8866E872}\LocalServer32]          <br />@="<font color="#0000ff"><strong>C:\\Users\\ekins\\Documents</strong></font>\\AddInSample.exe"</font></p>   </li>    <li>Run the .reg file to register your Add-In.  When you run Inventor, your Add-In should be running and work.  If it isn’t working, check the Add-In Manager to see if your Add-In is in the list.  If it is in the list but isn’t listed as being loaded, then the Add-In is likely failing in the Activate method.  Make sure you removed the icons as instructed above and double-check that you’re not trying to access something that’s not available on the 64-bit machine.      <br />      <br />If your Add-In doesn’t show up at all in the Add-In Manager then go through the directions above and double-check that you didn’t leave out anything.  For your Add-In to not show up at all indicates that it’s not being registered correctly.</li> </ol>  <p><strong>Converting a Visual Basic 6 Add-In to 64-Bit      <br /></strong>Visual Basic 6 is only capable of creating 32-bit applications.  To convert an existing project to a 64-bit application will require porting the application to VB.Net, which does support the creation of a 64-bit application.  VB.Net has a VB 6 conversion tool but I would suggest that you NOT use it.  Instead, I would use the Add-In Wizard that’s delivered as part of Inventor’s SDK to create a new Add-In and copy the code manually from VB 6 into the VB.Net project.  There are too many differences between VB 6 and VB.Net and my experience is that cleaning up the resulting code from the conversion is harder than copying over smaller portions of code at a time an manually converting it.</p>  <p>You’ll also need to recreate your dialogs.  The dialogs are much more powerful in VB.Net so this lets you take advantage of those new features.  The basics of converting your code is covered in this post: <a href="http://modthemachine.typepad.com/my_weblog/2008/10/converting-vba-auto-macros-to-an-add-in.html">Converting VBA Auto Macros to an Add-In</a>.</p></div>
</content>


    <feedburner:origLink>http://modthemachine.typepad.com/my_weblog/2009/10/visual-basic-6-add-ins-and-64-bit.html</feedburner:origLink></entry>
    <entry>
        <title>Attribute Utility</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/modthemachine/~3/RBna4Tb3NLY/attribute-utility.html" />
        <link rel="replies" type="text/html" href="http://modthemachine.typepad.com/my_weblog/2009/09/attribute-utility.html" thr:count="1" thr:updated="2009-11-03T08:43:58-08:00" />
        <id>tag:typepad.com,2003:post-6a00e553fcbfc688340120a5e995b7970c</id>
        <published>2009-09-23T13:56:40-07:00</published>
        <updated>2009-09-23T13:56:40-07:00</updated>
        <summary>Working with attributes can sometimes be a bit frustrating because the only access you have to attributes is through the API. You can’t quickly create, edit, or view an attribute without writing a program to do it. Because of this...</summary>
        <author>
            <name>Brian Ekins</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://modthemachine.typepad.com/my_weblog/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Working with attributes can sometimes be a bit frustrating because the only access you have to attributes is through the API.  You can’t quickly create, edit, or view an attribute without writing a program to do it.  Because of this I became a bit frustrated when working on my first program that made extensive use of attributes.  For the program to function correctly the attributes it was using all had to be correct and it was difficult to debug problems to determine if the problem was my program or the attributes it was trying to access.</p>  <p>For my own sanity I wrote a little utility that would let me view all of the attributes in a document.  That helped a lot but I never felt it was finished because it only allowed me to view existing attributes and I still couldn’t easily create or edit an existing attribute without writing code.  As part of the series of blog posts I’ve I’m writing about <a href="http://modthemachine.typepad.com/my_weblog/2009/07/introduction-to-attributes.html">attributes</a>, I’ve completely re-written the utility so that it provides full creation, edit, and viewing of attributes.  This new version of the utility is an add-in.  To use it just <a href="http://modthemachine.typepad.com/files/AttributeHelperSetup.zip">download</a> and install the add-in and look at the readme that’s installed for instructions on how to use it.  When installing you have the option of also installing the source code, if you’re interested in the internals of how it works.  It was written using the Visual Basic language in Visual Studio 2008.</p>  <p>Let me know if you have suggestions or find any problems.</p></div>
</content>


    <feedburner:origLink>http://modthemachine.typepad.com/my_weblog/2009/09/attribute-utility.html</feedburner:origLink></entry>
    <entry>
        <title>Inventor API Wishlist Survey Reminder</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/modthemachine/~3/_3L6Nf8MCo0/inventor-api-wishlist-survey-reminder.html" />
        <link rel="replies" type="text/html" href="http://modthemachine.typepad.com/my_weblog/2009/07/inventor-api-wishlist-survey-reminder.html" thr:count="1" thr:updated="2009-09-03T12:07:06-07:00" />
        <id>tag:typepad.com,2003:post-6a00e553fcbfc6883401157241bcc8970b</id>
        <published>2009-07-28T10:43:21-07:00</published>
        <updated>2009-07-28T10:43:21-07:00</updated>
        <summary>Just a gentle reminder that time is running out to participate in this years Inventor API Wishlist Survey. The deadline is July 31, 2009. Here’s a link to the survey: Autodesk® Inventor®. Thanks to those of you that have already...</summary>
        <author>
            <name>Brian Ekins</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://modthemachine.typepad.com/my_weblog/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Just a gentle reminder that time is running out to participate in this years Inventor API Wishlist Survey.  <strong>The deadline is July 31, 2009.</strong>  Here’s a link to the survey: <a href="http://www.zoomerang.com/Survey/?p=WEB229EPCV8VA2">Autodesk® Inventor®</a>.</p>  <p>Thanks to those of you that have already taken the time to fill out the survey.  We’re slightly ahead of the response we had for last years survey.  This survey is very important to the Inventor engineering team in deciding what will go into the upcoming releases.</p>  <p>Here’s the wishlist that was generated from the survey in 2008.</p>  <ol>   <li>Use Inventor’s functionality through in-process component</li>    <li>VBA Record and Playback</li>    <li>Create Solids and Surfaces by defining geometry and B-Rep</li>    <li>Ability to control Inventor’s progress bar</li>    <li>Support for modeling in sheet metal flat pattern</li>    <li>Full support for assembly feature creation</li>    <li>Creation of all sheet metal features</li>    <li>Creation of other drawing view types</li>    <li>Hole notes, thread notes, and punch notes</li>    <li>Full support for centerlines and center marks</li>    <li>Ability to participate in Inventor’s error reporting mechanism</li>    <li>Creation of ordinate and baseline dimension sets</li>    <li>Support for inspection dimensions</li> </ol>  <p>Here’s what we did based on this feedback.  The bold items were completed and work was done on the italicized items.</p>  <ol>   <li><em>Use Inventor’s functionality through in-process component</em></li>    <li>VBA Record and Playback</li>    <li><em>Create Solids and Surfaces by defining geometry and B-Rep</em></li>    <li><strong>Ability to control Inventor’s progress bar</strong></li>    <li><strong>Support for modeling in sheet metal flat pattern</strong></li>    <li><strong>Full support for assembly feature creation</strong></li>    <li><em>Creation of all sheet metal features</em></li>    <li><em>Creation of other drawing view types</em></li>    <li><strong>Hole notes, thread notes, and punch notes</strong></li>    <li><strong>Full support for centerlines and center marks</strong></li>    <li><strong>Ability to participate in Inventor’s error reporting mechanism</strong></li>    <li><strong>Creation of ordinate and baseline dimension sets</strong></li>    <li><strong>Support for inspection dimensions</strong></li> </ol>  <p>You can see that we do respond to these lists and need your input to help guide the API in the direction that is most useful to you.  Thank you for your help.</p></div>
</content>


    <feedburner:origLink>http://modthemachine.typepad.com/my_weblog/2009/07/inventor-api-wishlist-survey-reminder.html</feedburner:origLink></entry>
    <entry>
        <title>Have you Written any Cool Add-Ins?</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/modthemachine/~3/WLd9g-qS4A4/have-you-written-any-cool-add-ins.html" />
        <link rel="replies" type="text/html" href="http://modthemachine.typepad.com/my_weblog/2009/07/have-you-written-any-cool-add-ins.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00e553fcbfc688340115713b6592970c</id>
        <published>2009-07-24T10:13:51-07:00</published>
        <updated>2009-07-24T10:13:51-07:00</updated>
        <summary>The Autodesk Developer Network (ADN) group here at Autodesk has just announced a new program to promote the writing and sharing of small utilities to enhance the various Autodesk products. Kean Walmsley, who is the manager of the group that...</summary>
        <author>
            <name>Brian Ekins</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://modthemachine.typepad.com/my_weblog/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>The Autodesk Developer Network (ADN) group here at Autodesk has just announced a new program to promote the writing and sharing of small utilities to enhance the various Autodesk products.  Kean Walmsley, who is the manager of the group that supports ADN, describes it in his latest <a href="http://through-the-interface.typepad.com/through_the_interface/2009/07/coming-soon-to-autodesk-labs-plugin-of-the-month.html">blog posting</a>.  Go check it out and start thinking of what you might be able to do.  Even if you don’t feel like your programming skills are up to the challenge you could still submit ideas for useful utilities.  The <a href="http://discussion.autodesk.com/forums/forum.jspa?forumID=120 ">Inventor customization newsgroup</a> will be a good place to do that.</p></div>
</content>


    <feedburner:origLink>http://modthemachine.typepad.com/my_weblog/2009/07/have-you-written-any-cool-add-ins.html</feedburner:origLink></entry>
    <entry>
        <title>Inventor API Wishlist Survey</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/modthemachine/~3/M_2Fm-c7W-E/inventor-api-wishlist-survey.html" />
        <link rel="replies" type="text/html" href="http://modthemachine.typepad.com/my_weblog/2009/07/inventor-api-wishlist-survey.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00e553fcbfc68834011571279e57970c</id>
        <published>2009-07-20T10:48:28-07:00</published>
        <updated>2009-07-20T10:48:28-07:00</updated>
        <summary>This years API survey is now available. Autodesk® Inventor® API Survey Please do take the time to fill out the survey and give us your input. We rely heavily on the information obtained through this survey to help us prioritize...</summary>
        <author>
            <name>Brian Ekins</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://modthemachine.typepad.com/my_weblog/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>This years API survey is now available.  </p>  <p><a href="http://www.zoomerang.com/Survey/?p=WEB229EPCV8VA2">Autodesk® Inventor® API Survey</a></p>  <p>Please do take the time to fill out the survey and give us your input.  We rely heavily on the information obtained through this survey to help us prioritize what we’ll do in upcoming releases.  This is a great chance for you to voice your opinion.  If you provide your email address you will also be sent a copy of the survey results once they’ve been compiled.</p>  <p>The survey will remain open until <strong>July 31, 2009</strong>.  Thanks in advance for participating!</p></div>
</content>


    <feedburner:origLink>http://modthemachine.typepad.com/my_weblog/2009/07/inventor-api-wishlist-survey.html</feedburner:origLink></entry>
    <entry>
        <title>Working with STL and OBJ Files</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/modthemachine/~3/bpXdL-lrMBE/working-with-stl-and-obj-files.html" />
        <link rel="replies" type="text/html" href="http://modthemachine.typepad.com/my_weblog/2009/07/working-with-stl-and-obj-files.html" thr:count="3" thr:updated="2009-07-22T15:49:28-07:00" />
        <id>tag:typepad.com,2003:post-6a00e553fcbfc6883401157205eef8970b</id>
        <published>2009-07-14T17:15:16-07:00</published>
        <updated>2009-07-23T09:57:53-07:00</updated>
        <summary>This posting isn’t about how to use the API but is an example of what can be done with the API and hopefully is useful to some of you. A big reason I’m posting it here is that I continue...</summary>
        <author>
            <name>Brian Ekins</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://modthemachine.typepad.com/my_weblog/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>This posting isn’t about how to use the API but is an example of what can be done with the API and hopefully is useful to some of you.  A big reason I’m posting it here is that I continue to get requests for the program and this will provide a better way to distribute and update it than the newsgroup.</p>  <p>The program came about after I visited a university a couple of years ago that is using Inventor as part of their engineering program.  In one of their classes the students need to create an Inventor model to fit around a model that’s defined by an OBJ file.  (OBJ and STL files are formats that define a model using a mesh of triangles.)  It was difficult for them to use this data in Inventor and it seemed to me like something could be done to improve the process and it became a pet project of mine.</p>  <p>The Facet Enabler add-in became the result.  It’s an add-in that uses client graphics and client features, plus a lot of code of my own.  It allows you to read in an OBJ or STL file and see it in Inventor.  What you see is just client graphics which means it’s only for display and doesn’t affect the model and can’t be used for other operations like interference checking, measure, etc.  To be able to make use of the mesh data for modeling the add-in supports a command that lets you cut a section through the client graphics, which creates a sketch that can then be cleaned up and used as input for standard Inventor features.</p>  <p>The add-in adds two commands to Inventor.  The first is added to the part environment.  Its icon is the yellow pyramid as shown below (the second to the last command in the panel bar).  If using the ribbon interface it is in the Add-Ins panel of the Part ribbon.  When you read in the OBJ or STL data a new icon is created in the browser to represent the data.  There are also several options to control how it is displayed that are accessed from the context menu, as shown below.  (The “Smooth Shading” option is only available if that information existed in the OBJ file.  It’s never available for STL data.)</p>  <p><a href="http://modthemachine.typepad.com/.a/6a00e553fcbfc68834011571114618970c-pi"><img title="FacetEnablerOptions" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="364" alt="FacetEnablerOptions" src="http://modthemachine.typepad.com/.a/6a00e553fcbfc6883401157205eedc970b-pi" width="404" border="0" /></a> </p>  <p>   <br />In the sketch environment there’s one new button that’s added.  It looks like a sectioned pyramid and is the last command in the panel menu below.  It will create sketch geometry that represents a section cut through the faceted model as shown below.  You can use the sketch geometry for standard Inventor modeling.</p>  <p><a href="http://modthemachine.typepad.com/.a/6a00e553fcbfc68834011571114620970c-pi"><img title="FacetEnablerSection" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="364" alt="FacetEnablerSection" src="http://modthemachine.typepad.com/.a/6a00e553fcbfc6883401157205eef4970b-pi" width="404" border="0" /></a> </p>  <p>To install the program just download the zip file and run the install program it contains.  It will run with Inventor 2009 and later.</p>  <p><a href="http://modthemachine.typepad.com/files/facetenablersetup.zip">Facet Enabler Install Download</a></p>  <p>Please let me know if you find any problems, have suggestions to improve the program, or want to be notified if there are updates.  I’ll also update this blog post when I update the program.</p>  <p><strong>Revisions</strong>     <br />July 14, 2009 – Initial Post    <br />July 23, 2009 – Posted version 1.5 which contains a fix to correctly handle line continuation characters in OBJ files.</p></div>
</content>


    <feedburner:origLink>http://modthemachine.typepad.com/my_weblog/2009/07/working-with-stl-and-obj-files.html</feedburner:origLink></entry>
    <entry>
        <title>Introduction to Attributes</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/modthemachine/~3/iXLweh6tg24/introduction-to-attributes.html" />
        <link rel="replies" type="text/html" href="http://modthemachine.typepad.com/my_weblog/2009/07/introduction-to-attributes.html" thr:count="4" thr:updated="2009-11-05T07:38:11-08:00" />
        <id>tag:typepad.com,2003:post-6a00e553fcbfc68834011570a96159970c</id>
        <published>2009-07-01T22:31:03-07:00</published>
        <updated>2009-07-01T22:31:03-07:00</updated>
        <summary>This is the first of at least two posts on attributes. This first one will cover the basics and subsequent postings will go into some more advanced aspects. Most programs your write will likely only need the information covered in...</summary>
        <author>
            <name>Brian Ekins</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://modthemachine.typepad.com/my_weblog/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>This is the first of at least two posts on attributes.  This first one will cover the basics and subsequent postings will go into some more advanced aspects.  Most programs your write will likely only need the information covered in this post.</p>  <p>The attribute functionality of Inventor is something that’s only available through the API; it doesn’t have a user-interface.  The basic concept of attributes is very simple; it’s the ability to associate information with Inventor entities.  Where it get’s a little more complicated is in understanding when this functionality might apply to your programs and how you can take advantage of it.</p>  <p>First, let’s look at the API for attributes.  Every object that supports attributes has the AttributeSets property from which you can access the attributes associated with that particular object.  Below is the object model for attributes.    <br /> <a href="http://modthemachine.typepad.com/.a/6a00e553fcbfc68834011570a96141970c-pi"><img title="AttributesModel" style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" height="141" alt="AttributesModel" src="http://modthemachine.typepad.com/.a/6a00e553fcbfc68834011570a96151970c-pi" width="179" border="0" /></a></p>  <p />  <p>The “Inventor Entity” is any object that supports the AttributeSets property.  The AttributesSets object returned by this property is an object collection that lets you access all of the AttributeSet objects associated with the object, and it also lets you create new AttributeSet objects.  An AttributeSet is exactly what the name implies; a set of attributes.  They provide a way of grouping the attributes associated with an object.  Typically, each application that adds an attribute to an object will create their own attribute set so that their attributes aren’t mixed with another application’s attributes. </p>  <p><font size="3"><strong>Creating an Attribute </strong></font>    <br />An AttributeSet object is also a collection object and provides access to the Attribute objects it contains and provides the ability to create new attributes.  Below is an example VBA macro that demonstrates this by creating a new attribute set on a selected entity and then adds an attribute to that set.</p>  <div style="font-size: 8pt; background: #eeeeee; color: black; line-height: 140%; font-family: courier new">   <p>Public Sub CreateAttribute()      <br /><font color="#0000ff"><strong>    ' Get the active document.  It can be any type of document.          <br /></strong></font>    Dim doc As Document       <br />    Set doc = ThisApplication.ActiveDocument  <br />      <br /></p>    <p><font color="#0000ff"><strong>    ' Get the selected entity.          <br /></strong></font>    Dim entity As Object       <br />    On Error Resume Next       <br />    Set entity = doc.SelectSet.Item(1)       <br />    If Err Then       <br />        MsgBox "You must select an entity."       <br />        Exit Sub       <br />    End If </p>    <p><font color="#0000ff"><strong>    ' Get the AttributeSets object from the selected entity.          <br /></strong></font>    Dim attribSets As AttributeSets       <br />    Set attribSets = entity.AttributeSets       <br />    If Err Then       <br />        MsgBox "You must select an entity that supports attributes."       <br />        Exit Sub       <br />    End If       <br />    On Error GoTo 0  <br />      <br /><font color="#0000ff"><strong>    ' Create an attribute set.          <br /></strong></font>    Dim attribSet As AttributeSet       <br />    Set attribSet = attribSets.Add("SampleSet")       <br />      <br /><font color="#0000ff"><strong>    ' Create an attribute on the set.          <br /></strong></font>    Dim attrib As Inventor.Attribute       <br />    Set attrib = attribSet.Add("SampleAttribute", _       <br />                               kStringType, "A Test")       <br />End Sub</p> </div>  <p />  <p>The first portion of the program gets the entity that is currently selected within the active document.  Notice that the variable “entity” is declared as Object, indicating that any type of object can be handled.  The error handling is used to catch the case where no entity has been selected.</p>  <p>The next section of the program gets the AttributeSets object from the selected entity.  Since the program allows you to select anything, the error handling is used to catch the case where the selected object doesn’t support the AttributeSets property.</p>  <p>Finally, we have an AttributeSets object that was obtained from the selected entity.  The next section creates an AttributeSet object using the Add method of the AttributeSets object.  It supplies the name to use for the AttributeSet.  The name must be unique with respect to the other AttributeSet objects associated with that particular AttributeSets object.  Typically you would append the set name with your company or application name to make it unique, i.e. “modmachineSampleTest”.</p>  <p>The final section of the program creates an attribute within the attribute set.  The creation of the attribute takes three arguments; name, type, and value.  The name must be unique with respect to the other attributes within this attribute set.  Since it’s likely you’re the only one adding attributes to your set this is easily managed by you.  Attributes can be one of four different types; Double, Integer, String, or array of Bytes.  In the example above it creates a String attribute with the value of “A Test”.</p>  <p><font size="3"><strong>Getting an Existing Attribute From an Entity</strong></font>     <br />Now that you’ve seen how to create an attribute on an entity, how do you get that attribute back at a later time?  There are two ways of accessing attributes.  The first uses the objects we’ve already looked at; AttributeSets and AttributeSet.  The sample code below illustrates getting the attribute that was just created.</p>  <div style="font-size: 8pt; background: #eeeeee; color: black; line-height: 140%; font-family: courier new">   <p>Public Sub GetAttribute()      <br /><font color="#0000ff"><strong>    ' Get the active document.  It can be any type of document.          <br /></strong></font>    Dim doc As Document       <br />    Set doc = ThisApplication.ActiveDocument       <br />      <br /><font color="#0000ff"><strong>    ' Get the selected entity.          <br /></strong></font>    Dim entity As Object       <br />    On Error Resume Next       <br />    Set entity = doc.SelectSet.Item(1)       <br />    If Err Then       <br />        MsgBox "You must select an entity."       <br />        Exit Sub       <br />    End If       <br />      <br /><font color="#0000ff"><strong>    ' Get the AttributeSets object from the selected entity.          <br /></strong></font>    Dim attribSets As AttributeSets       <br />    Set attribSets = entity.AttributeSets       <br />    If Err Then       <br />        MsgBox "You must select an entity that supports attributes."       <br />        Exit Sub       <br />    End If       <br />    On Error GoTo 0       <br />      <br /><font color="#0000ff"><strong>    ' Check to see if it has the "SampleSet" attribute set.          <br /></strong></font>    If attribSets.NameIsUsed("SampleSet") Then       <br /><font color="#0000ff"><strong>        ' Get the attribute set.          <br /></strong></font>        Dim attribSet As AttributeSet       <br />        Set attribSet = attribSets.Item("SampleSet") </p>    <p><font color="#0000ff"><strong>        ' Get the attribute on the set.          <br /></strong></font>        Dim attrib As Inventor.Attribute       <br />        Set attrib = attribSet.Item("SampleAttribute")       <br />        MsgBox "Attribute " &amp; attrib.name &amp; " = " &amp; attrib.Value       <br />    Else       <br />        MsgBox "The entity does not have the expected attribute set."       <br />    End If       <br />End Sub</p> </div>  <p />  <p>Most of the code in the sample above is the same as the previous sample.  However, once it has the AttributeSets object from the selected entity it uses the NameIsUsed property of the AttributeSets object to see if there is an attribute set named “SampleSet”.  If there is then it gets the attribute named “SampleAttribute”.  Finally it displays the name and value of that attribute.</p>  <p>The approach demonstrated above illustrates how you can get an attribute from an known entity.  The problem with this approach is that in many cases you don’t have a reference to the entity the attribute is attached to.  For example, you might have attached an attribute to a face so you can use the attribute at a later time to find that face again.  Using the technique shown above you would need to iterate over every face in the model until you found the one that had the “SampleSet” attribute set.  Not a very efficient way to find the attribute.  Another approach of getting attributes is discussed below.</p>  <p><font size="3"><strong>Getting an Existing Attribute Using the Attribute Manager        <br /></strong></font>The other way to find existing attributes is to use the AttributeManager object.  This is an object you obtain using the AttributeManager property of the Document object.  The most common use of the attribute manager is to query for attributes that exist in the document.  For example, the code below will find all entities that have an attribute set called “SampleSet”.</p>  <div style="font-size: 8pt; background: #eeeeee; color: black; line-height: 140%; font-family: courier new">   <p>Public Sub GetAttributeUsingManager()      <br /><font color="#0000ff"><strong>    ' Get the active document.  It can be any type of document.          <br /></strong></font>    Dim doc As Document       <br />    Set doc = ThisApplication.ActiveDocument  <br />      <br /><font color="#0000ff"><strong>    ' Get the attribute manager.          <br /></strong></font>    Dim attribMgr As AttributeManager       <br />    Set attribMgr = doc.AttributeManager       <br />      <br /><font color="#0000ff"><strong>    ' Find all attribute sets named "SampleSet".          <br /></strong></font>    Dim foundEntities As ObjectCollection       <br />    Set foundEntities = attribMgr.FindObjects("SampleSet")       <br />      <br />    MsgBox "Found " &amp; foundEntities.Count &amp; " entities."       <br />End Sub</p> </div>  <p />  <p>You can see this is much easier, and faster, than looking through all of the entities to see if they have a particular attribute set.</p>  <p>There are three different Find methods to choose from and you’ll choose one over the other depending on which type of object will be the most convenient for you to use in your program.  The three find methods are FindAttributes, FindAttributeSets, and FindObjects.  All three of them take the same input arguments and do the same type of search with the only difference being what they return.  The FindAttributes method returns a list of Attribute objects as an AttributesEnumerator object.  The FindAttributeSets method returns a list of AttributeSet objects as an AttributeSetsEnumerator object.  The FindObjects returns a list of entities as an ObjectCollection object.</p>  <p>The three Find methods have three arguments.  The first is the name of the attribute set, the second is the name of the attribute, and the third is the value of the attribute.  You can use wild cards when searching.  For example if I had added the following attribute sets to several different entities, SampleSet1, SampleSet2, SampleSet3, and SampleSet4, the following query would find and return all four attribute sets.  Notice the asterisk wild card at the end of “SampleSet”</p>  <div style="font-size: 8pt; background: #eeeeee; color: black; line-height: 140%; font-family: courier new"><font color="#0000ff"><strong>    ' Find all attribute sets named "SampleSet".        <br /></strong></font>    Dim foundSets As AttributeSetsEnumerator  <br />    Set foundSets = attribMgr.FindAttributeSets("SampleSet*")     <br /></div>  <p>The following query will find all attribute sets named “SampleSet” that contain an attribute named “TableType”.</p>  <div style="font-size: 8pt; background: #eeeeee; color: black; line-height: 140%; font-family: courier new"><font color="#0000ff"><strong>    ' Find all attribute sets named "SampleSet".        <br /></strong></font>    Dim foundSets As AttributeSetsEnumerator  <br />    Set foundSets = attribMgr.FindAttributeSets("SampleSet", _</div>  <div style="font-size: 8pt; background: #eeeeee; color: black; line-height: 140%; font-family: courier new">                                                "TableType")    <br /></div>  <p>This last one find all attribute sets that have an attribute whose value is “ACME Fastener”.</p>  <div style="font-size: 8pt; background: #eeeeee; color: black; line-height: 140%; font-family: courier new"><font color="#0000ff"><strong>    ' Find all attribute sets named "SampleSet".        <br /></strong></font>    Dim foundSets As AttributeSetsEnumerator  <br />    Set foundSets = attribMgr.FindAttributeSets("*", "*", _</div>  <div style="font-size: 8pt; background: #eeeeee; color: black; line-height: 140%; font-family: courier new">                                                "ACME Fastener")    <br /></div>  <p>As discussed above, the various find methods return different types of objects.  Frequently you may have a reference to one type of object but also need the associated objects.  We’ve already seen how how you can walk down the object model from an entity to get an associated AttributeSet object and from the AttributeSet object to get the Attribute objects.  You can also walk up the object model.  If you start with an Attribute object you can use its Parent property to get the AttributeSet object it is associated with.  You can use the Parent property of the AttributeSet object to get the parent AttributeSets object.  And finally, you can use the AttributeSets object’s Parent property to get the entity the attribute set is associated with.  <br /><font size="3"><strong>       <br />Why Use Attributes? </strong>      <br /></font>A common question when first learning about attributes is “why/how would you use them?”.  Attributes don’t do anything by themselves but only serve as a tool to enable other things.  Because of this they are used in many different ways for many unique applications.  Here are a some examples that illustrate how attributes can be used.  They also demonstrate why you would choose one of the find methods of the AttributeManager object over another.  </p>  <p>Probably the most common use of attributes is for naming an entity so you can find it later.  For example, you might be automating the creation of an assembly and need to find the entities that will be used as input when creating constraints to position the parts in the assembly.  One approach is to add an attribute set to the entity so you can use one of the AttributeManager find method find it later.  In this case it’s the entity that’s of interest and the attribute is just serving as the mechanism to find the entity and using the FindObjects method makes sense because it directly returns the object so you can easily use it to create the constraint.</p>  <p>Another common example of the use of attributes is adding additional information to an entity that’s important for your application. For example you might write a program to create a custom table in a drawing.  In this case each row of the table represents something unique to your application is not something that Inventor is aware of.  You can use the API to create a custom table with the data you want to display but you can also add an attribute set to the custom table that contains additional information that will be useful to you to understand where the data in the table came from so you can easily update it.  In this case it’s probably the AttributeSets object that’s the most interesting since it gives you easy access to the attributes to allow you to query them to determine the table information.  Using the FindAttributeSets method makes more sense in this case.</p>  <p>Here’s an example where Inventor takes advantage of attributes.  I talked this in a previous post, <a title="http://modthemachine.typepad.com/my_weblog/2009/04/controlling-layers-in-your-flat-pattern-export.html" href="http://modthemachine.typepad.com/my_weblog/2009/04/controlling-layers-in-your-flat-pattern-export.html">http://modthemachine.typepad.com/my_weblog/2009/04/controlling-layers-in-your-flat-pattern-export.html</a>.  In this example, you add attributes to the edges of a flat pattern and the translator will use the attributes to determine which layer to create the corresponding geometry on.</p>  <p>Another example is face colors.  You can right-click on a face in a part and select the Properties command to change the color of that face.  Internally, Inventor remembers the color you selected by adding an attribute to that face that has the name of the color.</p></div>
</content>


    <feedburner:origLink>http://modthemachine.typepad.com/my_weblog/2009/07/introduction-to-attributes.html</feedburner:origLink></entry>
    <entry>
        <title>DevLabs</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/modthemachine/~3/cPdHfXVJOSE/devlabs.html" />
        <link rel="replies" type="text/html" href="http://modthemachine.typepad.com/my_weblog/2009/04/devlabs.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-66180903</id>
        <published>2009-04-29T18:35:32-07:00</published>
        <updated>2009-04-29T18:35:32-07:00</updated>
        <summary>Here’s an unbelievable opportunity, if you’re in a position that you can take advantage of it. It’s essentially up to a weeks worth of free programming consultation. Kean Walmsley, who is the manager of the DevTech team explains it fully...</summary>
        <author>
            <name>Brian Ekins</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://modthemachine.typepad.com/my_weblog/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Here’s an unbelievable opportunity, if you’re in a position that you can take advantage of it.  It’s essentially up to a weeks worth of free programming consultation.  Kean Walmsley, who is the manager of the DevTech team explains it fully in his blog <a href="http://through-the-interface.typepad.com/through_the_interface/2009/04/introducing-devlabs.html">Through the Interface</a>.  DevTech is the support group for the Autodesk Developer Network (ADN).  Take a look at the locations and dates and see if one of them works for you.</p></div>
</content>


    <feedburner:origLink>http://modthemachine.typepad.com/my_weblog/2009/04/devlabs.html</feedburner:origLink></entry>
 
</feed><!-- ph=1 --><!-- nhm:dynamic-ssi -->
