<?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: Parameter in VBA in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7990097#M89730</link>
    <description>&lt;P&gt;Hi Brian&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for my late reply. I've been away from the office for a while, but finally had the time to try this out. Exactly what I need. Thanks alot.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers - Anders&lt;/P&gt;</description>
    <pubDate>Wed, 09 May 2018 13:39:24 GMT</pubDate>
    <dc:creator>akAMYTB</dc:creator>
    <dc:date>2018-05-09T13:39:24Z</dc:date>
    <item>
      <title>Parameter in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7940657#M89722</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;Hi All&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I'm trying to transfer multible reference parameters from a derived part to into User Parameters of a new part, and I have run into several issues.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;1: How do I get the parameters from the derived part? I've tried this:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim Doc As Document&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set Doc = ThisApplication.ActiveDocument&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim Params As Parameters&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set Params = Doc.ComponentDefinition.Parameters&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim DerivedParamTbl As DerivedParameterTable&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set DerivedParamTbl = Params.DerivedParameterTables.Item("Path of the derived part") ' I geuss this is very bad practice, since I hoping to use this marco for any derived part I want in th future.&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim DerivedParam As DerivedParameter&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;erived&lt;/SPAN&gt;&lt;SPAN&gt;Param&amp;nbsp;&lt;/SPAN&gt;= DerivedParamTbl.DerivedParameters.Item("Length")&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;2: When I get the value of a numeric parameter, the value is scaled down by a factor 10 (the decimal jogs to the left - 100 becomes 10, 200 becomes 20 and so on). I'm having a message box write out the values, and it seems that the scaling talks place, when the value is retreived ( Please note, that the value in this case simply comes from another User Parameter. Since I'm not yet able to get the values from the derived parts referenced parameters, I'm just testing with User Parameters. See the attachements. I'm trying to transfer the values named CopyXXX to the ones called PasteXXX.). Another indication that the scaling takes place when the value is retrieved is that I can simply set the value in the "target parameter" by using a predefined interger variable. Please see the test code:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;Sub MakeAbox()&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim Doc As Document&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set Doc = ThisApplication.ActiveDocument&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim Params As Parameters&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set Params = Doc.ComponentDefinition.Parameters&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim UserParams As UserParameters&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set UserParams = Params.UserParameters&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim PasteDimParam As Parameter&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set PasteDimParam = UserParams.Item("PasteDim")&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim CopyDimParam As Parameter&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set CopyDimParam = UserParams.Item("CopyDim")&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim PasteTxtParam As Parameter&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set PasteTxtParam = UserParams.Item("PasteTxt")&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim CopyTxtParam As Parameter&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set CopyTxtParam = UserParams.Item("CopyTxt")&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim PasteBoolParam As Parameter&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set PasteBoolParam = UserParams.Item("PasteBool")&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim CopyBoolParam As Parameter&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Set CopyBoolParam = UserParams.Item("CopyBool")&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;MsgBox CopyDimParam.Value &amp;amp; vbNewLine &amp;amp; CopyTxtParam.Value &amp;amp; vbNewLine &amp;amp; CopyBoolParam.Value&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Dim SomeNumber As Integer&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;SomeNumber = 1523&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;'PasteDimParam.Expression = CopyDimParam.Value&amp;nbsp; ' When using this line the Target parameter gets the scaled value&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;PasteDimParam.Expression = CopyDimParam.Value &amp;amp; " cm"&amp;nbsp;&lt;SPAN&gt;' When using this line the Target parameter gets the scaled value in the equation column, but gets "cheated" to set the right norminal value.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;PasteDimParam.Expression = SomeNumber&amp;nbsp;&lt;SPAN&gt;' When using this line the Target parameter gets the variable "SomeNumber" holds.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;'PasteTxtParam.Expression = CopyTxtParam.Value ' Gives me Run time error 5&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;PasteBoolParam.Expression = CopyBoolParam.Value&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#0000FF"&gt;Doc.Update&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#0000FF"&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;3: I can get a text parameter (check what the messages box says) , but I get a Run Time Error 5 when trying to "paste it" to the target parameter.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;The purpose of making this is to quickly make a box design, with lid and bottom, with flat patterns for both depending on the bounding box of the derived part.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Any help will be appreciated.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Cheers - Anders&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 09:20:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7940657#M89722</guid>
      <dc:creator>akAMYTB</dc:creator>
      <dc:date>2018-04-18T09:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7941498#M89723</link>
      <description>&lt;P&gt;In the part file with the parameters you want to share, open the parameter list.&amp;nbsp; There is a column "Export Parameter".&amp;nbsp; Check the parameter you want to share.&amp;nbsp; They will show up in the derived parts and they will update when changed.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 13:55:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7941498#M89723</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2018-04-18T13:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7947151#M89724</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5289378"&gt;@Frederick_Law&lt;/a&gt;wrote:&lt;BR /&gt;&lt;P&gt;In the part file with the parameters you want to share, open the parameter list.&amp;nbsp; There is a column "Export Parameter".&amp;nbsp; Check the parameter you want to share.&amp;nbsp; They will show up in the derived parts and they will update when changed.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks for the answer, but getting the parameter from the derived part into the new parts parameters list is not the issue. How do I get it's object in the macro?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 07:35:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7947151#M89724</guid>
      <dc:creator>akAMYTB</dc:creator>
      <dc:date>2018-04-20T07:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7947195#M89725</link>
      <description>&lt;P&gt;Adding info:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding issue no.&amp;nbsp;2. I have tested some other macros where I get the coordinates of different points in a part. When the values are displayed in a messagebox, the comma has moved one digit to the left. Say the point is at X 123, Y 456 and Z -789, the messagebox displays X 12,3, Y 45,6 and Z -78,9.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, it seems that whenever I retreive a value from a dimension or parameter, this scaling occures.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea why?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 07:58:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7947195#M89725</guid>
      <dc:creator>akAMYTB</dc:creator>
      <dc:date>2018-04-20T07:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7948208#M89726</link>
      <description>&lt;P&gt;I believe API return all values in mm which is used internally with Inventor.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 14:55:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7948208#M89726</guid>
      <dc:creator>Frederick_Law</dc:creator>
      <dc:date>2018-04-20T14:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7948288#M89727</link>
      <description>&lt;P&gt;The API uses uses cm as length unit, that is why you see the 'scaling'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Torbjørn&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 15:20:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7948288#M89727</guid>
      <dc:creator>torbjorn_heglum2</dc:creator>
      <dc:date>2018-04-20T15:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7948428#M89728</link>
      <description>&lt;P&gt;Torbjorn is correct about the internal units being why you are seeing the scaling. It appears you are using "mm" as your units, but the values returned from internal API calls are in database units ("cm" in this case).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for trying to get derived part parameters: The link is only 1 way; the parent part doesn't know it has a derived part made from it, but the derived part knows about it's parent.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 16:12:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7948428#M89728</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2018-04-20T16:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7949435#M89729</link>
      <description>&lt;P&gt;Here's a little VBA macro that demonstrates getting what you want.&amp;nbsp; You'll also need the units when creating the new parameters, otherwise you might have a parameter that represents an angle and you create it as a length.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Sub GetDerivedParams()
    Dim partDoc As PartDocument
    Set partDoc = ThisApplication.ActiveDocument

    Dim derivedTable As DerivedParameterTable
    For Each derivedTable In partDoc.ComponentDefinition.Parameters.DerivedParameterTables
        Debug.Print "Parameters derived from: " &amp;amp; derivedTable.ReferencedDocumentDescriptor.DisplayName
        Dim param As DerivedParameter
        For Each param In derivedTable.DerivedParameters
            Debug.Print "   " &amp;amp; param.Name &amp;amp; ", " &amp;amp; param.Value &amp;amp; ", " &amp;amp; param.Units
        Next
    Next
End Sub&lt;/PRE&gt;</description>
      <pubDate>Sat, 21 Apr 2018 03:44:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7949435#M89729</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2018-04-21T03:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7990097#M89730</link>
      <description>&lt;P&gt;Hi Brian&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for my late reply. I've been away from the office for a while, but finally had the time to try this out. Exactly what I need. Thanks alot.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers - Anders&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 13:39:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/7990097#M89730</guid>
      <dc:creator>akAMYTB</dc:creator>
      <dc:date>2018-05-09T13:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Parameter in VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/10551190#M89731</link>
      <description>&lt;P&gt;Hi Brian,&lt;BR /&gt;&lt;BR /&gt;thank you for your solution. Would it be possible to somehow get the original derived parameter name (like name of parameter to which is derived parameter linked to)?&lt;BR /&gt;&lt;BR /&gt;Sometimes you have different names of derived parameter and "original parameter".&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 08:31:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/parameter-in-vba/m-p/10551190#M89731</guid>
      <dc:creator>daniel.puchta</dc:creator>
      <dc:date>2021-08-17T08:31:04Z</dc:date>
    </item>
  </channel>
</rss>

