<?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: Need a Rule for changing component priority to Part priority in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12252581#M20448</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14238831"&gt;@khantheking1995&lt;/a&gt;&amp;nbsp;.&amp;nbsp;You got an error on line 55 (old rule), which means you can't get the table column you want. It is necessary to check the correctness of the column name in lines 50 and 53 (new rule).&amp;nbsp;I also added a check that will help you navigate where you can't get a column.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ColomnName.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1268822i9778925FDA97CF02/image-size/large?v=v2&amp;amp;px=999" role="button" title="ColomnName.png" alt="ColomnName.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub main
	Dim oInvApp As Inventor.Application = ThisApplication
	Dim oAsmDoc As AssemblyDocument = oInvApp.ActiveDocument
	Dim oContentCenter As ContentCenter = oInvApp.ContentCenter
	Dim oUsParams As UserParameters = oAsmDoc.ComponentDefinition.Parameters.UserParameters
	
	Dim oUOfM As UnitsOfMeasure = oAsmDoc.UnitsOfMeasure
	Dim oCustom As PropertySet = oAsmDoc.PropertySets("Inventor User Defined Properties")
	Dim oDesignProps As PropertySet = oAsmDoc.PropertySets("Design Tracking Properties")
	
	Dim oWeigt_KG, oWeigt_Lbs, oStockNumb As Inventor.Property
	Try : oWeigt_KG = oCustom("Existing size Weight Kg")
	Catch : oWeigt_KG = oCustom.Add("", "Existing size Weight Kg") : End Try
	Try : oWeigt_Lbs = oCustom("Existing Part Weight Lbs")
	Catch : oWeigt_Lbs = oCustom.Add("", "Existing Part Weight Lbs") : End Try
	Try : oCustom("CAM-Weight Kg").Value = ""
	Catch : oCustom.Add("", "CAM-Weight Kg") : End Try
	Try : oCustom("CAM-Weight Lbs").Value = ""
	Catch : oCustom.Add("", "CAM-Weight Lbs") : End Try
	oStockNumb = oDesignProps("Stock Number")
	oWeigt_KG.Value = ""
	oWeigt_Lbs.Value = ""
	oStockNumb.Value = ""
	
	Dim oOcc As ComponentOccurrence
	oOcc = oInvApp.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, _
										"Select component...")
	If oOcc Is Nothing Then Exit Sub
		
	Dim oDef As PartComponentDefinition = oOcc.Definition
	Dim oCCPropSet As PropertySet
	Try : oCCPropSet = oDef.Document.PropertySets.Item("Content Library Component Properties")
	Catch : MessageBox.Show("The Part is not a CC part.") : End Try
	
	Dim dMass As Double = oOcc.MassProperties.Mass
	oWeigt_KG.Value = Round(dMass, 2)
	oWeigt_Lbs.Value = Round(oUOfM.ConvertUnits(dMass, UnitsTypeEnum.kKilogramMassUnits, _
												UnitsTypeEnum.kLbMassMassUnits), 2)
	oStockNumb.Value = oDef.Document.PropertySets("Design Tracking Properties") _
												("Stock Number").Value	
	
	Dim familyId As Inventor.Property = oCCPropSet.Item("FamilyId")
	Dim MemberId As String = oCCPropSet.Item("MemberId").Value
	Dim oFamily As ContentFamily
	oFamily = oContentCenter.GetContentObject("v3#" &amp;amp; familyId.Value &amp;amp; "#")
	Dim oContentNode As ContentTreeViewNode = oContentCenter.TreeViewTopNode
	Dim oLengthM As UserParameter
	Dim oRow As ContentTableRow = oFamily.TableRows.Item(MemberId)
	Dim iCount As Integer = oFamily.TableRows.Count - 1
	Dim iStockNumb As Integer = GetNumbColomn(oFamily.TableColumns, {"Stock Number" })
	If iStockNumb = -1 Then MessageBox.Show("Failed to get column - Stock Number", "Error!", _
											MessageBoxButtons.OK, MessageBoxIcon.Error) : Exit Sub
	Dim iWeight As Integer = GetNumbColomn(oFamily.TableColumns, {"Specific mass", "Mass"})
	If iWeight = -1 Then MessageBox.Show("Failed to get column - Mass", "Error!", _
											MessageBoxButtons.OK, MessageBoxIcon.Error) : Exit Sub
	Dim sStockNumb(iCount), sWeight(iCount) As String
	For i As Integer = 0 To iCount
		sStockNumb(i) = """" &amp;amp; oFamily.TableRows(i + 1)(iStockNumb).Value &amp;amp; """"
		sWeight(i) = """" &amp;amp; oFamily.TableRows(i + 1)(iWeight).Value &amp;amp; """"
	Next i
	Dim oColumn As ContentTableColumn = oFamily.TableColumns("STOCKNUMBER")
	Call SetParamList(oUsParams, "StockNumbBeamList", sStockNumb)
	Call SetParamList(oUsParams, "WeightKg", sWeight)
	Try : oLengthM = oUsParams("LengthM") : Catch
	oLengthM = oUsParams.AddByValue("LengthM", Nothing, _
										UnitsTypeEnum.kMeterLengthUnits) : End Try
	oLengthM.Value = oDef.Parameters.UserParameters("B_L").Value
End Sub

Private Function SetParamList(ByVal oUsParams As UserParameters,
								ByVal sNameParam As String,
								ByVal sList() As String)
	Dim oUsParam As UserParameter
	Try : oUsParam = oUsParams(sNameParam)
	Catch
		oUsParam = oUsParams.AddByValue(sNameParam, "", _
										UnitsTypeEnum.kTextUnits)
	End Try
	Call oUsParam.ExpressionList.ClearAll()
	oExpList = oUsParam.ExpressionList
	Call oExpList.SetExpressionList(sList, True, 1)
	If oExpList.AllowCustomValues Then oExpList.AllowCustomValues = False
	If oExpList.CustomOrder Then oExpList.CustomOrder = False
End Function

Private Function GetNumbColomn(ByVal oColomn As ContentTableColumns,
								ByVal sName() As String) As Integer
	For i As Integer = 1 To oColomn.Count
		If sName.Contains(oColomn(i).DisplayHeading) Then Return i
	Next i
	Return -1
End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2023 05:10:38 GMT</pubDate>
    <dc:creator>Andrii_Humeniuk</dc:creator>
    <dc:date>2023-09-20T05:10:38Z</dc:date>
    <item>
      <title>Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12153501#M20439</link>
      <description>&lt;P&gt;I want a Ilogic rule, I will add the rule to a form&lt;/P&gt;&lt;P&gt;that when run, will allow me to select a part in the assembly(The assembly is created by Frame generator in Inventor 2023).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="12345.jpg" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1249908i8450EC89DF66714D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="12345.jpg" alt="12345.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you see above image part select is a rule that allow me to select/pick a part from assembly&lt;/P&gt;&lt;P&gt;1. I will&amp;nbsp; click partselect in Form, the rule will run and allow me to select a part&lt;/P&gt;&lt;P&gt;2. The selected part/ipt details should come in the exisitng size data group.&lt;/P&gt;&lt;P&gt;&lt;U&gt;Details/Data Required&lt;/U&gt;&lt;/P&gt;&lt;P&gt;A)&amp;nbsp;&amp;nbsp;Size - Size data is available in Frame member In&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_0-1691395104592.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1249910i1B4B74201556F57A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_0-1691395104592.png" alt="khantheking1995_0-1691395104592.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Size data can also be taken from content center&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_1-1691395248449.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1249911i148498D8B3646D53/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_1-1691395248449.png" alt="khantheking1995_1-1691395248449.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;B) TOTAL WEIGHT IN LBS AND KGS FOR THE PART SELECTED&lt;/U&gt;&lt;/P&gt;&lt;P&gt;THIS DATA IS AVAILABLE BY KEEPING IN PART PRIORITY AND RIGHT CLICK, SELECT IPROPERTY OR VAULT ICONNECT PROPERTY&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="khantheking1995_2-1691395522119.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1249913iA37153395C40768E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_2-1691395522119.png" alt="khantheking1995_2-1691395522119.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_3-1691395552166.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1249914iBF253646AB63CB67/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_3-1691395552166.png" alt="khantheking1995_3-1691395552166.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now under exisitng size group, different Label are available&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_5-1691396004515.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1249917iB718B11989ACDDD7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_5-1691396004515.png" alt="khantheking1995_5-1691396004515.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want Size Data to filled in size (under existing size date)&lt;/P&gt;&lt;P&gt;Total Weight in Lbs and Kgs in TOTA WEIGHT (Lbs) AND&amp;nbsp;TOTA WEIGHT (Kgs) Label (under existing size date)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly help me to create a rule and form setup for the above requirements&lt;/P&gt;&lt;P&gt;In form also, Im facing a problem, I can add weight of Assembly from Iproperties tab in Forms but I need weight of the selected part to be displayed in Forms in the Label mentioned above.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_4-1691395901191.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1249915i43A5F146D4175A7F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_4-1691395901191.png" alt="khantheking1995_4-1691395901191.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13518190"&gt;@Andrii_Humeniuk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/108623"&gt;@JDMather&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_W&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/74757"&gt;@mcgyvr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/943328"&gt;@Cadmanto&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/674465"&gt;@jtylerbc&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 08:27:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12153501#M20439</guid>
      <dc:creator>khantheking1995</dc:creator>
      <dc:date>2023-08-07T08:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12153583#M20440</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14238831"&gt;@khantheking1995&lt;/a&gt;&amp;nbsp;.&amp;nbsp;This rule should be the radio button of your component.&amp;nbsp;Also, check that I've written your custom properties correctly (lines 10-13).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub main
	Dim oInvApp As Inventor.Application = ThisApplication
	Dim oAsmDoc As AssemblyDocument = oInvApp.ActiveDocument
	
	Dim oUOfM As UnitsOfMeasure = oAsmDoc.UnitsOfMeasure
	Dim oCustom As PropertySet = oAsmDoc.PropertySets("Inventor User Defined Properties")
	Dim oDesignProps As PropertySet = oAsmDoc.PropertySets("Design Tracking Properties")
	
	Dim oWeigt_KG, oWeigt_Lbs, oStockNumb As Inventor.Property
	Try : oWeigt_KG = oCustom("CAM-Weight Kg")
	Catch : oWeigt_KG = oCustom.Add("", "CAM-Weight Kg") : End Try
	Try : oWeigt_Lbs = oCustom("CAM-Weight Lbs")
	Catch : oWeigt_Lbs = oCustom.Add("", "CAM-Weight Lbs") : End Try
	oStockNumb = oDesignProps("Stock Number")
	oWeigt_KG.Value = ""
	oWeigt_Lbs.Value = ""
	oStockNumb.Value = ""
	
	Dim oOcc As ComponentOccurrence
	oOcc = oInvApp.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select component...")
	If oOcc Is Nothing Then Exit Sub
		
	Dim oDef As PartComponentDefinition = oOcc.Definition
    If oDef.IsContentMember Then
		MessageBox.Show("this sample works with the custom CC member only")
        Exit Sub
    End If
	
	Dim dMass As Double = oOcc.MassProperties.Mass
	oWeigt_KG.Value = Round(dMass, 2)
	oWeigt_Lbs.Value = Round(oUOfM.ConvertUnits(dMass, UnitsTypeEnum.kKilogramMassUnits, UnitsTypeEnum.kLbMassMassUnits), 2)
	oStockNumb.Value = oDef.Document.PropertySets("Design Tracking Properties")("Stock Number").Value
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 05:04:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12153583#M20440</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2023-08-09T05:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12157012#M20441</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Thanks, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;You really cracked it so easily, I'm trying this for almost a week&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;But there is minor bug in the existing code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both the weights are coming in Kg, once should be Lbs, I tried to correct the code but no success&lt;/P&gt;&lt;P&gt;Hope you can help me on that.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_0-1691504655790.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1250658i6E7B1AA8A5B856F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_0-1691504655790.png" alt="khantheking1995_0-1691504655790.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I want to develop the form a little more on the replaced Size Data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the Replace size, I want a dropdown that shows all the available size option from content center in that respective Family and standard.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_1-1691504655795.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1250659iF5C15A489CC39BAB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_1-1691504655795.png" alt="khantheking1995_1-1691504655795.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data for dropdown is available in content center as shown in below image.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_2-1691504655808.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1250660iFEE3C717E7876DDF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_2-1691504655808.png" alt="khantheking1995_2-1691504655808.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I select the part, the Ilogic rule must perform a calculation as below.&lt;/P&gt;&lt;P&gt;&lt;U&gt;Calculation&lt;/U&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;LENGTH =&amp;nbsp;EXISITNGWEIGHT_LBS / EXISTINGWEIGHT_MASSPERLENGTH&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;LENGTH should be in ft (Even if it is in other units, it should be converted to ft)&lt;/P&gt;&lt;P&gt;EXISITNGWEIGHT_LBS = CAM-WEIGHT Lbs (you made custom Iproperty for this earlier program, only the bug need to be fixed)&lt;/P&gt;&lt;P&gt;EXISTINGWEIGHT_MASSPERLENGTH should be in Lbs/ft. The data is available in content center, Even if it is in other units, it should be converted to ft. (Explain in later part of the explanation on how to identify this data)&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;REPLACEDWEIGHT_LBS = REPLACEDWEIGHT_MASSPERLENGTH * (LENGTH / 12 ul )&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;REPLACEDWEIGHT_LBS should be in Lbs(Even if it is in other units, it should be converted to ft)&lt;/P&gt;&lt;P&gt;REPLACEDWEIGHT_MASSPERLENGTH should be in Lbs/ft. The data is available in content center, even if it is in other units, it should be converted to ft. (Explain in later part of the explanation on how to identify this data)&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;For the above calculation, I have created all the above mentioned as user parameter as in below Image. But If it easy for you, you can create the rule with all the parameter shown as custom Iproperty too, whichever is convenient for you.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_3-1691504655815.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1250662i8A3F5F82A97D8D15/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_3-1691504655815.png" alt="khantheking1995_3-1691504655815.png" /&gt;&lt;/span&gt;&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;In the replaced size data group, I need rule for below application&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Existing Size and Weight in Lbs and Kg correctly will be filled as per your previously provided code once you gave me an update on that&lt;/LI&gt;&lt;LI&gt;I have created a list of parameters in the inventor which need to be filled by a rule as follow below.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;A) EXISITNGWEIGHT_LBS = CAM-WEIGHT Lbs&lt;/LI&gt;&lt;LI&gt;B)&amp;nbsp;EXISTINGWEIGHT_KG =&amp;nbsp;CAM-WEIGHT Kgs&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The above two parameter can be filled by the data that you got using the rule you provided.&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="khantheking1995_4-1691504655823.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1250661i2B4B4170AB8F298C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_4-1691504655823.png" alt="khantheking1995_4-1691504655823.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;C) LENGTH is a calculation that require EXISTINGWEIGHT_MASSPERLENGTH and EXISITNGWEIGHT_LBS&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EXISTINGWEIGHT_MASSPERLENGTH should be in Lbs/ft (Even if it is in other units, it should be converted to ft)&lt;/P&gt;&lt;P&gt;The EXISTINGWEIGHT_MASSPERLENGTH can be get from Content center data as specific mass of the particular stock size of Existing size.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_5-1691504655835.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1250663iD72E8956BC6F62FF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_5-1691504655835.png" alt="khantheking1995_5-1691504655835.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But If you look at the unit it is in Kg/m, but its value should be converted to Lbs/ft.&lt;/P&gt;&lt;P&gt;The specific mass is available in other unit also like Kg/mm, Pounds/ft, Lbs/ft etc so rule should identify the unit of that column and should convert the specific mass to Lbs/ft. Below are some sample example of other units.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;D) REPLACEDWEIGHT_MASSPERLENGTH is required to calculate REPLACEDWEIGHT_LBS.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This can be got similar to how we got REPLACEDWEIGHT_LBS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, I created this as user parameter but if you feel there is any other better way, you can make it that way&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help in Advance&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="khantheking1995_6-1691504655842.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1250665i0F6A7B2E4DF259FF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_6-1691504655842.png" alt="khantheking1995_6-1691504655842.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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="khantheking1995_7-1691504655850.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1250664i14A1556F714205B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_7-1691504655850.png" alt="khantheking1995_7-1691504655850.png" /&gt;&lt;/span&gt;&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;</description>
      <pubDate>Tue, 08 Aug 2023 14:25:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12157012#M20441</guid>
      <dc:creator>khantheking1995</dc:creator>
      <dc:date>2023-08-08T14:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12184659#M20442</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14238831"&gt;@khantheking1995&lt;/a&gt;&amp;nbsp;.&amp;nbsp;To automatically update the weight of a new profile, you need to have 2 rules:&lt;BR /&gt;Rule 1 (SelectPart):&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub main
	Dim oInvApp As Inventor.Application = ThisApplication
	Dim oAsmDoc As AssemblyDocument = oInvApp.ActiveDocument
	Dim oContentCenter As ContentCenter = oInvApp.ContentCenter
	Dim oUsParams As UserParameters = oAsmDoc.ComponentDefinition.Parameters.UserParameters
	
	Dim oUOfM As UnitsOfMeasure = oAsmDoc.UnitsOfMeasure
	Dim oCustom As PropertySet = oAsmDoc.PropertySets("Inventor User Defined Properties")
	Dim oDesignProps As PropertySet = oAsmDoc.PropertySets("Design Tracking Properties")
	
	Dim oWeigt_KG, oWeigt_Lbs, oStockNumb As Inventor.Property
	Try : oWeigt_KG = oCustom("Existing size Weight Kg")
	Catch : oWeigt_KG = oCustom.Add("", "Existing size Weight Kg") : End Try
	Try : oWeigt_Lbs = oCustom("Existing Part Weight Lbs")
	Catch : oWeigt_Lbs = oCustom.Add("", "Existing Part Weight Lbs") : End Try
	Try : oCustom("CAM-Weight Kg").Value = ""
	Catch : oCustom.Add("", "CAM-Weight Kg") : End Try
	Try : oCustom("CAM-Weight Lbs").Value = ""
	Catch : oCustom.Add("", "CAM-Weight Lbs") : End Try
	oStockNumb = oDesignProps("Stock Number")
	oWeigt_KG.Value = ""
	oWeigt_Lbs.Value = ""
	oStockNumb.Value = ""
	
	Dim oOcc As ComponentOccurrence
	oOcc = oInvApp.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, _
										"Select component...")
	If oOcc Is Nothing Then Exit Sub
		
	Dim oDef As PartComponentDefinition = oOcc.Definition
	Dim oOccDoc As PartDocument = oDef.Document
	Dim oCCPropSet As PropertySet
	Try : oCCPropSet = oOccDoc.PropertySets.Item("Content Library Component Properties")
	Catch : End Try
    If oCCPropSet Is Nothing Then
		MessageBox.Show("The Part is not a CC part.")
        Exit Sub
    End If
	
	Dim dMass As Double = oOcc.MassProperties.Mass
	oWeigt_KG.Value = Round(dMass, 2)
	oWeigt_Lbs.Value = Round(oUOfM.ConvertUnits(dMass, UnitsTypeEnum.kKilogramMassUnits, _
												UnitsTypeEnum.kLbMassMassUnits), 2)
	oStockNumb.Value = oDef.Document.PropertySets("Design Tracking Properties") _
												("Stock Number").Value
	
	
	Dim familyId As Inventor.Property = oCCPropSet.Item("FamilyId")
	Dim MemberId As String = oCCPropSet.Item("MemberId").Value
	Dim oFamily As ContentFamily
	oFamily = oContentCenter.GetContentObject("v3#" &amp;amp; familyId.Value &amp;amp; "#")
	Dim oContentNode As ContentTreeViewNode = oContentCenter.TreeViewTopNode
	Dim oListBeam, oWeightList, oLengthM As UserParameter
	Dim oRow As ContentTableRow = oFamily.TableRows.Item(MemberId)
	Dim iCount As Integer = oFamily.TableRows.Count-1
	Dim sStockNumb(iCount), sWeight(iCount) As String
	For i As Integer = 0 To iCount
		sStockNumb(i) = oFamily.TableRows(i + 1).Item(1).Value
		sWeight(i) = oFamily.TableRows(i + 1).Item(10).Value
	Next i
	Dim oColumn As ContentTableColumn = oFamily.TableColumns("STOCKNUMBER")
	Try 
		oListBeam = oUsParams("StockNumbBeamList")
	Catch
		oListBeam = oUsParams.AddByValue("StockNumbBeamList", "", _
										UnitsTypeEnum.kTextUnits)
	End Try
	oListBeam.Value = ""
	oListBeam.ExpressionList.ClearAll()
	Try
		oWeightList = oUsParams("WeightKg")
	Catch
		oWeightList = oUsParams.AddByValue("WeightKg", Nothing, _
										UnitsTypeEnum.kKilogramMassUnits)
	End Try
	oWeightList.ExpressionList.ClearAll()
	Try : oLengthM = oUsParams("LengthM") : Catch
	oLengthM = oUsParams.AddByValue("LengthM", Nothing, _
										UnitsTypeEnum.kMeterLengthUnits) : End Try
	MultiValue.List("StockNumbBeamList") = sStockNumb
	oWeightList.ExpressionList.ClearAll()
	MultiValue.List("WeightKg") = sWeight	
	oLengthM.Value = oDef.Parameters.UserParameters("B_L").Value
End Sub&lt;/LI-CODE&gt;&lt;P&gt;Rule 2 (ChangeBeam):&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oUOfM As UnitsOfMeasure = oDoc.UnitsOfMeasure
Dim oCustom As PropertySet = oDoc.PropertySets("Inventor User Defined Properties")
Dim oUsParams As UserParameters = oDoc.ComponentDefinition.Parameters.UserParameters
Dim oListBeam, oWeightList, oLengthM As UserParameter
Try 
	oListBeam = oUsParams("StockNumbBeamList")
	oWeightList = oUsParams("WeightKg")
	oLengthM = oUsParams("LengthM")
Catch : Exit Sub : End Try
If String.IsNullOrEmpty(oListBeam.Value) Then Exit Sub
Dim oWeigt_KG, oWeigt_Lbs, oStockNumb As Inventor.Property
Try : oWeigt_KG = oCustom("CAM-Weight Kg")
Catch : oWeigt_KG = oCustom.Add("", "CAM-Weight Kg") : End Try
Try : oWeigt_Lbs = oCustom("CAM-Weight Lbs")
Catch : oWeigt_Lbs = oCustom.Add("", "CAM-Weight Lbs") : End Try
For i As Integer = 1 To oListBeam.ExpressionList.Count
	If oListBeam.ExpressionList(i) = oListBeam.Expression Then
		Dim dLengthM As Double
		dLengthM = oUOfM.ConvertUnits(oLengthM.Value, kCentimeterLengthUnits, kMeterLengthUnits)
		Dim dKG As Double = oWeightList.ExpressionList(i) * dLengthM
		oWeigt_KG.Value = Round(dKG, 2)
		oWeigt_Lbs.Value = Round(oUOfM.ConvertUnits(dKG, UnitsTypeEnum.kKilogramMassUnits, _
												UnitsTypeEnum.kLbMassMassUnits), 2)
	End If
Next&lt;/LI-CODE&gt;&lt;P&gt;The second rule must be added to the trigger:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TriggerRule.png" style="width: 525px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1255676i054DCA2BD2AA9028/image-size/large?v=v2&amp;amp;px=999" role="button" title="TriggerRule.png" alt="TriggerRule.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My form settings:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SetForm.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1255686i8329F80BD29CF46F/image-size/large?v=v2&amp;amp;px=999" role="button" title="SetForm.png" alt="SetForm.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2023 07:54:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12184659#M20442</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2023-08-21T07:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12206187#M20443</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13518190"&gt;@Andrii_Humeniuk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the solution&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have few bugs in the solution as explained below, hope you can help me with that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works well for the square tubes&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_0-1693382934304.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1259815i36A05D6B82CF5728/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_0-1693382934304.png" alt="khantheking1995_0-1693382934304.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but when I checked it with round bars I got error as below.&lt;/P&gt;&lt;P&gt;The replaced size dropdown pull up some random numbers(Round bar).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_1-1693382934319.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1259816i8574FBC9CD1A9F51/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_1-1693382934319.png" alt="khantheking1995_1-1693382934319.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked what that numbers are, so it the weight data, so instead of stcok numbers from table , it pulled weight data&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_2-1693382934325.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1259814i03577D690E339E92/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_2-1693382934325.png" alt="khantheking1995_2-1693382934325.png" /&gt;&lt;/span&gt;&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="khantheking1995_3-1693382934333.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1259817i9AE51BEB87634424/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_3-1693382934333.png" alt="khantheking1995_3-1693382934333.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I checked with other profile( T profile) to test it with same size but instead of showing same weight it shows differently I don’t know why,&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="khantheking1995_4-1693382934346.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1259818iAF2F7AE7D880B100/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_4-1693382934346.png" alt="khantheking1995_4-1693382934346.png" /&gt;&lt;/span&gt;&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;can you see how to overcome these bugs, to make the tool more accurate in weight calculation&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 08:09:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12206187#M20443</guid>
      <dc:creator>khantheking1995</dc:creator>
      <dc:date>2023-08-30T08:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12212021#M20444</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14238831"&gt;@khantheking1995&lt;/a&gt;&amp;nbsp;.&amp;nbsp;In lines 50 and 51 of rule 1, you need to write down all possible variants of "Stock Number" and "Mass".&lt;BR /&gt;Rule 1:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub main
	Dim oInvApp As Inventor.Application = ThisApplication
	Dim oAsmDoc As AssemblyDocument = oInvApp.ActiveDocument
	Dim oContentCenter As ContentCenter = oInvApp.ContentCenter
	Dim oUsParams As UserParameters = oAsmDoc.ComponentDefinition.Parameters.UserParameters
	
	Dim oUOfM As UnitsOfMeasure = oAsmDoc.UnitsOfMeasure
	Dim oCustom As PropertySet = oAsmDoc.PropertySets("Inventor User Defined Properties")
	Dim oDesignProps As PropertySet = oAsmDoc.PropertySets("Design Tracking Properties")
	
	Dim oWeigt_KG, oWeigt_Lbs, oStockNumb As Inventor.Property
	Try : oWeigt_KG = oCustom("Existing size Weight Kg")
	Catch : oWeigt_KG = oCustom.Add("", "Existing size Weight Kg") : End Try
	Try : oWeigt_Lbs = oCustom("Existing Part Weight Lbs")
	Catch : oWeigt_Lbs = oCustom.Add("", "Existing Part Weight Lbs") : End Try
	Try : oCustom("CAM-Weight Kg").Value = ""
	Catch : oCustom.Add("", "CAM-Weight Kg") : End Try
	Try : oCustom("CAM-Weight Lbs").Value = ""
	Catch : oCustom.Add("", "CAM-Weight Lbs") : End Try
	oStockNumb = oDesignProps("Stock Number")
	oWeigt_KG.Value = ""
	oWeigt_Lbs.Value = ""
	oStockNumb.Value = ""
	
	Dim oOcc As ComponentOccurrence
	oOcc = oInvApp.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, _
										"Select component...")
	If oOcc Is Nothing Then Exit Sub
		
	Dim oDef As PartComponentDefinition = oOcc.Definition
	Dim oCCPropSet As PropertySet
	Try : oCCPropSet = oDef.Document.PropertySets.Item("Content Library Component Properties")
	Catch : MessageBox.Show("The Part is not a CC part.") : End Try
	
	Dim dMass As Double = oOcc.MassProperties.Mass
	oWeigt_KG.Value = Round(dMass, 2)
	oWeigt_Lbs.Value = Round(oUOfM.ConvertUnits(dMass, UnitsTypeEnum.kKilogramMassUnits, _
												UnitsTypeEnum.kLbMassMassUnits), 2)
	oStockNumb.Value = oDef.Document.PropertySets("Design Tracking Properties") _
												("Stock Number").Value	
	
	Dim familyId As Inventor.Property = oCCPropSet.Item("FamilyId")
	Dim MemberId As String = oCCPropSet.Item("MemberId").Value
	Dim oFamily As ContentFamily
	oFamily = oContentCenter.GetContentObject("v3#" &amp;amp; familyId.Value &amp;amp; "#")
	Dim oContentNode As ContentTreeViewNode = oContentCenter.TreeViewTopNode
	Dim oLengthM As UserParameter
	Dim oRow As ContentTableRow = oFamily.TableRows.Item(MemberId)
	Dim iCount As Integer = oFamily.TableRows.Count - 1
	Dim iStockNumb As Integer = GetNumbColomn(oFamily.TableColumns, {"Stock Number" })
	Dim iWeight As Integer = GetNumbColomn(oFamily.TableColumns, {"Specific mass", "Mass"})
	Dim sStockNumb(iCount), sWeight(iCount) As String
	For i As Integer = 0 To iCount
		sStockNumb(i) = """" &amp;amp; oFamily.TableRows(i + 1)(iStockNumb).Value &amp;amp; """"
		sWeight(i) = """" &amp;amp; oFamily.TableRows(i + 1)(iWeight).Value &amp;amp; """"
	Next i
	Dim oColumn As ContentTableColumn = oFamily.TableColumns("STOCKNUMBER")
	Call SetParamList(oUsParams, "StockNumbBeamList", sStockNumb)
	Call SetParamList(oUsParams, "WeightKg", sWeight)
	Try : oLengthM = oUsParams("LengthM") : Catch
	oLengthM = oUsParams.AddByValue("LengthM", Nothing, _
										UnitsTypeEnum.kMeterLengthUnits) : End Try
	oLengthM.Value = oDef.Parameters.UserParameters("B_L").Value
End Sub

Private Function SetParamList(ByVal oUsParams As UserParameters,
								ByVal sNameParam As String,
								ByVal sList() As String)
	Dim oUsParam As UserParameter
	Try : oUsParam = oUsParams(sNameParam)
	Catch
		oUsParam = oUsParams.AddByValue(sNameParam, "", _
										UnitsTypeEnum.kTextUnits)
	End Try
	Call oUsParam.ExpressionList.ClearAll()
	oExpList = oUsParam.ExpressionList
	Call oExpList.SetExpressionList(sList, True, 1)
	If oExpList.AllowCustomValues Then oExpList.AllowCustomValues = False
	If oExpList.CustomOrder Then oExpList.CustomOrder = False
End Function

Private Function GetNumbColomn(ByVal oColomn As ContentTableColumns,
								ByVal sName() As String) As Integer
	For i As Integer = 1 To oColomn.Count
		If sName.Contains(oColomn(i).DisplayHeading) Then Return i
	Next i
	Return 0
End Function&lt;/LI-CODE&gt;&lt;P&gt;Rule 2:&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oUOfM As UnitsOfMeasure = oDoc.UnitsOfMeasure
Dim oCustom As PropertySet = oDoc.PropertySets("Inventor User Defined Properties")
Dim oUsParams As UserParameters = oDoc.ComponentDefinition.Parameters.UserParameters
Dim oListBeam, oWeightList, oLengthM As UserParameter
Try 
	oListBeam = oUsParams("StockNumbBeamList")
	oWeightList = oUsParams("WeightKg")
	oLengthM = oUsParams("LengthM")
Catch : Exit Sub : End Try
If String.IsNullOrEmpty(oListBeam.Value) Then Exit Sub
Dim oWeigt_KG, oWeigt_Lbs, oStockNumb As Inventor.Property
Try : oWeigt_KG = oCustom("CAM-Weight Kg")
Catch : oWeigt_KG = oCustom.Add("", "CAM-Weight Kg") : End Try
Try : oWeigt_Lbs = oCustom("CAM-Weight Lbs")
Catch : oWeigt_Lbs = oCustom.Add("", "CAM-Weight Lbs") : End Try
For i As Integer = 1 To oListBeam.ExpressionList.Count
	If oListBeam.ExpressionList(i) = oListBeam.Expression Then
		Dim dLengthM As Double
		dLengthM = oUOfM.ConvertUnits(oLengthM.Value, kCentimeterLengthUnits, kMeterLengthUnits)
		Dim sWeight As String = oWeightList.ExpressionList(i)
		Dim dKG As Double = sWeight.Substring(1, sWeight.Length-2) * dLengthM
		oWeigt_KG.Value = Round(dKG, 2)
		oWeigt_Lbs.Value = Round(oUOfM.ConvertUnits(dKG, UnitsTypeEnum.kKilogramMassUnits, _
												UnitsTypeEnum.kLbMassMassUnits), 2)
	End If
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 12:45:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12212021#M20444</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2023-09-01T12:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12235097#M20445</link>
      <description>&lt;P&gt;Receiving error as below&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="khantheking1995_0-1694532449227.jpeg" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1265305i2250CF15680A0D0C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_0-1694532449227.jpeg" alt="khantheking1995_0-1694532449227.jpeg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_1-1694532454794.jpeg" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1265307i496CC93A29298AA7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_1-1694532454794.jpeg" alt="khantheking1995_1-1694532454794.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13518190"&gt;@Andrii_Humeniuk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 15:27:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12235097#M20445</guid>
      <dc:creator>khantheking1995</dc:creator>
      <dc:date>2023-09-12T15:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12245120#M20446</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13518190"&gt;@Andrii_Humeniuk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any update on how to resolve the bugs from last code?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2023 11:45:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12245120#M20446</guid>
      <dc:creator>khantheking1995</dc:creator>
      <dc:date>2023-09-16T11:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12251245#M20447</link>
      <description>&lt;P&gt;I have deleted all parameter from my parameter tab and run the rule Partselect but received error as in second image.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_0-1695137817055.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1268591i653220CDD7A020E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_0-1695137817055.png" alt="khantheking1995_0-1695137817055.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_1-1695137834130.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1268593i393484EC184F2620/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_1-1695137834130.png" alt="khantheking1995_1-1695137834130.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 15:37:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12251245#M20447</guid>
      <dc:creator>khantheking1995</dc:creator>
      <dc:date>2023-09-19T15:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12252581#M20448</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14238831"&gt;@khantheking1995&lt;/a&gt;&amp;nbsp;.&amp;nbsp;You got an error on line 55 (old rule), which means you can't get the table column you want. It is necessary to check the correctness of the column name in lines 50 and 53 (new rule).&amp;nbsp;I also added a check that will help you navigate where you can't get a column.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ColomnName.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1268822i9778925FDA97CF02/image-size/large?v=v2&amp;amp;px=999" role="button" title="ColomnName.png" alt="ColomnName.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub main
	Dim oInvApp As Inventor.Application = ThisApplication
	Dim oAsmDoc As AssemblyDocument = oInvApp.ActiveDocument
	Dim oContentCenter As ContentCenter = oInvApp.ContentCenter
	Dim oUsParams As UserParameters = oAsmDoc.ComponentDefinition.Parameters.UserParameters
	
	Dim oUOfM As UnitsOfMeasure = oAsmDoc.UnitsOfMeasure
	Dim oCustom As PropertySet = oAsmDoc.PropertySets("Inventor User Defined Properties")
	Dim oDesignProps As PropertySet = oAsmDoc.PropertySets("Design Tracking Properties")
	
	Dim oWeigt_KG, oWeigt_Lbs, oStockNumb As Inventor.Property
	Try : oWeigt_KG = oCustom("Existing size Weight Kg")
	Catch : oWeigt_KG = oCustom.Add("", "Existing size Weight Kg") : End Try
	Try : oWeigt_Lbs = oCustom("Existing Part Weight Lbs")
	Catch : oWeigt_Lbs = oCustom.Add("", "Existing Part Weight Lbs") : End Try
	Try : oCustom("CAM-Weight Kg").Value = ""
	Catch : oCustom.Add("", "CAM-Weight Kg") : End Try
	Try : oCustom("CAM-Weight Lbs").Value = ""
	Catch : oCustom.Add("", "CAM-Weight Lbs") : End Try
	oStockNumb = oDesignProps("Stock Number")
	oWeigt_KG.Value = ""
	oWeigt_Lbs.Value = ""
	oStockNumb.Value = ""
	
	Dim oOcc As ComponentOccurrence
	oOcc = oInvApp.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, _
										"Select component...")
	If oOcc Is Nothing Then Exit Sub
		
	Dim oDef As PartComponentDefinition = oOcc.Definition
	Dim oCCPropSet As PropertySet
	Try : oCCPropSet = oDef.Document.PropertySets.Item("Content Library Component Properties")
	Catch : MessageBox.Show("The Part is not a CC part.") : End Try
	
	Dim dMass As Double = oOcc.MassProperties.Mass
	oWeigt_KG.Value = Round(dMass, 2)
	oWeigt_Lbs.Value = Round(oUOfM.ConvertUnits(dMass, UnitsTypeEnum.kKilogramMassUnits, _
												UnitsTypeEnum.kLbMassMassUnits), 2)
	oStockNumb.Value = oDef.Document.PropertySets("Design Tracking Properties") _
												("Stock Number").Value	
	
	Dim familyId As Inventor.Property = oCCPropSet.Item("FamilyId")
	Dim MemberId As String = oCCPropSet.Item("MemberId").Value
	Dim oFamily As ContentFamily
	oFamily = oContentCenter.GetContentObject("v3#" &amp;amp; familyId.Value &amp;amp; "#")
	Dim oContentNode As ContentTreeViewNode = oContentCenter.TreeViewTopNode
	Dim oLengthM As UserParameter
	Dim oRow As ContentTableRow = oFamily.TableRows.Item(MemberId)
	Dim iCount As Integer = oFamily.TableRows.Count - 1
	Dim iStockNumb As Integer = GetNumbColomn(oFamily.TableColumns, {"Stock Number" })
	If iStockNumb = -1 Then MessageBox.Show("Failed to get column - Stock Number", "Error!", _
											MessageBoxButtons.OK, MessageBoxIcon.Error) : Exit Sub
	Dim iWeight As Integer = GetNumbColomn(oFamily.TableColumns, {"Specific mass", "Mass"})
	If iWeight = -1 Then MessageBox.Show("Failed to get column - Mass", "Error!", _
											MessageBoxButtons.OK, MessageBoxIcon.Error) : Exit Sub
	Dim sStockNumb(iCount), sWeight(iCount) As String
	For i As Integer = 0 To iCount
		sStockNumb(i) = """" &amp;amp; oFamily.TableRows(i + 1)(iStockNumb).Value &amp;amp; """"
		sWeight(i) = """" &amp;amp; oFamily.TableRows(i + 1)(iWeight).Value &amp;amp; """"
	Next i
	Dim oColumn As ContentTableColumn = oFamily.TableColumns("STOCKNUMBER")
	Call SetParamList(oUsParams, "StockNumbBeamList", sStockNumb)
	Call SetParamList(oUsParams, "WeightKg", sWeight)
	Try : oLengthM = oUsParams("LengthM") : Catch
	oLengthM = oUsParams.AddByValue("LengthM", Nothing, _
										UnitsTypeEnum.kMeterLengthUnits) : End Try
	oLengthM.Value = oDef.Parameters.UserParameters("B_L").Value
End Sub

Private Function SetParamList(ByVal oUsParams As UserParameters,
								ByVal sNameParam As String,
								ByVal sList() As String)
	Dim oUsParam As UserParameter
	Try : oUsParam = oUsParams(sNameParam)
	Catch
		oUsParam = oUsParams.AddByValue(sNameParam, "", _
										UnitsTypeEnum.kTextUnits)
	End Try
	Call oUsParam.ExpressionList.ClearAll()
	oExpList = oUsParam.ExpressionList
	Call oExpList.SetExpressionList(sList, True, 1)
	If oExpList.AllowCustomValues Then oExpList.AllowCustomValues = False
	If oExpList.CustomOrder Then oExpList.CustomOrder = False
End Function

Private Function GetNumbColomn(ByVal oColomn As ContentTableColumns,
								ByVal sName() As String) As Integer
	For i As Integer = 1 To oColomn.Count
		If sName.Contains(oColomn(i).DisplayHeading) Then Return i
	Next i
	Return -1
End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 05:10:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12252581#M20448</guid>
      <dc:creator>Andrii_Humeniuk</dc:creator>
      <dc:date>2023-09-20T05:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12281089#M20449</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13518190"&gt;@Andrii_Humeniuk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I have resolved the issue to get the mass columns for all type for shapes by modifying the code as below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Old code&lt;/P&gt;&lt;P&gt;Dim iStockNumb As Integer = GetNumbColomn(oFamily.TableColumns, {"Stock Number" })&lt;BR /&gt;If iStockNumb = -1 Then MessageBox.Show("Failed to get column - Stock Number", "Error!", _&lt;BR /&gt;MessageBoxButtons.OK, MessageBoxIcon.Error) : Exit Sub&lt;BR /&gt;Dim iWeight As Integer = GetNumbColomn(oFamily.TableColumns, {"Specific mass", "Mass","Mass [Kg/mm]"})&lt;BR /&gt;If iWeight = -1 Then MessageBox.Show("Failed to get column - Mass", "Error!", _&lt;BR /&gt;MessageBoxButtons.OK, MessageBoxIcon.Error) : Exit Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Private Function GetNumbColomn(ByVal oColomn As ContentTableColumns,&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ByVal sName() As String) As Integer&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;For i As Integer = 1 To oColomn.Count&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If sName.Contains(oColomn(i).DisplayHeading) Then Return i&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Next i&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Return -1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;End Function&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have replaced it with following&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim iStockNumb As Integer = GetNumbColomn(oFamily.TableColumns, {"Stock Number" })&lt;BR /&gt;If iStockNumb = -1 Then&lt;BR /&gt;MessageBox.Show("Failed to get column - Stock Number", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;Dim iWeight As Integer = GetNumbColomn(oFamily.TableColumns, {"Specific mass", "Mass","Mass [Kg/mm]"})&lt;BR /&gt;If iWeight = -1 Then&lt;BR /&gt;MessageBox.Show("Failed to get column - Mass", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Private Function GetNumbColomn(ByVal oColomn As ContentTableColumns, ByVal sName() As String) As Integer&lt;BR /&gt;For i As Integer = 1 To oColomn.Count&lt;BR /&gt;If sName.Any(Function(name) oColomn(i).DisplayHeading.ToLower().Contains(name.ToLower())) Then&lt;BR /&gt;Return i&lt;BR /&gt;End If&lt;BR /&gt;Next i&lt;BR /&gt;Return -1&lt;BR /&gt;End Function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now it is pulling all type of mass data from all table but the weight calculation is coming wrongly as in below image, can you help to resolve it.(the issue is there from old code too)&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="khantheking1995_0-1696313311945.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1274426iA8421DDDE3BEAF05/image-size/medium?v=v2&amp;amp;px=400" role="button" title="khantheking1995_0-1696313311945.png" alt="khantheking1995_0-1696313311945.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kindly give me a solution to calculate correct weight for replaced size&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 06:09:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12281089#M20449</guid>
      <dc:creator>khantheking1995</dc:creator>
      <dc:date>2023-10-03T06:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need a Rule for changing component priority to Part priority</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12286269#M20450</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13518190"&gt;@Andrii_Humeniuk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any update on the above query?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 09:09:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/need-a-rule-for-changing-component-priority-to-part-priority/m-p/12286269#M20450</guid>
      <dc:creator>khantheking1995</dc:creator>
      <dc:date>2023-10-05T09:09:42Z</dc:date>
    </item>
  </channel>
</rss>

