<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: VBA parameter linking in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/vba-parameter-linking/m-p/3646522#M134255</link>
    <description>&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This mod to your code should rename the LAST created paramter (i.e. the Plane Offset). It'll also allow you to the the user parameter as the expression. You'll probably want to pass both of these functions from elsewhere, but it does work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just make sure your parameter name does not have any illegal characters in it (spaces, brackets etc.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this is what you were looking for - I got a bit lost in your question!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Private Sub CreatePlane(refPlane As String, planeName As String, offset As Double, oDoc As PartDocument)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oWorkPlane As WorkPlane&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oWorkPlane = oDoc.ComponentDefinition.WorkPlanes.AddByPlaneAndOffset(oDoc.ComponentDefinition.WorkPlanes.Item(refPlane), offset)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oWorkPlane.Name = planeName&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oCompDef As PartComponentDefinition&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oCompDef = oDoc.ComponentDefinition&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oParams As Parameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oParams = oCompDef.Parameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oModelParams As ModelParameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oModelParams = oParams.ModelParameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oModelParam As ModelParameter&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oModelParam = oModelParams.Item(oModelParams.Count)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oModelParam.Expression = "=VARM002" '&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oModelParam.Name = "GoatsCheese"&lt;BR /&gt;End Sub&lt;/P&gt;</description>
    <pubDate>Thu, 04 Oct 2012 14:16:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-10-04T14:16:56Z</dc:date>
    <item>
      <title>VBA parameter linking</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/vba-parameter-linking/m-p/3638172#M134253</link>
      <description>&lt;P&gt;Hello all,&lt;BR /&gt;I am about to embark on quite an ambitious project. I would like to write a VBA application (will later convert to plug-in, and ultimately and add-in) to generate the 3D models for a recurring project, but with different input parameters.&lt;BR /&gt;My customer builds a product (can't say more about that here), that consists of all manner of Inventor files (i.e. sheet metal parts, normal parts, weldments, sub-assemblies and ultimately a main assembly.&lt;BR /&gt;The product has about 12 different "standard" derivatives, but there are subtle changes from one project to the next within these derivatives.&lt;BR /&gt;Usually, once the product is modelled, the customer will make small changes that break away from his standard in order to save materials and various other reasons, so changes are inevitable, but they are usually fairly minor and can be controlled by using inventor parameters.&lt;BR /&gt;What I would like to do is the following. Using VBA generate a layout file that consists only of the skeletal model, but has all the parameters defining the product as user parameters. From there I want to flesh out and generate the 3D part, sheet metal etc. models by deriving this layout file into the individual parts and then inserting these parts back into the sub assembly files, weldment files and ultimately the final assembly file. I have done the project in this way manually in the past and it seems to be the best option.&lt;BR /&gt;At the moment I have a VBA macro written that is the start of the project. So far the macro creates some planes to use as sketch planes.&lt;BR /&gt;What I am struggling to figure out right now is; if I have created a plane using VBA macros using the "AddByPlaneAndOffset" method, (I have also created some user parameters), how do I determine the parameter name that is associated with the offset distance of that plane. Once I have this name, I want to edit the expression of that parameter (I think that's how it should be done) so that I can assign one of the user parameters to that model parameter. Ultimately, I would like to be able to "adjust" the position of any of the VBA created planes by changing the user parameters in the layout file.&lt;BR /&gt;It may be possible to solve this using iLogic, but somehow I have not had success with iLogic in the past for various reasons.&lt;BR /&gt;I have attached the VBA macro as it is at the moment for reference.&lt;BR /&gt;I know this is a long winded question / explanation, so thanks for taking the time to read through it.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2012 06:44:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/vba-parameter-linking/m-p/3638172#M134253</guid>
      <dc:creator>navbor</dc:creator>
      <dc:date>2012-09-28T06:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: VBA parameter linking</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/vba-parameter-linking/m-p/3646522#M134255</link>
      <description>&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This mod to your code should rename the LAST created paramter (i.e. the Plane Offset). It'll also allow you to the the user parameter as the expression. You'll probably want to pass both of these functions from elsewhere, but it does work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just make sure your parameter name does not have any illegal characters in it (spaces, brackets etc.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this is what you were looking for - I got a bit lost in your question!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Private Sub CreatePlane(refPlane As String, planeName As String, offset As Double, oDoc As PartDocument)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oWorkPlane As WorkPlane&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oWorkPlane = oDoc.ComponentDefinition.WorkPlanes.AddByPlaneAndOffset(oDoc.ComponentDefinition.WorkPlanes.Item(refPlane), offset)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oWorkPlane.Name = planeName&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oCompDef As PartComponentDefinition&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oCompDef = oDoc.ComponentDefinition&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oParams As Parameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oParams = oCompDef.Parameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oModelParams As ModelParameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oModelParams = oParams.ModelParameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim oModelParam As ModelParameter&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set oModelParam = oModelParams.Item(oModelParams.Count)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oModelParam.Expression = "=VARM002" '&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oModelParam.Name = "GoatsCheese"&lt;BR /&gt;End Sub&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2012 14:16:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/vba-parameter-linking/m-p/3646522#M134255</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-10-04T14:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: VBA parameter linking</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/vba-parameter-linking/m-p/3646534#M134256</link>
      <description>&lt;P&gt;Hello Jon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What you have suggested will work for me thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2012 14:19:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/vba-parameter-linking/m-p/3646534#M134256</guid>
      <dc:creator>navbor</dc:creator>
      <dc:date>2012-10-04T14:19:49Z</dc:date>
    </item>
  </channel>
</rss>

