<?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: How to apply External iLogic rule to all opened documents in Inventor Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8675710#M195199</link>
    <description>&lt;P&gt;That worked perfect. I realized the ThisDoc.Document wasn't right but didn't know what to change it to. Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2019 21:20:38 GMT</pubDate>
    <dc:creator>rsilvers</dc:creator>
    <dc:date>2019-03-21T21:20:38Z</dc:date>
    <item>
      <title>How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8591104#M195188</link>
      <description>&lt;P&gt;I am looking to speed up the process of finishing a large batch of drawings. Many of our drawings require dxfs to be created. I have a code below that works great for each drawing individually, but still requires you to open each drawing and run it. Is it possible, even if the drawings are not in the same folder, to run this external rule on all open drawings?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, here is a link that almost gets what I want, but it creates the same dxf over and over again for X amount of drawings I have opened.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-customization/execute-ilogic-for-all-open-documents/td-p/7713849" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-customization/execute-ilogic-for-all-open-documents/td-p/7713849&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'This iLogic rule will grab an excluded from count sheet and recognize it as a DXF. It will automatically save it as a .dxf file
'and place it in the legacy folder, also renaming the sheet to Part Number + DXF. Rev will be inputted by the user.
'A dialog Box will appear To let the user know To update To Vault.
'*******************************************************************************************************************************************
Sub Main()
	'this makes sure you're in a drawing
	Try
		Dim ThisApp = ThisApplication
		Dim TransObj As TransientObjects = ThisApp.TransientObjects
		oDoc = ThisDoc.Document
		If oDoc.DocumentType &amp;lt;&amp;gt; 12292 Then '12292 = kDrawingDocument object
			MessageBox.Show("This Rule must be run from within a Drawing Document.", "Incorrect Document Type")
			Exit Sub
		End If
		Catch
		MessageBox.Show("Error Getting Document Information" &amp;amp; vbCr &amp;amp; "Is the current Document Saved?", "Document Error")
	End Try
	
oFileName = ThisDoc.FileName(False) 'without extension

       oDXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")
&lt;BR /&gt;       oDocument = ThisApplication.ActiveDocument

       oContext = ThisApplication.TransientObjects.CreateTranslationContext
&lt;BR /&gt;       oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism

       oOptions = ThisApplication.TransientObjects.CreateNameValueMap
&lt;BR /&gt;       oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

        'Define the drawing&lt;BR /&gt;
       Dim oDrawing As DrawingDocument

      oDrawing = ThisDoc.Document

       Dim oSheet As Sheet

       Dim lPos As Long

       Dim rPos As Long

       Dim sLen As Long

       Dim sSheetName As String

       Dim sSheetNumber As Integer
']

'Set the default response       
oRevNum = "REV-XX"

'gets the drawing revision number
If iProperties.Value("Project", "Revision Number") = "" Then
	oRevBlock = 0
	Else
	oRevBlock = iProperties.Value("Project", "Revision Number")
End If

'************************************************************
'for future use, if Rev blocks are properly utilized
	'oRevNum = iProperties.Value("Project","Revision Number")
'************************************************************

 'step through each drawing sheet
        For Each oSheet In oDrawing.Sheets

'Only grab sheets that are exluded from count and rename the sheet
If oSheet.ExcludeFromCount = True Then

'Response for the rev as inputted by the user
If oRevNum = "REV-XX"
oRevNum = InputBox("Please enter ''REV-XX'' for your dxfs" &amp;amp; vbCrLf &amp;amp; vbCrLf &amp;amp; "Dialog title shows drawing revision number" _
&amp;amp; ", please check that number against the revision block", oSheet.Name &amp;amp; " DWG REV = " &amp;amp; oRevBlock, "REV-0" &amp;amp; oRevBlock)
End If


'This block will check for errors
'[
'Exits rule if no input is given
If oRevNum = "" Then
	Return
ElseIf oRevNum = " REV-XX" 'Lets the user know that REV-XX is not an acceptable answer
	MessageBox.Show("REV-XX is not a valid revision number", "REV Number not valid, please try again")
	Return
End If

	oSheet.activate
	Dim oDrawingView As DrawingView 
    	oDrawingView = oSheet.DrawingViews(1)
		If oDrawingView.ReferencedDocumentDescriptor.ReferencedDocumentType = kAssemblyDocumentObject '"{E60F81E1-49B3-11D0-93C3-7E0706000000}"
			messagebox.Show("Do not use a weldment as a dxf view!! Ending rule...") 'This just catches anyone using weldments to create dxfs which causes more problems than it solves
			Exit Sub
			Else
	oModelName = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument.DisplayName
	oDesc = iProperties.Value(oModelName, "Project", "Part Number") &amp;amp; " " &amp;amp; oRevNum &amp;amp; " DXF"
	oSheet.Name = oDesc 
	End If
 

']

	
'Checks if user has renamed DXFs properly
'If Left(oSheet.Name,Len(oSheet.Name) - Len(oSheet.Name) + 5) = ThisDoc.FileName(False)

ActiveSheet = ThisDrawing.Sheet(oSheet.Name)

              'find the sheetname length
			  
			   sLen = Len(oSheet.Name)

               'creates the sheet name for saving
&lt;BR /&gt;               sSheetName = Left(oSheet.Name, sLen - 4)
 
    		   'get DXF target folder path

                oFolder = "D:\Working Folder\Legacy\DXF (CONTROLLED)"

                'Set the DXF target file name
                oDataMedium.FileName = oFolder &amp;amp; "\" &amp;amp; sSheetName &amp;amp; ".dxf"
				
'This is ensure latest up to date DXF and prompt the user of the existing DXF
If System.IO.File.Exists(oFolder &amp;amp; "\" &amp;amp; sSheetName &amp;amp; ".dxf") Then
    System.IO.File.Delete( oFolder &amp;amp; "\" &amp;amp; sSheetName &amp;amp; ".dxf")
    MessageBox.Show("Earlier DXF will be overwritten! ", "Inventor")
End If
               'Publish document

               oDXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

'		   Else
'			   Messagebox.Show("The DXF Sheet is named incorrectly. Please name sheets per iLogic instructions")
'		   End If
	   End If
	   
       Next
End Sub


&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 20:34:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8591104#M195188</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-12T20:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8591125#M195189</link>
      <description>&lt;P&gt;What about just setting that rule to run on one of the events in the "Drawings" tab of the events trigger dialog box?&lt;/P&gt;
&lt;P&gt;Then each time you "before save", "close", "after save" or whatever a drawing a DXF will be created or whatever your rule does..&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Eventrigger.PNG" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/602229iEF7DFE8A4D1F9F99/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Eventrigger.PNG" alt="Eventrigger.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 20:44:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8591125#M195189</guid>
      <dc:creator>mcgyvr</dc:creator>
      <dc:date>2019-02-12T20:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8591142#M195190</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/74757"&gt;@mcgyvr&lt;/a&gt;&amp;nbsp; That would prove an excellent solution, however, I wish to avoid that for two reasons.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Load times for drawings can get excessive.&lt;/P&gt;
&lt;P&gt;2) The Legacy folder is regularly cleaned out and tightly controlled with latest revisions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hence why I want to run this iLogic in controlled batches. Your solution may be the route I go if no other solutions are possible.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 20:50:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8591142#M195190</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-12T20:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8591735#M195191</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;, in your drawing export rule, replace this line:&lt;/P&gt;
&lt;PRE&gt;oDocument = ThisApplication.ActiveDocument&lt;/PRE&gt;
&lt;P&gt;with this:&lt;/P&gt;
&lt;PRE&gt;oDocument = ThisDoc.Document&lt;/PRE&gt;
&lt;P&gt;ThisDoc.Document will give you the document that the rule is running in. That might not be the active document.&lt;/P&gt;
&lt;P&gt;If you make that change, then the code from the other post should work.&lt;BR /&gt;(If it doesn't, please post a copy of the code you're using.)&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 03:32:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8591735#M195191</guid>
      <dc:creator>MjDeck</dc:creator>
      <dc:date>2019-02-13T03:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8592634#M195192</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/537534"&gt;@MjDeck&lt;/a&gt;&amp;nbsp;Thank you for your response. Your solution makes a lot of sense to me. I made the changes and unfortunately I am running into the same problem. Drawing A will get its .dxfs exported repeatedly (depends on how many drawings I have opened). I will repost the code I am currently using with your changes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim addIn As ApplicationAddIn
Dim addIns As ApplicationAddIns
addIns = ThisApplication.ApplicationAddIns
    For Each addIn In addIns
        If InStr(addIn.DisplayName, "iLogic") &amp;gt; 0 Then
                        addIn.Activate
            Dim iLogicAuto As Object
            iLogicAuto = addIn.Automation
            Exit For
        End If
    Next
 
  Dim oDoc As Document
For Each oDoc In ThisApplication.Documents.VisibleDocuments

  If oDoc Is Nothing Then
    MsgBox("Missing Inventor Document")
    Exit Sub
  End If

Try
		Dim ThisApp = ThisApplication
		Dim TransObj As TransientObjects = ThisApp.TransientObjects
		oDoc = Thisdoc.Document
		If oDoc.DocumentType &amp;lt;&amp;gt; 12292 Then '12292 = kDrawingDocument object
			MessageBox.Show("This Rule must be run from within a Drawing Document.", "Incorrect Document Type")
			Exit Sub
		End If
		Catch
		MessageBox.Show("Error Getting Document Information" &amp;amp; vbCr &amp;amp; "Is the current Document Saved?", "Document Error")
	End Try
	
oFileName = ThisDoc.FileName(False) 'without extension

       oDXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")

       oDocument = ThisDoc.Document

       oContext = ThisApplication.TransientObjects.CreateTranslationContext

       oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism

       oOptions = ThisApplication.TransientObjects.CreateNameValueMap

       oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

       'Define the drawing
       Dim oDrawing As DrawingDocument

      oDrawing = ThisDoc.Document

       Dim oSheet As Sheet

       Dim lPos As Long

       Dim rPos As Long

       Dim sLen As Long

       Dim sSheetName As String

       Dim sSheetNumber As Integer
']

'Set the default response       
oRevNum = "REV-XX"

'gets the drawing revision number
If iProperties.Value("Project", "Revision Number") = "" Then
	oRevBlock = 0
	Else
	oRevBlock = iProperties.Value("Project", "Revision Number")
End If

'************************************************************
'for future use, if Rev blocks are properly utilized
	'oRevNum = iProperties.Value("Project","Revision Number")
'************************************************************

 'step through each drawing sheet
        For Each oSheet In oDrawing.Sheets

'Only grab sheets that are exluded from count and rename the sheet
If oSheet.ExcludeFromCount = True Then

'Response for the rev as inputted by the user
If oRevNum = "REV-XX"
oRevNum = InputBox("Please enter ''REV-XX'' for your dxfs" &amp;amp; vbCrLf &amp;amp; vbCrLf &amp;amp; "Dialog title shows drawing revision number" _
&amp;amp; ", please check that number against the revision block", oSheet.Name &amp;amp; " DWG REV = " &amp;amp; oRevBlock, "REV-0" &amp;amp; oRevBlock)
End If

'This block will check for errors
'[
'Exits rule if no input is given
If oRevNum = "" Then
	Return
ElseIf oRevNum = " REV-XX" 'Lets the user know that REV-XX is not an acceptable answer
	MessageBox.Show("REV-XX is not a valid revision number", "REV Number not valid, please try again")
	Return
End If

	oSheet.activate
	Dim oDrawingView As DrawingView 
    	oDrawingView = oSheet.DrawingViews(1)
		If oDrawingView.ReferencedDocumentDescriptor.ReferencedDocumentType = kAssemblyDocumentObject '"{E60F81E1-49B3-11D0-93C3-7E0706000000}"
			messagebox.Show("Do not use a weldment as a dxf view!! Ending rule...") 'This just catches anyone using weldments to create dxfs which causes more problems than it solves
			Exit Sub
			Else
	oModelName = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument.DisplayName
	oDesc = iProperties.Value(oModelName, "Project", "Part Number") &amp;amp; " " &amp;amp; oRevNum &amp;amp; " DXF"
	oSheet.Name = oDesc 
	End If
 
']

'Checks if user has renamed DXFs properly
'If Left(oSheet.Name,Len(oSheet.Name) - Len(oSheet.Name) + 5) = ThisDoc.FileName(False)

ActiveSheet = ThisDrawing.Sheet(oSheet.Name)

              'find the sheetname length	  
			   sLen = Len(oSheet.Name)

               'creates the sheet name for saving
               sSheetName = Left(oSheet.Name, sLen - 4)
 

    		   'get DXF target folder path
                oFolder = "D:\Working Folder\Legacy\DXF (CONTROLLED)"

 
               'Set the DXF target file name
                oDataMedium.FileName = oFolder &amp;amp; "\" &amp;amp; sSheetName &amp;amp; ".dxf"
				
'This is ensure latest up to date DXF and prompt the user of the existing DXF
If System.IO.File.Exists(oFolder &amp;amp; "\" &amp;amp; sSheetName &amp;amp; ".dxf") Then
    System.IO.File.Delete( oFolder &amp;amp; "\" &amp;amp; sSheetName &amp;amp; ".dxf")
    MessageBox.Show("Earlier DXF will be overwritten! ", "Inventor")
End If
               'Publish document
               oDXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

	   End If
	   

       Next

'if the drawing has sheets excluded from count, then display a message that the DXFs have been saved locally and prompt to update.
If oSheet.ExcludeFromCount = True Then
MessageBox.Show("DXFs SAVED TO LEGACY FOLDER" &amp;amp; vbCrLf &amp;amp; "PLEASE UPDATE TO VAULT", "Please update Vault", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If

oDoc.Activate
Next
&lt;/PRE&gt;
&lt;P&gt;It should be noted that I tried closing the drawing before oDoc.Activate to force the next drawing to be active, but I get an error saying it can't find the document (unknown document).&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 13:12:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8592634#M195192</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-13T13:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8593050#M195193</link>
      <description>&lt;P&gt;You combined the rule that loops over the visible documents and runs a rule in each one with the rule you want to run. But in this case it will work, because you're using all API and no iLogic functions. Or rather, the iLogic functions you're using have easy API equivalents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;To fix your rule, get rid of ThisDoc.Document. You want to change documents, and ThisDoc.Document always remains the same.&lt;BR /&gt;Delete this line:&lt;/P&gt;
&lt;PRE&gt;oDoc = Thisdoc.Document&lt;/PRE&gt;
&lt;P&gt;Change this line:&lt;/P&gt;
&lt;PRE&gt;oFileName = ThisDoc.FileName(False) 'without extension&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;PRE&gt;oFileName = System.IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName)&lt;/PRE&gt;
&lt;P&gt;Change this line:&lt;/P&gt;
&lt;PRE&gt;oDocument = ThisDoc.Document&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;PRE&gt;oDocument = oDoc&lt;/PRE&gt;
&lt;P&gt;Change this line:&lt;/P&gt;
&lt;PRE&gt;oDrawing = ThisDoc.Document&lt;/PRE&gt;
&lt;P&gt;to&lt;/P&gt;
&lt;PRE&gt;oDrawing = oDoc&lt;/PRE&gt;
&lt;P&gt;Delete this line:&lt;/P&gt;
&lt;PRE&gt;ActiveSheet = ThisDrawing.Sheet(oSheet.Name)&lt;/PRE&gt;
&lt;P&gt;That should be enough to make it work. You can also get rid of the addin code at the top:&lt;/P&gt;
&lt;PRE&gt;Dim addIn As ApplicationAddIn
Dim addIns As ApplicationAddIns
addIns = ThisApplication.ApplicationAddIns
    For Each addIn In addIns
        If InStr(addIn.DisplayName, "iLogic") &amp;gt; 0 Then
                        addIn.Activate
            Dim iLogicAuto As Object
            iLogicAuto = addIn.Automation
            Exit For
        End If
    Next
&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Feb 2019 15:30:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8593050#M195193</guid>
      <dc:creator>MjDeck</dc:creator>
      <dc:date>2019-02-13T15:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8593199#M195194</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/537534"&gt;@MjDeck&lt;/a&gt;&amp;nbsp;This is what I was looking for! As of right now the code always start with the first drawing (far left window) and works its way through consecutive drawings. This was not what the code was doing beforehand, which it took whatever drawing was active and exported that one repeatedly. However, I have a new issue which breaks the code. After completing the first drawing and moving to the second, it gives me an error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"iProperties:The document named 'xxxxx.ipt' was not found."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: to clarify, 'xxxxx.ipt' is the part on the second drawing that is being made into a dxf. the error occurs in document 'firstdrawing.idw'. I assume its searching for the second drawing's parts inside the first drawing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this because the file naming refers to the &lt;EM&gt;active&lt;/EM&gt; sheets and their components? Thank you for all your help so far.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 16:30:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8593199#M195194</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-13T16:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8593260#M195195</link>
      <description>&lt;P&gt;My mistake. I didn't notice that you're using the iProperties function. That's an iLogic function and it only works in the document from which the rule is running.&lt;/P&gt;
&lt;P&gt;To do this without more complicated code changes, you need to create a separate external rule. It doesn't need much code, just:&lt;/P&gt;
&lt;PRE&gt;For Each doc As Document In ThisApplication.Documents.VisibleDocuments
	If doc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
		iLogicVb.Automation.RunExternalRule(doc, "Export Drawing")
	End If
Next
&lt;/PRE&gt;
&lt;P&gt;Replace "Export Drawing" with the name of your main rule.&lt;BR /&gt;Then in your main rule, replace the line:&lt;/P&gt;
&lt;PRE&gt;For Each oDoc In ThisApplication.Documents.VisibleDocuments&lt;/PRE&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;PRE&gt;oDoc = ThisDoc.Document&lt;/PRE&gt;
&lt;P&gt;and get rid of the Next at the bottom of the rule.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 16:38:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8593260#M195195</guid>
      <dc:creator>MjDeck</dc:creator>
      <dc:date>2019-02-13T16:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8593361#M195196</link>
      <description>&lt;P&gt;This works flawlessly now! I have learned a lot, thank you so much for your help. This saves me quite a headache a plenty of time too.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 17:16:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8593361#M195196</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-13T17:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8672822#M195197</link>
      <description>&lt;P&gt;I'm still struggling getting this to work properly. I've modified the iLogic alittle to focus on just going thru each of the open drawings and save them as .dwg. My problem is the saveas file name is always the same for every drawing that opens.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim oDoc As Document&lt;/P&gt;
&lt;P&gt;For Each oDoc In ThisApplication.Documents.VisibleDocuments&lt;/P&gt;
&lt;P&gt;If oDoc Is Nothing Then&lt;BR /&gt;MsgBox("Missing Inventor Document")&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;/P&gt;
&lt;P&gt;Try&lt;BR /&gt;Dim ThisApp = ThisApplication&lt;BR /&gt;Dim TransObj As TransientObjects = ThisApp.TransientObjects&lt;BR /&gt;If oDoc.DocumentType &amp;lt;&amp;gt; 12292 Then '12292 = kDrawingDocument object&lt;BR /&gt;MessageBox.Show("This Rule must be run from within a Drawing Document.", "Incorrect Document Type")&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;Catch&lt;BR /&gt;MessageBox.Show("Error Getting Document Information" &amp;amp; vbCr &amp;amp; "Is the current Document Saved?", "Document Error")&lt;BR /&gt;End Try&lt;BR /&gt;&lt;BR /&gt;oFileName = System.IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName) 'without extension&lt;BR /&gt;&lt;BR /&gt;'MessageBox.Show(oFileName, "Title")&lt;/P&gt;
&lt;P&gt;oDoc.SaveAs(ThisDoc.ChangeExtension(".dwg") , True)&lt;BR /&gt;MessageBox.Show(oFileName &amp;amp; ".dwg Saved!! " &amp;amp; vbCrLf &amp;amp; vbCrLf &amp;amp; ThisDoc.Path , "Save As")&lt;BR /&gt;oDoc.Activate&lt;BR /&gt;Next&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2019 20:55:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8672822#M195197</guid>
      <dc:creator>rsilvers</dc:creator>
      <dc:date>2019-03-20T20:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8672873#M195198</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/56305"&gt;@rsilvers&lt;/a&gt;&amp;nbsp;, ThisDoc always refers back to the document from which the rule is run. So the line that contains ThisDoc.ChangeExtension is causing the problem. You can replace it with this:&lt;/P&gt;
&lt;PRE&gt;oDoc.SaveAs(System.IO.Path.ChangeExtension(oDoc.FullFileName, ".dwg") , True)&lt;/PRE&gt;
&lt;P&gt;Another unrelated change to make the code more readable:&lt;/P&gt;
&lt;PRE&gt;If oDoc.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kDrawingDocumentObject Then&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Mar 2019 21:15:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8672873#M195198</guid>
      <dc:creator>MjDeck</dc:creator>
      <dc:date>2019-03-20T21:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8675710#M195199</link>
      <description>&lt;P&gt;That worked perfect. I realized the ThisDoc.Document wasn't right but didn't know what to change it to. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 21:20:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8675710#M195199</guid>
      <dc:creator>rsilvers</dc:creator>
      <dc:date>2019-03-21T21:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8779930#M195200</link>
      <description>&lt;P&gt;Thanks MJDeck - I got some useful info from your posts - thanks for that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am having a similar issue when exporting all open drawings to DXF when I loop through them and run the DXF Export Rule.&amp;nbsp; Only the drawing open at the time of the rule execution is saved over and over.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Due to time constraints I have had to add a close active document line at the end of the DXF Export rule&lt;/P&gt;
&lt;P&gt;so after opening a dozen drawing at a time I can run the rule and loop through them that way.&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;I am not sure if I need to Edit the Syntax&amp;nbsp; for the DXF&amp;nbsp; SaveCopyas line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;DXFAddIn&lt;/SPAN&gt;.&lt;SPAN&gt;SaveCopyAs&lt;/SPAN&gt;(&lt;SPAN&gt;oDocument&lt;/SPAN&gt;, &lt;SPAN&gt;context&lt;/SPAN&gt;, &lt;SPAN&gt;oOptions&lt;/SPAN&gt;, &lt;SPAN&gt;oDataMedium&lt;/SPAN&gt;) &lt;/PRE&gt;
&lt;P&gt;or is using display name (example below) a better way of the file the way to ensure the Export honours the actual open drawing?&lt;/P&gt;
&lt;P&gt;..........................................................................................&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;STRONG&gt;Dim&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;oAsmDoc&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;As&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;AssemblyDocument&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;oAsmDoc&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;=&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;ThisApplication&lt;/STRONG&gt;.ActiveDocument&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;oAsmName&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;=&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;Left&lt;/STRONG&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;oAsmDoc.DisplayName,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Len&lt;/STRONG&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;oAsmDoc.DisplayName&lt;STRONG&gt;)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;-&lt;/STRONG&gt;&lt;STRONG&gt;4)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;STRONG&gt;......................................................................................&lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&lt;STRONG&gt;Any assistance would be invaluable&lt;/STRONG&gt;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="font-weight: 400;"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 07:03:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8779930#M195200</guid>
      <dc:creator>forbillian</dc:creator>
      <dc:date>2019-05-09T07:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8793698#M195201</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1693791"&gt;@forbillian&lt;/a&gt;&amp;nbsp;, please post the rule you're using. If you're using one rule to run another, please post both rules.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2019 20:06:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8793698#M195201</guid>
      <dc:creator>MjDeck</dc:creator>
      <dc:date>2019-05-15T20:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8796875#M195202</link>
      <description>&lt;P&gt;Hi MJdeck,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The rule is basically using the Code in this thread but instead of saving each open drawing I am trying to apply another rule for this example 'delete views &amp;amp; BOM on each open drawing'.&amp;nbsp; It loops through the open docs &amp;amp; shows the display name but it doesn't apply the DeleteViewsBOM rule.&amp;nbsp; See below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
		
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt;

&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;VisibleDocuments&lt;/SPAN&gt;

&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;Nothing&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"Missing Inventor Document"&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;Try&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;ThisApp&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;TransObj&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TransientObjects&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApp&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; &amp;lt;&amp;gt; 12292 &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;'12292 = kDrawingDocument object&lt;/SPAN&gt;
&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"This Rule must be run from within a Drawing Document."&lt;/SPAN&gt;, &lt;SPAN&gt;"Incorrect Document Type"&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;Catch&lt;/SPAN&gt;
&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Error Getting Document Information"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;vbCr&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"Is the current Document Saved?"&lt;/SPAN&gt;, &lt;SPAN&gt;"Document Error"&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;

&lt;SPAN&gt;oFileName&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;) &lt;SPAN&gt;'without extension&lt;/SPAN&gt;

&lt;SPAN&gt;'MessageBox.Show(oFileName, "Title")&lt;/SPAN&gt;

&lt;SPAN&gt;'oDoc.SaveAs(ThisDoc.ChangeExtension(".dwg") , True)&lt;/SPAN&gt;

&lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;DeleteViewsBOM&lt;/SPAN&gt;()

&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;oFileName&lt;/SPAN&gt;)

&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Activate&lt;/SPAN&gt;


&lt;SPAN&gt;'iLogicVb.RunExternalRule("DeleteDrawingsViewsOrBOM")&lt;/SPAN&gt;


&lt;SPAN&gt;Next&lt;/SPAN&gt;

&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;

&lt;SPAN&gt;Private&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;DeleteViewsBOM&lt;/SPAN&gt;()

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDrawingDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt;
&lt;SPAN&gt;oDrawingDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
    
&lt;SPAN&gt;Dim&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;oSheet&lt;/SPAN&gt; = &lt;SPAN&gt;oDrawingDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveSheet&lt;/SPAN&gt;

&lt;SPAN&gt;'Detect if the template has a parts list&lt;/SPAN&gt;
&lt;SPAN&gt;Try&lt;/SPAN&gt; 
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPartslistCheck&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartsList&lt;/SPAN&gt;
&lt;SPAN&gt;oPartslistCheck&lt;/SPAN&gt; = &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;PartsLists&lt;/SPAN&gt;(1)
&lt;SPAN&gt;partslistpresent&lt;/SPAN&gt;=&lt;SPAN&gt;True&lt;/SPAN&gt;
&lt;SPAN&gt;Catch&lt;/SPAN&gt;
&lt;SPAN&gt;partslistpresent&lt;/SPAN&gt;=&lt;SPAN&gt;False&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;

	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;partslistpresent&lt;/SPAN&gt;=&lt;SPAN&gt;True&lt;/SPAN&gt;
	    
	    &lt;SPAN&gt;'Delete the current parts list&lt;/SPAN&gt;
	    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPartsList&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartsList&lt;/SPAN&gt;
	    &lt;SPAN&gt;oPartsList&lt;/SPAN&gt; = &lt;SPAN&gt;oDrawingDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveSheet&lt;/SPAN&gt;.&lt;SPAN&gt;PartsLists&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(1)
	    &lt;SPAN&gt;oPartsList&lt;/SPAN&gt;.&lt;SPAN&gt;Delete&lt;/SPAN&gt;
	    
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;doc&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;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;view&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingView&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveSheet&lt;/SPAN&gt;.&lt;SPAN&gt;DrawingViews&lt;/SPAN&gt;
		&lt;SPAN&gt;view&lt;/SPAN&gt;.&lt;SPAN&gt;Delete&lt;/SPAN&gt;
	&lt;SPAN&gt;Next&lt;/SPAN&gt;
	
	&lt;SPAN&gt;'ThisDoc.Save&lt;/SPAN&gt;

	
	
&lt;SPAN&gt;'	ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop").Execute2(False)&lt;/SPAN&gt;

&lt;SPAN&gt;'	'CHECKIN AUTO WITHOUT COMMENT&lt;/SPAN&gt;
&lt;SPAN&gt;'	System.Windows.Forms.SendKeys.SendWait(Chr(9) &amp;amp; vbCrLf)&lt;/SPAN&gt;
	
	
&lt;SPAN&gt;'	ThisApplication.ActiveDocument.Close(True)&lt;/SPAN&gt;
	

&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 May 2019 23:44:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8796875#M195202</guid>
      <dc:creator>forbillian</dc:creator>
      <dc:date>2019-05-16T23:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8796981#M195203</link>
      <description>&lt;P&gt;Since you want the rule to operate on all documents, you can't use ThisDoc.Document. You might be able to use ThisApplication.ActiveDocument if you activate each document in turn, but that's usually not required. You already have the document you want in the oDoc variable from the For loop. To use it, make these changes:&lt;BR /&gt;Replace:&lt;/P&gt;
&lt;PRE&gt;Call DeleteViewsBOM()&lt;/PRE&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;PRE&gt;Call DeleteViewsBOM(oDoc)&lt;/PRE&gt;
&lt;P&gt;Replace:&lt;/P&gt;
&lt;PRE&gt;Private Sub DeleteViewsBOM()

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument&lt;/PRE&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;PRE&gt;Private Sub DeleteViewsBOM(oDoc As Document)

Dim oDrawingDoc As DrawingDocument = oDoc&lt;/PRE&gt;
&lt;P&gt;Replace:&lt;/P&gt;
&lt;PRE&gt;	Dim doc As DrawingDocument = ThisDoc.Document
		
	For Each view As DrawingView In doc.ActiveSheet.DrawingViews&lt;/PRE&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;PRE&gt;For Each view As DrawingView In oDrawingDoc.ActiveSheet.DrawingViews&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 01:45:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8796981#M195203</guid>
      <dc:creator>MjDeck</dc:creator>
      <dc:date>2019-05-17T01:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply External iLogic rule to all opened documents</title>
      <link>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8797058#M195204</link>
      <description>&lt;P&gt;Thankyou so much Mike.&lt;/P&gt;
&lt;P&gt;That has saved me hours &amp;amp; helped me on the coding journey.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting an error exception every&amp;nbsp; 4 or 5 drawings but I am confident I can work that out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will post the updated code once it runs completely for anyone else that has experienced this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thankyou again.&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 03:32:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-forum/how-to-apply-external-ilogic-rule-to-all-opened-documents/m-p/8797058#M195204</guid>
      <dc:creator>forbillian</dc:creator>
      <dc:date>2019-05-17T03:32:42Z</dc:date>
    </item>
  </channel>
</rss>

