<?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 use iLogic to create a new drawing using pages from multiple pre-existing drawings. in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-use-ilogic-to-create-a-new-drawing-using-pages-from/m-p/12725765#M166428</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2625475"&gt;@mmurray1629&lt;/a&gt;.&amp;nbsp; What you described sounds pretty complicated, so my 'short' answer would be maybe.&amp;nbsp; There is an Inventor API method for copying a '&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-Sheet" target="_blank" rel="noopener"&gt;Sheet&lt;/A&gt;' from one drawing to another drawing (&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Sheet_CopyTo" target="_blank" rel="noopener"&gt;Sheet.CopyTo&lt;/A&gt;).&amp;nbsp; However, a whole sheet does not have its own 'ModelState', so I suspect you mean that each sheet in your drawing is for one ModelState version of a single model file, and if so, you would have to check a property of one of the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-DrawingView" target="_blank" rel="noopener"&gt;DrawingView&lt;/A&gt; objects on each sheet (&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DrawingView_ActiveModelState" target="_blank" rel="noopener"&gt;DrawingView.ActiveModelState&lt;/A&gt;).&amp;nbsp; That is a ReadOnly property with a String type value, so if you need to 'set' its value, you have to use the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DrawingView_SetActiveModelState" target="_blank" rel="noopener"&gt;DrawingView.SetActiveModelState&lt;/A&gt;&amp;nbsp;method.&amp;nbsp; Knowing about these should help with some of the 'how to get started' stuff.&amp;nbsp; But since I do not do much copying sheets from one large assembly drawing to another by code where I work, I can not be 100% sure if everything else you are wanting to accomplish will work out smoothly.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Apr 2024 18:14:35 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2024-04-22T18:14:35Z</dc:date>
    <item>
      <title>Can I use iLogic to create a new drawing using pages from multiple pre-existing drawings.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-use-ilogic-to-create-a-new-drawing-using-pages-from/m-p/12722921#M166382</link>
      <description>&lt;P&gt;I currently have a parent assembly made of 10 children sub-assemblies, each of which has 2-5 possible model state configurations. &amp;nbsp;I have drawings already made for all of the model states, but I’m looking for a more efficient way to generate the 10 page drawing. &amp;nbsp;I was hoping to create an iLogic program that checks to see which model states are active and then generates a dwg by copying the corresponding page to that model state into a new file. &amp;nbsp;Does this sound possible? &amp;nbsp;I’m not sure where to start.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Apr 2024 06:36:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-use-ilogic-to-create-a-new-drawing-using-pages-from/m-p/12722921#M166382</guid>
      <dc:creator>mmurray1629</dc:creator>
      <dc:date>2024-04-21T06:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use iLogic to create a new drawing using pages from multiple pre-existing drawings.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-use-ilogic-to-create-a-new-drawing-using-pages-from/m-p/12725765#M166428</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2625475"&gt;@mmurray1629&lt;/a&gt;.&amp;nbsp; What you described sounds pretty complicated, so my 'short' answer would be maybe.&amp;nbsp; There is an Inventor API method for copying a '&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-Sheet" target="_blank" rel="noopener"&gt;Sheet&lt;/A&gt;' from one drawing to another drawing (&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Sheet_CopyTo" target="_blank" rel="noopener"&gt;Sheet.CopyTo&lt;/A&gt;).&amp;nbsp; However, a whole sheet does not have its own 'ModelState', so I suspect you mean that each sheet in your drawing is for one ModelState version of a single model file, and if so, you would have to check a property of one of the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-DrawingView" target="_blank" rel="noopener"&gt;DrawingView&lt;/A&gt; objects on each sheet (&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DrawingView_ActiveModelState" target="_blank" rel="noopener"&gt;DrawingView.ActiveModelState&lt;/A&gt;).&amp;nbsp; That is a ReadOnly property with a String type value, so if you need to 'set' its value, you have to use the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DrawingView_SetActiveModelState" target="_blank" rel="noopener"&gt;DrawingView.SetActiveModelState&lt;/A&gt;&amp;nbsp;method.&amp;nbsp; Knowing about these should help with some of the 'how to get started' stuff.&amp;nbsp; But since I do not do much copying sheets from one large assembly drawing to another by code where I work, I can not be 100% sure if everything else you are wanting to accomplish will work out smoothly.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 18:14:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-use-ilogic-to-create-a-new-drawing-using-pages-from/m-p/12725765#M166428</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-04-22T18:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use iLogic to create a new drawing using pages from multiple pre-existing drawings.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-use-ilogic-to-create-a-new-drawing-using-pages-from/m-p/13045750#M172221</link>
      <description>&lt;P&gt;I was able to achieve this with two separate codes - one on my model which opens drawings based on the name of the model state (model state name must match drawing name), then once all the sheets are open, I have a copy sheets to drawing code.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;For those interested in functionality similar to this, here is my "Open Drawings" code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Imports System.IO&lt;BR /&gt;Imports System.Windows.Forms&lt;/P&gt;&lt;P&gt;Sub Main()&lt;BR /&gt;Try&lt;BR /&gt;' Define the base folder path&lt;BR /&gt;Dim baseFolderPath As String = "C:\VaultWorkspace\InventorWorkspace"&lt;/P&gt;&lt;P&gt;' Check if the active document is an assembly&lt;BR /&gt;If ThisApplication.ActiveDocument.DocumentType &amp;lt;&amp;gt; kAssemblyDocumentObject Then&lt;BR /&gt;MessageBox.Show("The active document is not an assembly. Please open an assembly document and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;' Get the active assembly document&lt;BR /&gt;Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument&lt;/P&gt;&lt;P&gt;' Initialize lists to hold the file paths and display names of the drawings to be checked&lt;BR /&gt;Dim drawingFiles As New List(Of String)&lt;BR /&gt;Dim drawingDisplayNames As New List(Of String)&lt;/P&gt;&lt;P&gt;' HashSet to track processed sub-assemblies and model states&lt;BR /&gt;Dim processedSubAssemblies As New HashSet(Of String)&lt;/P&gt;&lt;P&gt;' Get the assembly component definition&lt;BR /&gt;Dim oCompDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition&lt;/P&gt;&lt;P&gt;' Add the top-level assembly itself to the search&lt;BR /&gt;Dim topLevelAssemblyName As String = System.IO.Path.GetFileNameWithoutExtension(oAsmDoc.FullFileName)&lt;BR /&gt;Dim topLevelDrawingName As String = topLevelAssemblyName &amp;amp; ".idw"&lt;BR /&gt;drawingFiles.Add(topLevelDrawingName)&lt;BR /&gt;drawingDisplayNames.Add("Top-level Assembly: " &amp;amp; topLevelAssemblyName)&lt;/P&gt;&lt;P&gt;' Iterate through each component in the assembly&lt;BR /&gt;For Each oOccurrence As ComponentOccurrence In oCompDef.Occurrences&lt;BR /&gt;Try&lt;BR /&gt;' Check if the component is a subassembly&lt;BR /&gt;If oOccurrence.DefinitionDocumentType = kAssemblyDocumentObject Then&lt;BR /&gt;' Get the file name without extension&lt;BR /&gt;Dim fileNameWithoutExtension As String = System.IO.Path.GetFileNameWithoutExtension(oOccurrence.Definition.Document.FullFileName)&lt;/P&gt;&lt;P&gt;' Construct the model state name identifier&lt;BR /&gt;Dim modelStateIdentifier As String = oOccurrence.Name&lt;BR /&gt;' Retrieve the active model state name&lt;BR /&gt;Dim activeModelStateName As String = Component.ActiveModelState(modelStateIdentifier)&lt;/P&gt;&lt;P&gt;' Create a unique key combining the file name and model state&lt;BR /&gt;Dim uniqueKey As String = fileNameWithoutExtension &amp;amp; " | Model State: " &amp;amp; activeModelStateName&lt;/P&gt;&lt;P&gt;' Check if the sub-assembly with the model state has already been processed&lt;BR /&gt;If Not processedSubAssemblies.Contains(uniqueKey) Then&lt;BR /&gt;' Add the unique key to the HashSet&lt;BR /&gt;processedSubAssemblies.Add(uniqueKey)&lt;/P&gt;&lt;P&gt;' Get the full file name&lt;BR /&gt;Dim fullFileName As String = System.IO.Path.GetFileName(oOccurrence.Definition.Document.FullFileName)&lt;/P&gt;&lt;P&gt;' Create a display name for the checkbox&lt;BR /&gt;Dim displayName As String = "Sub-assembly: " &amp;amp; fullFileName &amp;amp; vbCrLf &amp;amp; "Active Model State: " &amp;amp; activeModelStateName&lt;BR /&gt;drawingDisplayNames.Add(displayName)&lt;/P&gt;&lt;P&gt;' Construct the expected drawing file name&lt;BR /&gt;Dim drawingFileName As String = fileNameWithoutExtension &amp;amp; " (" &amp;amp; activeModelStateName &amp;amp; ").idw"&lt;BR /&gt;drawingFiles.Add(drawingFileName)&lt;BR /&gt;End If&lt;BR /&gt;End If&lt;BR /&gt;Catch ex As Exception&lt;BR /&gt;MessageBox.Show("Error processing component: " &amp;amp; oOccurrence.Name &amp;amp; " - " &amp;amp; ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)&lt;BR /&gt;End Try&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;' Show the custom form with dynamically created checkboxes&lt;BR /&gt;Dim selectedDrawings As List(Of String) = ShowSelectionFormWithCheckBoxes(drawingDisplayNames, drawingFiles)&lt;/P&gt;&lt;P&gt;If selectedDrawings.Count = 0 Then&lt;BR /&gt;MessageBox.Show("No drawings selected. Exiting.", "Selection Required", MessageBoxButtons.OK, MessageBoxIcon.Information)&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;' Initialize a string to hold the results of the drawing file checks&lt;BR /&gt;Dim drawingResults As String = ""&lt;/P&gt;&lt;P&gt;' Initialize lists to hold the found and not found drawing file paths&lt;BR /&gt;Dim foundDrawingFiles As New List(Of String)&lt;BR /&gt;Dim notFoundDrawingFiles As New List(Of String)&lt;/P&gt;&lt;P&gt;' Check if each selected drawing file exists in the entire directory structure and add the result to the display text&lt;BR /&gt;For Each drawingFile In selectedDrawings&lt;BR /&gt;Try&lt;BR /&gt;' First attempt: Search for drawing file with model state&lt;BR /&gt;Dim foundFiles As String() = Directory.GetFiles(baseFolderPath, drawingFile, SearchOption.AllDirectories)&lt;/P&gt;&lt;P&gt;' Check if found&lt;BR /&gt;If foundFiles.Length &amp;gt; 0 Then&lt;BR /&gt;foundDrawingFiles.Add(foundFiles(0)) ' Add to found files list&lt;BR /&gt;drawingResults &amp;amp;= "Drawing file found: " &amp;amp; drawingFile &amp;amp; vbCrLf&lt;BR /&gt;Else&lt;BR /&gt;' Prepare for secondary search&lt;BR /&gt;drawingResults &amp;amp;= "Drawing file not found: " &amp;amp; drawingFile &amp;amp; vbCrLf&lt;BR /&gt;notFoundDrawingFiles.Add(drawingFile) ' Add to not found files list&lt;BR /&gt;End If&lt;BR /&gt;' Add a separator line&lt;BR /&gt;drawingResults &amp;amp;= "------------------------" &amp;amp; vbCrLf&lt;BR /&gt;Catch ex As Exception&lt;BR /&gt;MessageBox.Show("Error searching for drawing file: " &amp;amp; ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)&lt;BR /&gt;End Try&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;' Display the first message box with updated instructions&lt;BR /&gt;Dim openDrawingsResult As DialogResult = DisplayMessageInChunks(drawingResults, "Drawing File Check Results", 50, False, "Would you like to open the drawings that were found?")&lt;/P&gt;&lt;P&gt;' Always continue to the secondary search regardless of the user's response&lt;BR /&gt;Dim secondarySearchResults As String = ""&lt;/P&gt;&lt;P&gt;For Each drawingFile In notFoundDrawingFiles&lt;BR /&gt;Try&lt;BR /&gt;' Remove only the last set of parentheses and its content&lt;BR /&gt;Dim baseFileName As String = RemoveLastParentheses(drawingFile) &amp;amp; ".idw" ' Append the .idw extension&lt;BR /&gt;Dim foundFiles As String() = Directory.GetFiles(baseFolderPath, baseFileName, SearchOption.AllDirectories)&lt;/P&gt;&lt;P&gt;If foundFiles.Length &amp;gt; 0 Then&lt;BR /&gt;foundDrawingFiles.Add(foundFiles(0)) ' Add to found files list&lt;BR /&gt;secondarySearchResults &amp;amp;= "Drawing file found: " &amp;amp; baseFileName &amp;amp; vbCrLf&lt;BR /&gt;Else&lt;BR /&gt;secondarySearchResults &amp;amp;= "Drawing file still not found: " &amp;amp; baseFileName &amp;amp; vbCrLf&lt;BR /&gt;End If&lt;BR /&gt;' Add a separator line&lt;BR /&gt;secondarySearchResults &amp;amp;= "------------------------" &amp;amp; vbCrLf&lt;BR /&gt;Catch ex As Exception&lt;BR /&gt;MessageBox.Show("Error in secondary search: " &amp;amp; ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)&lt;BR /&gt;End Try&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;' Display the third message box with updated instructions&lt;BR /&gt;Dim secondarySearchResultDialog As DialogResult = DisplayMessageInChunks(secondarySearchResults, "Secondary Search Results", 50, False, "Would you like to continue opening the drawings that were found?")&lt;/P&gt;&lt;P&gt;If secondarySearchResultDialog = DialogResult.Yes Then&lt;BR /&gt;' Open any newly found drawing files from the secondary search&lt;BR /&gt;For Each drawingFilePath In foundDrawingFiles&lt;BR /&gt;ThisApplication.Documents.Open(drawingFilePath, True)&lt;BR /&gt;Next&lt;BR /&gt;End If&lt;BR /&gt;Catch ex As Exception&lt;BR /&gt;MessageBox.Show("An unexpected error occurred: " &amp;amp; ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)&lt;BR /&gt;End Try&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;' Function to display a custom form with dynamically created checkboxes&lt;BR /&gt;Function ShowSelectionFormWithCheckBoxes(drawingNames As List(Of String), drawingFiles As List(Of String)) As List(Of String)&lt;BR /&gt;Dim form As New Form()&lt;BR /&gt;form.Text = "Select Drawings to Open"&lt;BR /&gt;form.Width = 500&lt;BR /&gt;form.Height = 400&lt;BR /&gt;form.StartPosition = FormStartPosition.CenterScreen&lt;/P&gt;&lt;P&gt;Dim panel As New Panel()&lt;BR /&gt;panel.Dock = DockStyle.Fill&lt;BR /&gt;panel.AutoScroll = True&lt;/P&gt;&lt;P&gt;Dim checkBoxes As New List(Of CheckBox)()&lt;/P&gt;&lt;P&gt;' Add each checkbox dynamically&lt;BR /&gt;For i As Integer = 0 To drawingNames.Count - 1&lt;BR /&gt;Dim checkBox As New CheckBox()&lt;BR /&gt;checkBox.Text = drawingNames(i)&lt;BR /&gt;checkBox.AutoSize = True&lt;BR /&gt;checkBox.Top = i * 30 + 60 ' Adjust position for space after instruction&lt;BR /&gt;checkBox.Left = 10 ' Set left margin&lt;BR /&gt;panel.Controls.Add(checkBox)&lt;BR /&gt;checkBoxes.Add(checkBox)&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;Dim instructionLabel As New Label()&lt;BR /&gt;instructionLabel.Text = "Please select which drawings you would like to open."&lt;BR /&gt;instructionLabel.Dock = DockStyle.Top&lt;BR /&gt;instructionLabel.Height = 40&lt;BR /&gt;form.Controls.Add(instructionLabel)&lt;/P&gt;&lt;P&gt;Dim okButton As New Button()&lt;BR /&gt;okButton.Text = "OK"&lt;BR /&gt;okButton.Dock = DockStyle.Bottom&lt;BR /&gt;okButton.Height = 30&lt;BR /&gt;AddHandler okButton.Click, Sub(sender, e)&lt;BR /&gt;form.DialogResult = DialogResult.OK&lt;BR /&gt;form.Close()&lt;BR /&gt;End Sub&lt;BR /&gt;form.Controls.Add(okButton)&lt;BR /&gt;form.Controls.Add(panel)&lt;/P&gt;&lt;P&gt;form.ShowDialog()&lt;/P&gt;&lt;P&gt;Dim selectedDrawings As New List(Of String)()&lt;BR /&gt;For Each checkBox In checkBoxes&lt;BR /&gt;If CheckBox.Checked Then&lt;BR /&gt;selectedDrawings.Add(drawingFiles(checkBoxes.IndexOf(CheckBox)))&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;Return selectedDrawings&lt;BR /&gt;End Function&lt;/P&gt;&lt;P&gt;' Function to remove the last set of parentheses and its content from a string&lt;BR /&gt;Function RemoveLastParentheses(fileName As String) As String&lt;BR /&gt;Dim lastIndex As Integer = fileName.LastIndexOf("(")&lt;BR /&gt;If lastIndex &amp;lt;&amp;gt; -1 Then&lt;BR /&gt;' Remove everything from the last opening parenthesis to the end of the string&lt;BR /&gt;fileName = fileName.Substring(0, lastIndex).TrimEnd()&lt;BR /&gt;End If&lt;BR /&gt;Return fileName&lt;BR /&gt;End Function&lt;/P&gt;&lt;P&gt;' Function to display message in chunks with OK or Yes/No buttons&lt;BR /&gt;Function DisplayMessageInChunks(message As String, title As String, maxLines As Integer, isOkButton As Boolean, Optional footerText As String = "") As DialogResult&lt;BR /&gt;Dim lines() As String = message.Split(New String() {vbCrLf}, StringSplitOptions.None)&lt;BR /&gt;Dim totalLines As Integer = lines.Length&lt;BR /&gt;Dim currentLine As Integer = 0&lt;BR /&gt;Dim result As DialogResult = DialogResult.None&lt;/P&gt;&lt;P&gt;While currentLine &amp;lt; totalLines&lt;BR /&gt;Dim chunk As String = ""&lt;BR /&gt;For i As Integer = 0 To maxLines - 1&lt;BR /&gt;If currentLine &amp;gt;= totalLines Then Exit For&lt;BR /&gt;chunk = chunk &amp;amp; lines(currentLine) &amp;amp; vbCrLf&lt;BR /&gt;currentLine += 1&lt;BR /&gt;Next&lt;/P&gt;&lt;P&gt;' Append the footer text to the chunk&lt;BR /&gt;If footerText &amp;lt;&amp;gt; "" Then&lt;BR /&gt;chunk = chunk &amp;amp; vbCrLf &amp;amp; footerText&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;If isOkButton Then&lt;BR /&gt;MessageBox.Show(chunk, title, MessageBoxButtons.OK, MessageBoxIcon.Information)&lt;BR /&gt;Else&lt;BR /&gt;result = MessageBox.Show(chunk, title, MessageBoxButtons.YesNo, MessageBoxIcon.Information)&lt;BR /&gt;If result = DialogResult.No Then&lt;BR /&gt;Exit While&lt;BR /&gt;End If&lt;BR /&gt;End If&lt;BR /&gt;End While&lt;/P&gt;&lt;P&gt;Return result&lt;BR /&gt;End Function&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And here is my "copy sheets to drawing" code:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;
    &lt;SPAN&gt;' Ensure the active document is a drawing document&lt;/SPAN&gt;
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; &amp;lt;&amp;gt; &lt;SPAN&gt;DocumentTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kDrawingDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
        &lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"A Drawing document must be active for this code to work. Exiting."&lt;/SPAN&gt;, &lt;SPAN&gt;vbCritical&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;)
        &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
    
    &lt;SPAN&gt;' Define the active drawing document&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
    
    &lt;SPAN&gt;' Get all open documents&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;openDocs&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Documents&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;
    
    &lt;SPAN&gt;' Iterate through all open documents&lt;/SPAN&gt;
    &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;openDocs&lt;/SPAN&gt;
        &lt;SPAN&gt;' Check if the document is a drawing document and not the active document&lt;/SPAN&gt;
        &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; = &lt;SPAN&gt;DocumentTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kDrawingDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;AndAlso&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt; &amp;lt;&amp;gt; &lt;SPAN&gt;oDDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
            &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOtherDrawing&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN&gt;doc&lt;/SPAN&gt;
            &lt;SPAN&gt;' Copy each sheet from the other drawing document to the active document&lt;/SPAN&gt;
            &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oSheet&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Sheet&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oOtherDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;Sheets&lt;/SPAN&gt;
                &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;CopyTo&lt;/SPAN&gt;(&lt;SPAN&gt;oDDoc&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;SPAN&gt;Next&lt;/SPAN&gt;
    
    &lt;SPAN&gt;' Update the active document to reflect the copied sheets&lt;/SPAN&gt;
    &lt;SPAN&gt;oDDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Update2&lt;/SPAN&gt;(&lt;SPAN&gt;True&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 00:01:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/can-i-use-ilogic-to-create-a-new-drawing-using-pages-from/m-p/13045750#M172221</guid>
      <dc:creator>mmurray1629</dc:creator>
      <dc:date>2024-09-26T00:01:19Z</dc:date>
    </item>
  </channel>
</rss>

