<?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: iLogic to Create User Parameters in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-create-user-parameters/m-p/11764945#M26795</link>
    <description>&lt;P&gt;Here is two samples. Sample 1 is just repetition of the same code so time consuming if you have many parameters.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample 2&amp;amp;3&amp;nbsp; is using a for loop to work with list/string array. Less code and less errors changing variable names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample 1:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;'Get the document 
Dim Doc As Document = ThisDoc.Document

'Get the UserParameters collection.
Dim userParams As UserParameters = Doc.ComponentDefinition.Parameters.UserParameters

'Set Paramter Name
Dim ParamName1 As String = "pThickness"
Dim ParamName2 As String = "pWidth"
Dim ParamName3 As String = "pLength"

'Declare as parameter for later use
Dim Param1,Param2,Param3 As UserParameter

Try
	Param1 = userParams.Item(ParamName1)
Catch 'Parameter not found, so create it.
	Param1 = userParams.AddByValue(ParamName1, 0, UnitsTypeEnum.kMillimeterLengthUnits)
	'Param1.Value
End Try
Try
	Param2 = userParams.Item(ParamName2)
Catch 'Parameter not found, so create it.
	Param2 = userParams.AddByValue(ParamName2, 0, UnitsTypeEnum.kMillimeterLengthUnits)
	'Param2.Value
End Try
Try
	Param3 = userParams.Item(ParamName3)
Catch 'Parameter not found, so create it.
	Param3 = userParams.AddByValue(ParamName3, 0, UnitsTypeEnum.kMillimeterLengthUnits)
	'Param3.Value
End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Sample:2&amp;nbsp; For loop with String Arrays.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'Get the document the rule is launched from.
Dim Doc As Document = ThisDoc.Document

'Get the UserParameters collection.
Dim userParams As UserParameters = Doc.ComponentDefinition.Parameters.UserParameters

'Declare as parameter for later use.
Dim Param As UserParameter

'Set Paramter Name Method 2: 1-dimensional string array.
Dim ParamList() As String = {"pThickness", "pWidth", "pLength" }

For Each ParamName In ParamList
	
	Try
		Param = userParams.Item(ParamName)
	Catch 'Parameter not found, so create it.
		Param = userParams.AddByValue(ParamName, 0, UnitsTypeEnum.kMillimeterLengthUnits)
		'Param.Value
	End Try
	
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample:3 For loop with List Of String.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'Get the document the rule is launched from.
Dim Doc As Document = ThisDoc.Document

'Get the UserParameters collection.
Dim userParams As UserParameters = Doc.ComponentDefinition.Parameters.UserParameters

'Declare as parameter for later use.
Dim Param As UserParameter

'Set Paramter Name Method 1: List Of String.
Dim ParamList As New List(Of String)
ParamList.Add("pThickness")
ParamList.Add("pWidth")
ParamList.Add("pLength")

For Each ParamName In ParamList
	
	Try
		Param = userParams.Item(ParamName)
	Catch 'Parameter not found, so create it.
		Param = userParams.AddByValue(ParamName, 0, UnitsTypeEnum.kMillimeterLengthUnits)
		'Param.Value
	End Try
	
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Feb 2023 02:40:26 GMT</pubDate>
    <dc:creator>A.Acheson</dc:creator>
    <dc:date>2023-02-19T02:40:26Z</dc:date>
    <item>
      <title>iLogic to Create User Parameters</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-create-user-parameters/m-p/11764811#M26794</link>
      <description>&lt;P&gt;Good evening, Friends,&lt;/P&gt;&lt;P&gt;Is there an iLogic code that can create user parameters when they don't exist in a part or assembly file?&lt;/P&gt;&lt;P&gt;A simple example would be a file that currently has no user parameters created. The iLogic would then create user parameters named pThickness, pWidth, and pLength. If those parameters already exist they would be skipped. For our use, these would be numeric parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You,&amp;nbsp; Al&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 23:59:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-create-user-parameters/m-p/11764811#M26794</guid>
      <dc:creator>al.popovich</dc:creator>
      <dc:date>2023-02-18T23:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Create User Parameters</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-create-user-parameters/m-p/11764945#M26795</link>
      <description>&lt;P&gt;Here is two samples. Sample 1 is just repetition of the same code so time consuming if you have many parameters.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample 2&amp;amp;3&amp;nbsp; is using a for loop to work with list/string array. Less code and less errors changing variable names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample 1:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;'Get the document 
Dim Doc As Document = ThisDoc.Document

'Get the UserParameters collection.
Dim userParams As UserParameters = Doc.ComponentDefinition.Parameters.UserParameters

'Set Paramter Name
Dim ParamName1 As String = "pThickness"
Dim ParamName2 As String = "pWidth"
Dim ParamName3 As String = "pLength"

'Declare as parameter for later use
Dim Param1,Param2,Param3 As UserParameter

Try
	Param1 = userParams.Item(ParamName1)
Catch 'Parameter not found, so create it.
	Param1 = userParams.AddByValue(ParamName1, 0, UnitsTypeEnum.kMillimeterLengthUnits)
	'Param1.Value
End Try
Try
	Param2 = userParams.Item(ParamName2)
Catch 'Parameter not found, so create it.
	Param2 = userParams.AddByValue(ParamName2, 0, UnitsTypeEnum.kMillimeterLengthUnits)
	'Param2.Value
End Try
Try
	Param3 = userParams.Item(ParamName3)
Catch 'Parameter not found, so create it.
	Param3 = userParams.AddByValue(ParamName3, 0, UnitsTypeEnum.kMillimeterLengthUnits)
	'Param3.Value
End Try&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Sample:2&amp;nbsp; For loop with String Arrays.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'Get the document the rule is launched from.
Dim Doc As Document = ThisDoc.Document

'Get the UserParameters collection.
Dim userParams As UserParameters = Doc.ComponentDefinition.Parameters.UserParameters

'Declare as parameter for later use.
Dim Param As UserParameter

'Set Paramter Name Method 2: 1-dimensional string array.
Dim ParamList() As String = {"pThickness", "pWidth", "pLength" }

For Each ParamName In ParamList
	
	Try
		Param = userParams.Item(ParamName)
	Catch 'Parameter not found, so create it.
		Param = userParams.AddByValue(ParamName, 0, UnitsTypeEnum.kMillimeterLengthUnits)
		'Param.Value
	End Try
	
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample:3 For loop with List Of String.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'Get the document the rule is launched from.
Dim Doc As Document = ThisDoc.Document

'Get the UserParameters collection.
Dim userParams As UserParameters = Doc.ComponentDefinition.Parameters.UserParameters

'Declare as parameter for later use.
Dim Param As UserParameter

'Set Paramter Name Method 1: List Of String.
Dim ParamList As New List(Of String)
ParamList.Add("pThickness")
ParamList.Add("pWidth")
ParamList.Add("pLength")

For Each ParamName In ParamList
	
	Try
		Param = userParams.Item(ParamName)
	Catch 'Parameter not found, so create it.
		Param = userParams.AddByValue(ParamName, 0, UnitsTypeEnum.kMillimeterLengthUnits)
		'Param.Value
	End Try
	
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 02:40:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-create-user-parameters/m-p/11764945#M26795</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-02-19T02:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Create User Parameters</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-create-user-parameters/m-p/11765109#M26796</link>
      <description>&lt;P&gt;Thank You very much. I will try these options on Monday at the office.&lt;/P&gt;&lt;P&gt;Best Regards,&amp;nbsp; Al&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 06:21:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-create-user-parameters/m-p/11765109#M26796</guid>
      <dc:creator>al.popovich</dc:creator>
      <dc:date>2023-02-19T06:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic to Create User Parameters</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-create-user-parameters/m-p/14042114#M179661</link>
      <description>&lt;P&gt;Muchas gracias!!! me ayudo mucho!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2026 14:47:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-create-user-parameters/m-p/14042114#M179661</guid>
      <dc:creator>drivasLL7NN</dc:creator>
      <dc:date>2026-03-04T14:47:30Z</dc:date>
    </item>
  </channel>
</rss>

