<?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: Can I change all of Filename as Part number throughout all of class in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-change-all-of-filename-as-part-number-throughout-all-of/m-p/11963265#M152582</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I'm trying to change Filename to part number&lt;/P&gt;&lt;P&gt;for example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;before running rule&lt;/P&gt;&lt;P&gt;Filename : part43&lt;/P&gt;&lt;P&gt;Partnumber : Pr-002&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;after running rule&lt;/P&gt;&lt;P&gt;Filename : Pr-002&lt;/P&gt;&lt;P&gt;Partnumber : Pr-002&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 May 2023 00:25:06 GMT</pubDate>
    <dc:creator>ssiem12</dc:creator>
    <dc:date>2023-05-15T00:25:06Z</dc:date>
    <item>
      <title>Can I change all of Filename as Part number throughout all of class</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-change-all-of-filename-as-part-number-throughout-all-of/m-p/11962429#M152570</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I'm using this rule to change Partnumber following rules&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Class ThisRule
	Dim As_count As Integer = 0
	Dim Pr_count As Integer = 0
	Dim Wl_count As Integer = 0
	Dim St_count As Integer = 0
	Dim Pt_count As Integer = 0
	Dim Rf_count As Integer = 0
	Sub Main
		ThisApplication.CommandManager.ControlDefinitions.Item("AppUpdateMassPropertiesCmd").Execute
		Dim oADoc As AssemblyDocument = ThisDoc.Document
		Dim oBOM As BOM = oADoc.ComponentDefinition.BOM
		'BOM Export 후 xml파일과 아래 경로를 일치할것
		oBOM.ImportBOMCustomization("D:\UC BOM.xml")
		oBOM.StructuredViewEnabled = True
		oBOM.StructuredViewFirstLevelOnly = False
		oBOM.SetPartNumberMergeSettings(False)
		Dim oBOMView As BOMView = oBOM.BOMViews.Item("구조적")
		oBOMView.Sort("질량", False, "체적", False)
		oBOMView.Renumber()
		WritePartMumb(oBOMView.BOMRows)
		oBOMView.Sort("Part Number", True)
		oBOMView.Renumber()
	End Sub
	
	Private Sub WritePartMumb(ByVal oBOMRows As BOMRowsEnumerator)
		For Each oRow As BOMRow In oBOMRows
			If Not IsStandardContentCenterRow(oRow) Then
				Dim partnumber As String = PartNumberGenerator(oRow)
				If partnumber &amp;lt;&amp;gt; "" Then
					oRow.ComponentDefinitions(1).Document.PropertySets(3)(2).Value = partnumber
				End If
			End If
			If oRow.ChildRows IsNot Nothing Then
				WritePartMumb(oRow.ChildRows)
			End If
		Next		
	End Sub

	Private Function PartNumberGenerator(ByVal oRow As BOMRow) As String
		Select Case oRow.BOMStructure
			Case BOMStructureEnum.kNormalBOMStructure
				Dim rowDocType = GetDocumentType(oRow)
				If rowDocType = DocumentTypeEnum.kAssemblyDocumentObject Then
					As_count = As_count + 1
					Return "As-" &amp;amp; As_count.ToString("000")
				ElseIf rowDocType = DocumentTypeEnum.kPartDocumentObject Then
					Pr_count = Pr_count + 1
					Return "Pr-" &amp;amp; Pr_count.ToString("000")
				Else 
					Return ""
				End If
			Case BOMStructureEnum.kInseparableBOMStructure
				Wl_count = Wl_count + 1
				Return "Wl-" &amp;amp; Wl_count.ToString("000")
			Case BOMStructureEnum.kPurchasedBOMStructure
				St_count = St_count + 1
				Return "St-" &amp;amp; St_count.ToString("000")
			Case BOMStructureEnum.kPhantomBOMStructure
				Pt_count = Pt_count + 1
				Return "Pt-" &amp;amp; Pt_count.ToString("000")
			Case BOMStructureEnum.kReferenceBOMStructure
				Rf_count = Rf_count + 1
				Return "Rf-" &amp;amp; Rf_count.ToString("000")
		End Select
		Return "" ' default case if we can't get a part number
	End Function
	
	Private Function IsStandardContentCenterRow(ByVal oRow As BOMRow) As Boolean
		For Each compDef As ComponentDefinition In oRow.ComponentDefinitions
			Dim partCompDef As PartComponentDefinition = TryCast(compDef, PartComponentDefinition)
			If partCompDef IsNot Nothing AndAlso partCompDef.IsContentMember Then
				Return True
			End If
		Next 
		Return False
	End Function
	
	Private Function GetDocumentType(ByVal oRow As BOMRow) As DocumentTypeEnum
		For Each compDef As ComponentDefinition In oRow.ComponentDefinitions
			Dim partCompDef As PartComponentDefinition = TryCast(compDef, PartComponentDefinition)
			If partCompDef IsNot Nothing Then
				Return DocumentTypeEnum.kPartDocumentObject
			End If
			Dim assemCompDef As AssemblyComponentDefinition = TryCast(compDef, AssemblyComponentDefinition)
			If assemCompDef IsNot Nothing Then
				Return DocumentTypeEnum.kAssemblyDocumentObject
			End If
		Next 
		Return DocumentTypeEnum.kUnknownDocumentObject
	End Function
End Class&lt;/LI-CODE&gt;&lt;P&gt;I found i use too much time to find what part has part number i seek when I draft it respectively&lt;/P&gt;&lt;P&gt;So If I can change filename to part number I can search on search engine easily&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it seems have a trouble with files have same part number&lt;/P&gt;&lt;P&gt;can it be solved by adding number like (1), (2), (3)... on filename if it has file with same name on storage location&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It will be very thanksful if you help me&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 08:18:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-change-all-of-filename-as-part-number-throughout-all-of/m-p/11962429#M152570</guid>
      <dc:creator>ssiem12</dc:creator>
      <dc:date>2023-05-14T08:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Can I change all of Filename as Part number throughout all of class</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-change-all-of-filename-as-part-number-throughout-all-of/m-p/11963036#M152576</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10819826"&gt;@ssiem12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you trying to change the part number to filename or filename to part number?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 19:53:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-change-all-of-filename-as-part-number-throughout-all-of/m-p/11963036#M152576</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-05-14T19:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can I change all of Filename as Part number throughout all of class</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-change-all-of-filename-as-part-number-throughout-all-of/m-p/11963265#M152582</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I'm trying to change Filename to part number&lt;/P&gt;&lt;P&gt;for example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;before running rule&lt;/P&gt;&lt;P&gt;Filename : part43&lt;/P&gt;&lt;P&gt;Partnumber : Pr-002&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;after running rule&lt;/P&gt;&lt;P&gt;Filename : Pr-002&lt;/P&gt;&lt;P&gt;Partnumber : Pr-002&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 00:25:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-change-all-of-filename-as-part-number-throughout-all-of/m-p/11963265#M152582</guid>
      <dc:creator>ssiem12</dc:creator>
      <dc:date>2023-05-15T00:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can I change all of Filename as Part number throughout all of class</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-change-all-of-filename-as-part-number-throughout-all-of/m-p/11964783#M152614</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10819826"&gt;@ssiem12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This task is alot more difficult when your working with assemblies. Because the assembly contains the fullfilepath to the part files it contains. You will need to save as each document then swap the reference file links. This is how ilogic copy design is working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See this post here on how this is achieved.&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9886185#M118370" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/help-regarding-renaming-assembly-file-and-a-part-file-in-it-and/m-p/9886185#M118370&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 14:39:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-change-all-of-filename-as-part-number-throughout-all-of/m-p/11964783#M152614</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-05-15T14:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can I change all of Filename as Part number throughout all of class</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-change-all-of-filename-as-part-number-throughout-all-of/m-p/12495782#M162470</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10819826"&gt;@ssiem12&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello, after reading your question i think we have a solution for you in the form of an app. We are launching a Numbering app this week. I was wondering if you would be interested in testing it? The app is capable of renaming a lot of properties, numbering parts and assemblies and many more things.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can send me a PM if interested!&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2024 10:18:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-change-all-of-filename-as-part-number-throughout-all-of/m-p/12495782#M162470</guid>
      <dc:creator>Support_Charlies3DT</dc:creator>
      <dc:date>2024-01-14T10:18:55Z</dc:date>
    </item>
  </channel>
</rss>

