<?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 Convert iParts to normal parts in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/convert-iparts-to-normal-parts/m-p/10532134#M127420</link>
    <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6197532"&gt;@paulo.correia98ZAP&lt;/a&gt;.&amp;nbsp; This is basically performing the same actions as &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt; 's code, but lets you choose a directory/folder to process, instead of selecting multiple specific files.&amp;nbsp; It will then process all Part documents in that folder.&amp;nbsp; There is also a simple setting near the end of the oFiles() definition line, where you can change this from just processing the top/main directory, to then process all sub-folders if you wanted, but it is currently set to only process the top selected directory.&amp;nbsp; It uses a regular 'Open File' dialog, that is set up to only select a folder (glorified folder selection dialog.)&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	Dim oTargetFolder As String = ChooseFolder
	Dim oFileNames As New List(Of String)
	Dim oFilter As String = "*.ipt"
	Dim oFiles() As String = System.IO.Directory.GetFiles(oTargetFolder, oFilter, IO.SearchOption.TopDirectoryOnly)
	oFileNames.AddRange(oFiles)
	If oFileNames.Count = 0 Then
		MsgBox("No files match the search criteria in the selected folder. Exiting.", , "")
		Exit Sub
	End If
	
	For Each oFile As String In oFiles
		Dim oPDoc As PartDocument = ThisApplication.Documents.Open(oFile, False)
		If oPDoc.ComponentDefinition.IsiPartMember Then
			oPDoc.ComponentDefinition.iPartMember.BreakLinkToFactory
			oPDoc.Save2(False)
			oPDoc.Close(True)
		Else
			'MsgBox(oFile &amp;amp; vbCrLf &amp;amp; "Is not an iPart.",,"")
			oPDoc.Close(True)
		End If
	Next
End Sub

Private Function ChooseFolder() As String
	Dim ThisApplication As Inventor.Application = GetObject(,"Inventor.Application")
	Dim oFolder As String = ""
	Dim oPlaceHolder As String = "PlaceHolderText"
	Dim oDirSepChar As Char = System.IO.Path.DirectorySeparatorChar
	Dim oOpenDlg As New System.Windows.Forms.OpenFileDialog
	oOpenDlg.Title = "Select A Folder."
	oOpenDlg.InitialDirectory = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
	oOpenDlg.Filter = ""
	oOpenDlg.Multiselect = False
	oOpenDlg.RestoreDirectory = False
	oOpenDlg.CheckFileExists = False
	oOpenDlg.CheckPathExists = True
	oOpenDlg.ValidateNames = False
	oOpenDlg.FileName = oPlaceHolder
	oOpenDlg.Filter = ""
	oOpenDlg.AddExtension = False
	oOpenDlg.DefaultExt = ""
	Dim oResult = oOpenDlg.ShowDialog
	If oResult = vbOK Then
		If oOpenDlg.FileName &amp;lt;&amp;gt; vbNullString Then
			oFolder = oOpenDlg.FileName
		Else
			MsgBox("No file was selected. Exiting.", vbOKOnly + vbExclamation, "FILE NOT SELECTED")
			Exit Function
		End If
	ElseIf oResult = vbCancel Then
		MsgBox("The dialog was Canceled. Exiting.", vbOKOnly + vbInformation, "CANCELED")
		Exit Function
	End If
	'count the number of characters from the end, until it finds the directory separator character
	Dim oPos As Integer = InStr(StrReverse(oFolder), oDirSepChar)
	'check if the directory separator character was at the end, if so, perfect, if not, eliminate end text
	If oPos &amp;lt;&amp;gt; 1 Then
		'the directory seperator character was not at the end, so...
		oFolder = Strings.Left(oFolder, InStrRev(oFolder, oDirSepChar))
	End If
	Return oFolder
End Function&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 09 Aug 2021 19:00:41 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2021-08-09T19:00:41Z</dc:date>
    <item>
      <title>Convert iParts to normal parts</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/convert-iparts-to-normal-parts/m-p/10531520#M127412</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to transform a few hundreds of iParts (childs) into standard parts.&lt;/P&gt;&lt;P&gt;Is there any way of making this process automatic or semi automatic?&lt;/P&gt;&lt;P&gt;(i'm not keen in open each file to delete the table...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 15:16:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/convert-iparts-to-normal-parts/m-p/10531520#M127412</guid>
      <dc:creator>paulo.correia98ZAP</dc:creator>
      <dc:date>2021-08-09T15:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Convert iParts to normal parts</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/convert-iparts-to-normal-parts/m-p/10531993#M127417</link>
      <description>&lt;P&gt;With this you can in ilogic:&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;partDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt;  &lt;SPAN&gt;partDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;IsiPartMember&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
     &lt;SPAN&gt;partDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;iPartMember&lt;/SPAN&gt;.&lt;SPAN&gt;BreakLinkToFactory&lt;/SPAN&gt;
    &lt;SPAN&gt;Return&lt;/SPAN&gt; &lt;SPAN&gt;'do nothing&lt;/SPAN&gt;
&lt;SPAN&gt;Else&lt;/SPAN&gt;
&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"This is NOT an iPart"&lt;/SPAN&gt;, &lt;SPAN&gt;"Title"&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Aug 2021 18:05:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/convert-iparts-to-normal-parts/m-p/10531993#M127417</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-08-09T18:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Convert iParts to normal parts</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/convert-iparts-to-normal-parts/m-p/10532006#M127418</link>
      <description>&lt;P&gt;Or with a selection via a dialog:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;d&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;FileDialog&lt;/SPAN&gt;
 &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CreateFileDialog&lt;/SPAN&gt;(&lt;SPAN&gt;d&lt;/SPAN&gt;)
&lt;SPAN&gt;d&lt;/SPAN&gt;.&lt;SPAN&gt;MultiSelectEnabled&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;
&lt;SPAN&gt;d&lt;/SPAN&gt;.&lt;SPAN&gt;Filter&lt;/SPAN&gt; = &lt;SPAN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t;partDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;IsiPartMember&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	     &lt;SPAN&gt;partDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;iPartMember&lt;/SPAN&gt;.&lt;SPAN&gt;BreakLinkToFactory&lt;/SPAN&gt;
	    &lt;SPAN&gt;Return&lt;/SPAN&gt; &lt;SPAN&gt;'do nothing&lt;/SPAN&gt;
	&lt;SPAN&gt;Else&lt;/SPAN&gt;
	&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"This is NOT an iPart"&lt;/SPAN&gt;, &lt;SPAN&gt;"Title"&lt;/SPAN&gt;)
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	&lt;SPAN&gt;partDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Save&lt;/SPAN&gt;
	&lt;SPAN&gt;partDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt; 

&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Aug 2021 18:09:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/convert-iparts-to-normal-parts/m-p/10532006#M127418</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-08-09T18:09:49Z</dc:date>
    </item>
    <item>
      <title>Convert iParts to normal parts</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/convert-iparts-to-normal-parts/m-p/10532134#M127420</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6197532"&gt;@paulo.correia98ZAP&lt;/a&gt;.&amp;nbsp; This is basically performing the same actions as &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt; 's code, but lets you choose a directory/folder to process, instead of selecting multiple specific files.&amp;nbsp; It will then process all Part documents in that folder.&amp;nbsp; There is also a simple setting near the end of the oFiles() definition line, where you can change this from just processing the top/main directory, to then process all sub-folders if you wanted, but it is currently set to only process the top selected directory.&amp;nbsp; It uses a regular 'Open File' dialog, that is set up to only select a folder (glorified folder selection dialog.)&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	Dim oTargetFolder As String = ChooseFolder
	Dim oFileNames As New List(Of String)
	Dim oFilter As String = "*.ipt"
	Dim oFiles() As String = System.IO.Directory.GetFiles(oTargetFolder, oFilter, IO.SearchOption.TopDirectoryOnly)
	oFileNames.AddRange(oFiles)
	If oFileNames.Count = 0 Then
		MsgBox("No files match the search criteria in the selected folder. Exiting.", , "")
		Exit Sub
	End If
	
	For Each oFile As String In oFiles
		Dim oPDoc As PartDocument = ThisApplication.Documents.Open(oFile, False)
		If oPDoc.ComponentDefinition.IsiPartMember Then
			oPDoc.ComponentDefinition.iPartMember.BreakLinkToFactory
			oPDoc.Save2(False)
			oPDoc.Close(True)
		Else
			'MsgBox(oFile &amp;amp; vbCrLf &amp;amp; "Is not an iPart.",,"")
			oPDoc.Close(True)
		End If
	Next
End Sub

Private Function ChooseFolder() As String
	Dim ThisApplication As Inventor.Application = GetObject(,"Inventor.Application")
	Dim oFolder As String = ""
	Dim oPlaceHolder As String = "PlaceHolderText"
	Dim oDirSepChar As Char = System.IO.Path.DirectorySeparatorChar
	Dim oOpenDlg As New System.Windows.Forms.OpenFileDialog
	oOpenDlg.Title = "Select A Folder."
	oOpenDlg.InitialDirectory = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
	oOpenDlg.Filter = ""
	oOpenDlg.Multiselect = False
	oOpenDlg.RestoreDirectory = False
	oOpenDlg.CheckFileExists = False
	oOpenDlg.CheckPathExists = True
	oOpenDlg.ValidateNames = False
	oOpenDlg.FileName = oPlaceHolder
	oOpenDlg.Filter = ""
	oOpenDlg.AddExtension = False
	oOpenDlg.DefaultExt = ""
	Dim oResult = oOpenDlg.ShowDialog
	If oResult = vbOK Then
		If oOpenDlg.FileName &amp;lt;&amp;gt; vbNullString Then
			oFolder = oOpenDlg.FileName
		Else
			MsgBox("No file was selected. Exiting.", vbOKOnly + vbExclamation, "FILE NOT SELECTED")
			Exit Function
		End If
	ElseIf oResult = vbCancel Then
		MsgBox("The dialog was Canceled. Exiting.", vbOKOnly + vbInformation, "CANCELED")
		Exit Function
	End If
	'count the number of characters from the end, until it finds the directory separator character
	Dim oPos As Integer = InStr(StrReverse(oFolder), oDirSepChar)
	'check if the directory separator character was at the end, if so, perfect, if not, eliminate end text
	If oPos &amp;lt;&amp;gt; 1 Then
		'the directory seperator character was not at the end, so...
		oFolder = Strings.Left(oFolder, InStrRev(oFolder, oDirSepChar))
	End If
	Return oFolder
End Function&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Aug 2021 19:00:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/convert-iparts-to-normal-parts/m-p/10532134#M127420</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-08-09T19:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Convert iParts to normal parts</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/convert-iparts-to-normal-parts/m-p/10533291#M127448</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;P&gt;This save me hours and the life is too short to spend in unproductive tasks &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;&lt;P&gt;You guys are stars.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paulo&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 07:37:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/convert-iparts-to-normal-parts/m-p/10533291#M127448</guid>
      <dc:creator>paulo.correia98ZAP</dc:creator>
      <dc:date>2021-08-10T07:37:33Z</dc:date>
    </item>
  </channel>
</rss>

