<?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: iPart indivdual drawings in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-indivdual-drawings/m-p/8337638#M90142</link>
    <description>&lt;P&gt;The best thing you can do is share what you have code-wise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as switching view-referenced models, the best answer I can find here is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-customization/how-to-replace-model-reference-in-idw-file/m-p/7206777/highlight/true#M73301" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-customization/how-to-replace-model-reference-in-idw-file/m-p/7206777/highlight/true#M73301&lt;/A&gt; by&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2511355"&gt;@MechMachineMan&lt;/a&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: &lt;A href="https://github.com/AlexFielder/iLogic/blob/master/Modelling/Replace%20references%20from%20external%20list.iLogicVb" target="_blank"&gt;This rule&lt;/A&gt; of mine (should) also do this:&lt;/P&gt;&lt;PRE&gt;AddReference "System.Core"
AddReference "System.Linq"
Imports System.LINQ
Imports System.Collections.Generic
'doesn't run in iLogic - WHAT A SURPRISE!?!?!?
Private Sub Main()
            Dim sw As New Stopwatch()
            sw.Start()
            Dim rootFolder As String = IO.Path.GetDirectoryName(ThisApplication.ActiveDocument.FullFileName)
            Dim selectedfile As String = String.Empty
            Dim filedlg As Inventor.FileDialog = Nothing
            ThisApplication.CreateFileDialog(filedlg)
            filedlg.Filter = "txt files (*.txt)|*.txt|Other files (*.*)|*.*"
            filedlg.InitialDirectory = rootFolder
            filedlg.CancelError = True
            filedlg.MultiSelectEnabled = False
            Try
                filedlg.ShowOpen()
                selectedfile = filedlg.FileName
            Catch ex As Exception
                Return
            End Try

            Dim filelisttoreplace As New List(Of String)
            Dim filelisttosaveas As New List(Of String)
            Dim filereader As IO.StreamReader = Nothing
            filereader = My.Computer.FileSystem.OpenTextFileReader(selectedfile)
            Do While filereader.Peek &amp;gt;= 0
                filelisttoreplace.Add(filereader.ReadLine)
            Loop

            For Each filename As String In filelisttoreplace
                filelisttosaveas.Add(IO.Path.GetDirectoryName(filename) &amp;amp; "\" &amp;amp;
                                     IO.Path.GetFileNameWithoutExtension(filename) &amp;amp; ".dwg")

            Next

            If TypeOf ThisApplication.ActiveDocument Is DrawingDocument Then
                For Each dwgfile As String In filelisttosaveas
                    Dim dwgdoc As DrawingDocument = ThisApplication.ActiveDocument
                    dwgdoc.SaveAsInventorDWG(dwgfile, False)
'                    Dim filedescr As FileDescriptor = dwgdoc.ReferencedFileDescriptors(1)
'                    Dim filetoreplace As String = (
'                        From f As String In filelisttoreplace
'                        Where IO.Path.GetFileNameWithoutExtension(f) = IO.Path.GetFileNameWithoutExtension(dwgdoc.FullFileName)).FirstOrDefault()
'                    If Not filetoreplace Is Nothing Then
'                        filedescr.ReplaceReference(filetoreplace)
'                        dwgdoc.Save()
'                    End If
                Next
            End If
            sw.Stop()
            MessageBox.Show("Operation took: " &amp;amp; sw.Elapsed.Seconds.ToString() &amp;amp; " seconds to complete.")
        End Sub&lt;/PRE&gt;&lt;P&gt;&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Oct 2018 13:39:06 GMT</pubDate>
    <dc:creator>AlexFielder</dc:creator>
    <dc:date>2018-10-16T13:39:06Z</dc:date>
    <item>
      <title>iPart indivdual drawings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-indivdual-drawings/m-p/8322328#M89856</link>
      <description>&lt;P&gt;I have an iPart factory with 612 different plates. I am using the iPart to control the length, width, and height of each in the table. What would the workflow be to quickly create an individual drawing per part? I want a material block on the drawing and LxWxH dims. I was recommended to come to the customization forum for an answer to this. What sort of rules or iLogic would I need to create this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank,&lt;/P&gt;&lt;P&gt;Zach L&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 13:05:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-indivdual-drawings/m-p/8322328#M89856</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-09T13:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: iPart indivdual drawings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-indivdual-drawings/m-p/8322649#M89869</link>
      <description>&lt;P&gt;You would need to step through the ipart table like &lt;A href="https://github.com/AlexFielder/iLogic/blob/master/Modelling/CheckiPartForErrors.iLogicVb" target="_blank"&gt;this rule&lt;/A&gt;&amp;nbsp;which checks whether Inventor can compute each row in the iPart/iAssembly table - &lt;STRONG&gt;FWIW I'm not sure I ever properly test the iAssembly section of this rule! Buyer-beware&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub Main()
CheckiPartTableForErrors()
End Sub
Sub CheckiPartTableForErrors()
    Dim oErrorManager As ErrorManager = ThisApplication.ErrorManager

    If TypeOf (ThisApplication.activedocument) Is partdocument Then
        Dim oDoc As PartDocument = ThisApplication.ActiveDocument
        Dim oiPart As iPartFactory = oDoc.ComponentDefinition.iPartFactory
        Dim oTop As BrowserNode = oDoc.BrowserPanes("Model").TopNode
        Dim bHasErrorOrWarning As Boolean
        Dim i As Integer
        InventorVb.DocumentUpdate()
        ThisApplication.SilentOperation = True
        For i = 1 To oiPart.TableRows.Count 'use first 10 rows only for debugging purposes!
            ' Highlight the 3rd iPart table row which has invalid data
            oTop.BrowserNodes("Table").BrowserNodes.Item(i).DoSelect

            ' Activate the iPart table row
            Dim oCommand As ControlDefinition = ThisApplication.CommandManager.ControlDefinitions("PartComputeiPartRowCtxCmd")
            oCommand.Execute

            ThisApplication.SilentOperation = False
            ThisApplication.CommandManager.ControlDefinitions.Item("AppZoomallCmd").Execute
            If oErrorManager.HasErrors Or oErrorManager.HasWarnings Then
                MessageBox.Show(oErrorManager.LastMessage, "Title")
            End If
        Next i
        MessageBox.Show("No errors shown = None found!", "Title")
    ElseIf TypeOf (ThisApplication.activedocument) Is assemblydocument Then
        Dim odoc As assemblydocument = ThisApplication.activedocument
        Dim iAssy As iAssemblyFactory = odoc.componentdefinition.iassemblyfactory
        Dim oTop As BrowserNode = odoc.BrowserPanes("Model").TopNode
        Dim bHasErrorOrWarning As Boolean
        Dim i As Integer
        InventorVb.DocumentUpdate()
        ThisApplication.SilentOperation = True
        For rowIndex = 1 To iAssy.tablerows.count
            oTop.BrowserNodes("Table").BrowserNodes.Item(i).DoSelect
            Dim oCommand As ControlDefinition = ThisApplication.CommandManager.ControlDefinitions("PartComputeiPartRowCtxCmd")
            oCommand.Execute
            ThisApplication.SilentOperation = False
            ThisApplication.CommandManager.ControlDefinitions.Item("AppZoomallCmd").Execute
            If oErrorManager.HasErrors Or oErrorManager.HasWarnings Then
                MessageBox.Show(oErrorManager.LastMessage, "Title")
            End If

        Next
    End If
End Sub&lt;/PRE&gt;&lt;P&gt;And working with the above you could (in theory) populate a new drawing template with a view that contains the currently active table row configuration.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 14:53:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-indivdual-drawings/m-p/8322649#M89869</guid>
      <dc:creator>AlexFielder</dc:creator>
      <dc:date>2018-10-09T14:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: iPart indivdual drawings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-indivdual-drawings/m-p/8327400#M89962</link>
      <description>&lt;P&gt;How would you go about changing the model references in iLogic? I am pretty new to using iLogic. I also have future projects that will be able to use the same iLogic it will just be a different iPart.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 12:07:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-indivdual-drawings/m-p/8327400#M89962</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-11T12:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: iPart indivdual drawings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-indivdual-drawings/m-p/8337622#M90140</link>
      <description>&lt;P&gt;I cant find a way to make the information in your code work with what i am trying to do. I am trying to change the model reference on a drawing. What i am trying to accomplish is step thru each member of the iPart on a drawing and save as part# then export it to a PDF. i already have the code for PDF.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 13:32:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-indivdual-drawings/m-p/8337622#M90140</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-16T13:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: iPart indivdual drawings</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-indivdual-drawings/m-p/8337638#M90142</link>
      <description>&lt;P&gt;The best thing you can do is share what you have code-wise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as switching view-referenced models, the best answer I can find here is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-customization/how-to-replace-model-reference-in-idw-file/m-p/7206777/highlight/true#M73301" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-customization/how-to-replace-model-reference-in-idw-file/m-p/7206777/highlight/true#M73301&lt;/A&gt; by&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2511355"&gt;@MechMachineMan&lt;/a&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: &lt;A href="https://github.com/AlexFielder/iLogic/blob/master/Modelling/Replace%20references%20from%20external%20list.iLogicVb" target="_blank"&gt;This rule&lt;/A&gt; of mine (should) also do this:&lt;/P&gt;&lt;PRE&gt;AddReference "System.Core"
AddReference "System.Linq"
Imports System.LINQ
Imports System.Collections.Generic
'doesn't run in iLogic - WHAT A SURPRISE!?!?!?
Private Sub Main()
            Dim sw As New Stopwatch()
            sw.Start()
            Dim rootFolder As String = IO.Path.GetDirectoryName(ThisApplication.ActiveDocument.FullFileName)
            Dim selectedfile As String = String.Empty
            Dim filedlg As Inventor.FileDialog = Nothing
            ThisApplication.CreateFileDialog(filedlg)
            filedlg.Filter = "txt files (*.txt)|*.txt|Other files (*.*)|*.*"
            filedlg.InitialDirectory = rootFolder
            filedlg.CancelError = True
            filedlg.MultiSelectEnabled = False
            Try
                filedlg.ShowOpen()
                selectedfile = filedlg.FileName
            Catch ex As Exception
                Return
            End Try

            Dim filelisttoreplace As New List(Of String)
            Dim filelisttosaveas As New List(Of String)
            Dim filereader As IO.StreamReader = Nothing
            filereader = My.Computer.FileSystem.OpenTextFileReader(selectedfile)
            Do While filereader.Peek &amp;gt;= 0
                filelisttoreplace.Add(filereader.ReadLine)
            Loop

            For Each filename As String In filelisttoreplace
                filelisttosaveas.Add(IO.Path.GetDirectoryName(filename) &amp;amp; "\" &amp;amp;
                                     IO.Path.GetFileNameWithoutExtension(filename) &amp;amp; ".dwg")

            Next

            If TypeOf ThisApplication.ActiveDocument Is DrawingDocument Then
                For Each dwgfile As String In filelisttosaveas
                    Dim dwgdoc As DrawingDocument = ThisApplication.ActiveDocument
                    dwgdoc.SaveAsInventorDWG(dwgfile, False)
'                    Dim filedescr As FileDescriptor = dwgdoc.ReferencedFileDescriptors(1)
'                    Dim filetoreplace As String = (
'                        From f As String In filelisttoreplace
'                        Where IO.Path.GetFileNameWithoutExtension(f) = IO.Path.GetFileNameWithoutExtension(dwgdoc.FullFileName)).FirstOrDefault()
'                    If Not filetoreplace Is Nothing Then
'                        filedescr.ReplaceReference(filetoreplace)
'                        dwgdoc.Save()
'                    End If
                Next
            End If
            sw.Stop()
            MessageBox.Show("Operation took: " &amp;amp; sw.Elapsed.Seconds.ToString() &amp;amp; " seconds to complete.")
        End Sub&lt;/PRE&gt;&lt;P&gt;&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 13:39:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-indivdual-drawings/m-p/8337638#M90142</guid>
      <dc:creator>AlexFielder</dc:creator>
      <dc:date>2018-10-16T13:39:06Z</dc:date>
    </item>
  </channel>
</rss>

