<?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: Check if parameter is multivalue list and if so, copy the multivalue list to a new parameter in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10134315#M121790</link>
    <description>&lt;P&gt;that's most of what I need, but not sure how to have it copy over the multivalue list to the new parameter.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Mar 2021 21:47:44 GMT</pubDate>
    <dc:creator>danny.lewisA9QBW</dc:creator>
    <dc:date>2021-03-05T21:47:44Z</dc:date>
    <item>
      <title>Check if parameter is multivalue list and if so, copy the multivalue list to a new parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10133332#M121775</link>
      <description>&lt;P&gt;I'm making code to transfer the key parameters from one file to another (via ilogic, not xml) and I can't find how to check if a parameter is a multi-value parameter and to copy it over to a new parameter if it is.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 14:58:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10133332#M121775</guid>
      <dc:creator>danny.lewisA9QBW</dc:creator>
      <dc:date>2021-03-05T14:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Check if parameter is multivalue list and if so, copy the multivalue list to a new parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10133747#M121781</link>
      <description>&lt;P&gt;Check the &lt;A href="https://help.autodesk.com/view/INVNTOR/2019/ENU/?guid=GUID-A5D83703-A9D0-4226-9D74-4C7D0F48D7AC" target="_blank" rel="noopener"&gt;ExpressionList Property&lt;/A&gt;&amp;nbsp; of each parameter.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Non-list Parameters have ExpressionList.Count = 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;For Each p As Parameter In ThisDoc.Document.ComponentDefinition.Parameters
	If p.ExpressionList.Count &amp;gt; 0
		Logger.Trace(p.Name &amp;amp; "  List QTY:  " &amp;amp; p.ExpressionList.Count)
	End If
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Run rule in Log Level Trace to check sample code results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 17:24:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10133747#M121781</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2021-03-05T17:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Check if parameter is multivalue list and if so, copy the multivalue list to a new parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10133976#M121784</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7048560"&gt;@danny.lewisA9QBW&lt;/a&gt; .&lt;/P&gt;&lt;P&gt;See if this code does what you're trying to do:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	'define source document
	Dim oSourceDoc As Document = ThisApplication.ActiveDocument
	'get its parameters
	Dim oSParams As Inventor.Parameters = GetParams(oSourceDoc)
	Dim oSParam As Inventor.Parameter
	
	'define target document
	Dim oTargetDoc As Document
	Dim oTargetDocName As String = GetTargetDoc
	If oTargetDocName = "" Then Exit Sub
	oTargetDoc = ThisApplication.Documents.Open(GetTargetDoc, True)
	'get its parameters
	Dim oTParams As Inventor.Parameters = GetParams(oTargetDoc)
	Dim oTParam As Inventor.Parameter
	
	For Each oSParam In oSParams
		If Not oSParam.IsKey Then Continue For
		Try
			oTParam = oTParams.Item(oSParam.Name)
		Catch
			If oSParam.ParameterType = ParameterTypeEnum.kModelParameter Then
				oTParam = oTParams.ModelParameters.AddByExpression(oSParam.Expression, oSParam.Units, oSParam.Name)
				If oSParam.ExpressionList IsNot Nothing AndAlso oSParam.ExpressionList.Count &amp;gt; 0 Then
					Dim oExps() As String = oSParam.ExpressionList.GetExpressionList
					oTParam.ExpressionList.SetExpressionList(oExps)
				End If
			ElseIf oSParam.ParameterType = ParameterTypeEnum.kUserParameter Then
				oTParam = oTParams.UserParameters.AddByExpression(oSParam.Expression, oSParam.Units, oSParam.Name)
				If oSParam.ExpressionList IsNot Nothing AndAlso oSParam.ExpressionList.Count &amp;gt; 0 Then
					Dim oExps() As String = oSParam.ExpressionList.GetExpressionList
					oTParam.ExpressionList.SetExpressionList(oExps)
				End If
			End If
		Catch
			MsgBox("Failed to copy source param named '" &amp;amp; oSParam.Name &amp;amp; "' to target document.",,"")
		End Try
	Next
End Sub

Public Function GetParams(oDoc As Document) As Inventor.Parameters
	'check doc type
	Dim oDocType As DocumentTypeEnum = oDoc.DocumentType
	'get its Params
	Dim oPrms As Inventor.Parameters
	If oDocType = DocumentTypeEnum.kPartDocumentObject Or _
		oDocType = DocumentTypeEnum.kAssemblyDocumentObject Then
		oPrms = ThisApplication.ActiveDocument.ComponentDefinition.Parameters
	ElseIf oDocType = DocumentTypeEnum.kDrawingDocumentObject Then
		oPrms = ThisDrawing.Document.Parameters
	End If
	Return oPrms
End Function

Public Function GetTargetDoc() As String
	'use Open File Dialog to get target document
	Dim oFileName As String
	Dim oDoc As Inventor.Document
	Dim oFileDialog As Inventor.FileDialog
	ThisApplication.CreateFileDialog(oFileDialog)
	oFileDialog.DialogTitle = "Select 'Target' file."
	oFileDialog.InitialDirectory = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
	oFileDialog.Filter = "Autodesk Inventor Files (*.iam;*.dwg;*.idw;*.ipt:*.ipn;*.ide) | *.iam;*.dwg;*.idw;*ipt;*.ipn;*.ide | All files (*.*)|*.*"
	oFileDialog.MultiSelectEnabled = False
	oFileDialog.OptionsEnabled = False
	oFileDialog.CancelError = True
	oFileDialog.InsertMode = False
	On Error Resume Next
	oFileDialog.ShowOpen
	If Err.Number &amp;lt;&amp;gt; 0 Then
		MsgBox("Dialog was canceled. Exiting.", vbOKOnly, "CANCELED")
		Return ""
	Else	
		If oFileDialog.FileName &amp;lt;&amp;gt; vbNullString Then
			oFileName = oFileDialog.FileName
			Return oFileName
		Else
			MsgBox("No file was selected. Exiting.", vbOKOnly + vbExclamation, "FILE NOT SELECTED")
			Return ""
		End If
	End If
End Function&lt;/LI-CODE&gt;&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;If you have time, please... Vote For &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B166FEBB95D67CFA84899D32D8E17FC1/emoticons/1f4a1.png" alt=":light_bulb:" title=":light_bulb:" /&gt;&lt;/SPAN&gt;&lt;/A&gt;or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/" target="_blank"&gt;Inventor 2021 Help &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-forum/bd-p/78/" target="_blank"&gt;Inventor Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-customization/bd-p/120/" target="_blank"&gt;Inventor Customization Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/idb-p/v1232/" target="_blank"&gt;Inventor Ideas Forum &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 18:58:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10133976#M121784</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-03-05T18:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Check if parameter is multivalue list and if so, copy the multivalue list to a new parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10134315#M121790</link>
      <description>&lt;P&gt;that's most of what I need, but not sure how to have it copy over the multivalue list to the new parameter.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 21:47:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10134315#M121790</guid>
      <dc:creator>danny.lewisA9QBW</dc:creator>
      <dc:date>2021-03-05T21:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Check if parameter is multivalue list and if so, copy the multivalue list to a new parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10137981#M121831</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7048560"&gt;@danny.lewisA9QBW&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using iLogic below code will help you.&lt;/P&gt;&lt;P&gt;CopyParam is a parameter in which you will copy the multivalue list.&lt;/P&gt;&lt;P&gt;SourceParam is a parameter in which there is already a multivalue list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;MultiValue&lt;/SPAN&gt;.&lt;SPAN&gt;List&lt;/SPAN&gt;(&lt;SPAN&gt;"CopyParam"&lt;/SPAN&gt;) = &lt;SPAN&gt;MultiValue&lt;/SPAN&gt;.&lt;SPAN&gt;List&lt;/SPAN&gt;(&lt;SPAN&gt;"SourceParam"&lt;/SPAN&gt;)
&lt;SPAN&gt;RuleParametersOutput&lt;/SPAN&gt;
&lt;SPAN&gt;InventorVb&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentUpdate&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;See if this helps.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 06:56:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10137981#M121831</guid>
      <dc:creator>dutt.thakar</dc:creator>
      <dc:date>2021-03-08T06:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Check if parameter is multivalue list and if so, copy the multivalue list to a new parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10138735#M121845</link>
      <description>&lt;P&gt;The code I posted already contained code to copy the multi-value list from the source parameter to the target parameter.&amp;nbsp; That's what the following block of code, that appears twice within it, was for:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;If oSParam.ExpressionList IsNot Nothing AndAlso oSParam.ExpressionList.Count &amp;gt; 0 Then
	Dim oExps() As String = oSParam.ExpressionList.GetExpressionList
	oTParam.ExpressionList.SetExpressionList(oExps)
End If&lt;/LI-CODE&gt;&lt;P&gt;It doesn't just copy a list of 'Values', it copies the list of 'Expressions', in case you want to maintain a list of possible equations or similar non-simple entries.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 13:38:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10138735#M121845</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-03-08T13:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Check if parameter is multivalue list and if so, copy the multivalue list to a new parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10138745#M121846</link>
      <description>&lt;P&gt;While I think your code chunk would work; here's a bigger picture of the relevant code so people have a better idea of what's going on:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim AssyDoc As AssemblyDocument = ThisApplication.Documents.Add(kAssemblyDocumentObject, "{source Assy filepath}", True)

Dim oUParams As UserParameters = oDoc.ComponentDefinition.Parameters.UserParameters
Dim iUParamCount As Integer = oUParams.Count

Dim Cycle As Integer
Dim uParamName As String

For Cycle = 1 To iUParamCount
	uParamName = oUParams(Cycle).Name
	If oUParams(Cycle).IsKey = True Then
		If oUParams(Cycle).Units = "ul" Then
			AssyDoc.ComponentDefinition.Parameters.UserParameters.AddByExpression(uParamName, oUParams(Cycle).Value, "ul").IsKey = True
'	If oUParams(Cycle).ExpressionList.Count &amp;gt; 0 Then
'			AssyDoc.ComponentDefinition.Parameters.UserParameters.AddByExpression(uParamName, MultiValue.List(uParamName), "ul").IsKey = True
'				End If
Else If oUParams(Cycle).Units = "Text" Then
	AssyDoc.ComponentDefinition.Parameters.UserParameters.AddByValue(uParamName, oUParams(Cycle).Value, kTextUnits).IsKey = True
Else
			AssyDoc.ComponentDefinition.Parameters.UserParameters.AddByValue(uParamName, oUParams(Cycle).Value, kMillimeterLengthUnits).IsKey = True
		End If
	End If
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's because I'm trying to transfer the parameters between the source (part) file to the destination (part or assy) file that I'm tripping up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 13:41:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10138745#M121846</guid>
      <dc:creator>danny.lewisA9QBW</dc:creator>
      <dc:date>2021-03-08T13:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Check if parameter is multivalue list and if so, copy the multivalue list to a new parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10138953#M121850</link>
      <description>&lt;P&gt;OK. Maybe try it this way then.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sub Main
	'source document
	Dim oSDoc As PartDocument = ThisApplication.ActiveDocument
	Dim oSUParams As UserParameters = oSDoc.ComponentDefinition.Parameters.UserParameters
	Dim oSUParam As UserParameter

	'target document
	Dim oTDoc As AssemblyDocument = ThisApplication.Documents.Add(kAssemblyDocumentObject, "{source Assy filepath}", True)
	Dim oTUParams As UserParameters = oTDoc.ComponentDefinition.Parameters.UserParameters
	Dim oTUParam As UserParameter

	For Each oSUParam In oSUParams
		If Not oSUParam.IsKey Then Continue For 'so it will only process Key params
		If oSUParam.Units = "ul" Then
			oTUParam = oTUParams.AddByExpression(oSUParam.Name, oSUParam.Value, "ul")
			oTUParam.IsKey = True
			CopyExpList(oSUParam,oTUParam)
		ElseIf oSUParam.Units = "Text" Then
			oTUParam = oTUParams.AddByValue(oSUParam.Name, oSUParam.Value, kTextUnits)
			oTUParam.IsKey = True
			CopyExpList(oSUParam,oTUParam)
		Else
			oTUParam = oTUParams.AddByValue(oSUParam.Name, oSUParam.Value, kMillimeterLengthUnits)
			oTUParam.IsKey = True
			CopyExpList(oSUParam,oTUParam)
		End If
	Next
End Sub

Public Sub CopyExpList(oSourceP As UserParameter, oTargetP As UserParameter)
	If oSourceP.ExpressionList IsNot Nothing AndAlso oSourceP.ExpressionList.Count &amp;gt; 0 Then
		oTargetP.ExpressionList.SetExpressionList(oSourceP.ExpressionList.GetExpressionList)
	End If
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/SPAN&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 14:46:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10138953#M121850</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-03-08T14:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Check if parameter is multivalue list and if so, copy the multivalue list to a new parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10140072#M121872</link>
      <description>&lt;P&gt;You sir.... are a scholar and a gentleman. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="success.JPG" style="width: 528px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/890370iDF8AD01DBCC5BD6E/image-size/large?v=v2&amp;amp;px=999" role="button" title="success.JPG" alt="success.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 20:26:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/check-if-parameter-is-multivalue-list-and-if-so-copy-the/m-p/10140072#M121872</guid>
      <dc:creator>danny.lewisA9QBW</dc:creator>
      <dc:date>2021-03-08T20:26:10Z</dc:date>
    </item>
  </channel>
</rss>

