<?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: Launch External iLogic rule with VBA in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3468510#M138963</link>
    <description>&lt;P&gt;So &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; i have modify all for my need. It works fine but i have the last bug. This in my final code:&lt;/P&gt;&lt;PRE&gt;'Crea i PDF con adobe PDF


Option Explicit

Public Sub DXF_PDF_Creator()

  Dim oDocument As Inventor.Document
  Dim oPropertySet As Inventor.PropertySet
  Dim oProperty As Inventor.Property
  Dim sPath As String
  Dim PN As String

  
  ' VBA requires the keyword "Set" when instantiating an Object variable
  Set oDocument = ThisApplication.ActiveDocument
  Set oPropertySet = oDocument.PropertySets(("Design Tracking Properties"))
  Set oProperty = oPropertySet("Part Number")
  
  ' Set Path and base file name
  sPath = "C:\Users\varga\Desktop\"
  PN = GetFileName(oDocument.FullFileName)
  PN = sPath &amp;amp; PN
  
  ' Call the translation sub routines
  Call TranslateFile(PN, ".dxf", oDocument)
  Call TranslateFile(PN, ".pdf", oDocument)
  
  ' Clean up object
  Set oProperty = Nothing
  Set oPropertySet = Nothing
  Set oDocument = Nothing
  
End Sub
Private Function GetFileName(ByVal sFullFileName As String) As String

  Dim sFileName As String

  Dim nPos As Integer

  sFileName = sFullFileName

  nPos = InStrRev(sFullFileName, "\")

  If nPos &amp;gt; 0 Then

    sFileName = Mid$(sFullFileName, nPos + 1)

  End If

  GetFileName = sFileName

End Function


Public Sub TranslateFile(ByVal BaseFileName As String, ByVal FileType As String, oDocument As Inventor.Document)

  Dim PN As String
  PN = BaseFileName &amp;amp; FileType
  

  ' Define Variables

  Dim AddIn As Inventor.TranslatorAddIn
  Dim oContext As Inventor.TranslationContext
  Dim oOptions As Inventor.NameValueMap
  Dim oDataMedium As Inventor.DataMedium
  Dim SheetSize As DrawingSheetSizeEnum
  Dim SheetOrientation As PageOrientationTypeEnum
  

  ' Define Context, Options and DataMediums
  Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
  oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
  Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
  Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

  If FileType = ".dxf" Then
    ' Get the DXF translator Add-In.
    Set AddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")
  ' Check whether the translator has 'SaveCopyAs' options
    If AddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
      Dim strIniFile As String
      strIniFile = "Z:\Autodesk\Inventor11\Design Data\DWG-DXF\fornitori.ini"
      oOptions.Value("Export_Acad_IniFile") = strIniFile
    End If
           
    
  ElseIf FileType = ".pdf" Then
    Dim oPrintMgr As Inventor.PrintManager
    
    SheetOrientation = ThisApplication.ActiveDocument.ActiveSheet.Orientation
    'SheetSize = ThisApplication.ActiveDocument.ActiveSheet.Size
    
        'Create a PDF File with the print manager
        Set oPrintMgr = ThisApplication.ActiveDocument.PrintManager
        oPrintMgr.Printer = "Adobe PDF"
        'oPrintMgr.ColorMode = kPrintGrayScale
        'oPrintMgr.ColorMode = kPrintColorPalette
        oPrintMgr.NumberOfCopies = 1
        
        ' Imposta l'orientazione del PDF
        If SheetOrientation = kLandscapePageOrientation Then
        oPrintMgr.Orientation = kLandscapeOrientation
        ElseIf SheetOrientation = kPortraitPageOrientation Then
        oPrintMgr.Orientation = kPortraitOrientation
        End If

        'oPrintMgr.Orientation = kPortraitOrientation
        'oPrintMgr.Orientation = kLandscapeOrientation
        oPrintMgr.PaperSize = kPaperSizeA4
        oPrintMgr.SubmitPrint
        Exit Sub
  End If
 
  ' Set the destination file name
  oDataMedium.FileName = PN
  '-----
  
  ' Create a DXF document
  Call AddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
   
  ' Clean up objects
  Set oDataMedium = Nothing
  Set oOptions = Nothing
  Set oContext = Nothing
  Set AddIn = Nothing

'----------------------


End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;For exemple with file SO37697.dwg open in inventor when i lunch this code he do two file SO37697.dwg.dxf and SO37697.pdf the dxf is wrong, and he doesn't consider tht .ini file!!! Why??&lt;/P&gt;</description>
    <pubDate>Wed, 23 May 2012 10:33:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-05-23T10:33:16Z</dc:date>
    <item>
      <title>Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3170614#M138937</link>
      <description>&lt;P&gt;Is there someway to launch an external iLogic rule with VBA?. I'd like to add a button to run the iLogic rule.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2011 17:52:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3170614#M138937</guid>
      <dc:creator>Lance127</dc:creator>
      <dc:date>2011-09-26T17:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3170894#M138938</link>
      <description>&lt;P&gt;This has been answered before, but perhaps not exactly this way...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--- In a VBA module ---&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub LaunchMyRule1 &amp;nbsp; &amp;lt;--- This is what you would tie to a button in a toolbar.&lt;/P&gt;&lt;P&gt;&amp;nbsp; RuniLogic "MyRule1"&lt;/P&gt;&lt;P&gt;End sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub LaunchMyRule2&amp;nbsp;&amp;nbsp; &amp;lt;--- This is what you would tie to a button in a toolbar.&lt;/P&gt;&lt;P&gt;&amp;nbsp; RuniLogic "MyRule2"&lt;/P&gt;&lt;P&gt;End sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub RuniLogic(ByVal RuleName As String)&lt;BR /&gt;&amp;nbsp; Dim iLogicAuto As Object&lt;BR /&gt;&amp;nbsp; Dim oDoc As Document&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; Set oDoc = ThisApplication.ActiveDocument&lt;BR /&gt;&amp;nbsp; If oDoc Is Nothing Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox "Missing Inventor Document"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit Sub&lt;BR /&gt;&amp;nbsp; End If&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; Set iLogicAuto = GetiLogicAddin(ThisApplication)&lt;BR /&gt;&amp;nbsp; If (iLogicAuto Is Nothing) Then Exit Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp; iLogicAuto.RunExternalRule oDoc, RuleName&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Function GetiLogicAddin(oApplication As Inventor.Application) As Object&lt;BR /&gt;&amp;nbsp; Dim addIns As ApplicationAddIns&lt;BR /&gt;&amp;nbsp; Set addIns = oApplication.ApplicationAddIns&lt;/P&gt;&lt;P&gt;&amp;nbsp; Dim addIn As ApplicationAddIn&lt;BR /&gt;&amp;nbsp; Dim customAddIn As ApplicationAddIn&lt;BR /&gt;&amp;nbsp; For Each addIn In addIns&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (addIn.ClassIdString = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}") Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set customAddIn = addIn&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit For&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;BR /&gt;&amp;nbsp; Next&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2011 21:32:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3170894#M138938</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-09-26T21:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3171982#M138939</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2011 17:50:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3171982#M138939</guid>
      <dc:creator>Lance127</dc:creator>
      <dc:date>2011-09-27T17:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3177992#M138940</link>
      <description>&lt;P&gt;I can't get this to work and I can't figure out what's wrong. I have looked around and the only other code I can find doesn't work either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nevermind figured it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub LaunchMyRule1&amp;nbsp;&amp;nbsp; &amp;lt;--- This is what you would tie to a button in a toolbar.&lt;/P&gt;&lt;P&gt;&amp;nbsp; RuniLogic "MyRule1"&lt;/P&gt;&lt;P&gt;End sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub LaunchMyRule2&amp;nbsp;&amp;nbsp; &amp;lt;--- This is what you would tie to a button in a toolbar.&lt;/P&gt;&lt;P&gt;&amp;nbsp; RuniLogic "MyRule2"&lt;/P&gt;&lt;P&gt;End sub&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Public Sub RuniLogic(ByVal RuleName As String)&lt;BR /&gt;&amp;nbsp; Dim iLogicAuto As Object&lt;BR /&gt;&amp;nbsp; Dim oDoc As Document&lt;/P&gt;&lt;P&gt;&amp;nbsp; Set oDoc = ThisApplication.ActiveDocument&lt;BR /&gt;&amp;nbsp; If oDoc Is Nothing Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox "Missing Inventor Document"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit Sub&lt;BR /&gt;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&amp;nbsp; Set iLogicAuto = GetiLogicAddin(ThisApplication)&lt;BR /&gt;&amp;nbsp; If (iLogicAuto Is Nothing) Then Exit Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp; iLogicAuto.RunExternalRule oDoc, RuleName&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Function GetiLogicAddin(oApplication As Inventor.Application) As Object&lt;BR /&gt;Set addIns = oApplication.ApplicationAddIns&lt;/P&gt;&lt;P&gt;'Find the add-in you are looking for&lt;BR /&gt;Dim addIn As ApplicationAddIn&lt;BR /&gt;On Error GoTo NotFound&lt;BR /&gt;Set addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")&lt;/P&gt;&lt;P&gt;If (addIn Is Nothing) Then Exit Function&lt;/P&gt;&lt;P&gt;addIn.Activate&lt;BR /&gt;Set GetiLogicAddin = addIn.Automation&lt;BR /&gt;Exit Function&lt;BR /&gt;NotFound:&lt;BR /&gt;End Function&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2011 16:36:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3177992#M138940</guid>
      <dc:creator>Lance127</dc:creator>
      <dc:date>2011-10-03T16:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3265618#M138941</link>
      <description>&lt;P&gt;Thanks a lot !&lt;/P&gt;&lt;P&gt;It works for Inventor 2012 too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just had to modify first line and add () :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub LaunchMyRule1 ()&lt;/P&gt;&lt;P&gt;&amp;nbsp; RuniLogic "MyRule1"&lt;/P&gt;&lt;P&gt;End sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2011 12:59:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3265618#M138941</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-12-16T12:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3307957#M138942</link>
      <description>&lt;P&gt;Mike,&lt;/P&gt;&lt;P&gt;I've tried using this in a VB6 program. I open up the part first that has the Rule I want to run, but I get an error saying it cannot find the external rule.&lt;/P&gt;&lt;P&gt;The error occurs at iLogicAuto.RunExternalRule oDoc, RuleName.&lt;/P&gt;&lt;P&gt;The RuleName is correct and the part does have a rule with the supplied name. Any suggestions?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2012 19:48:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3307957#M138942</guid>
      <dc:creator>meck</dc:creator>
      <dc:date>2012-01-26T19:48:27Z</dc:date>
    </item>
    <item>
      <title>Re : Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3308767#M138943</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This VBA Code is made to launch an &lt;U&gt;external&lt;/U&gt; rule only.&lt;/P&gt;&lt;P&gt;You have to link, in Inventor, an external iLogic rune, and not in the file.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2012 13:09:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3308767#M138943</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-01-27T13:09:07Z</dc:date>
    </item>
    <item>
      <title>Re : Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3312055#M138944</link>
      <description>&lt;P&gt;Thanks for the reply, but how do I do that?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2012 11:16:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3312055#M138944</guid>
      <dc:creator>meck</dc:creator>
      <dc:date>2012-01-31T11:16:24Z</dc:date>
    </item>
    <item>
      <title>Re : Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3312939#M138945</link>
      <description>&lt;P&gt;Never mind. I just had to change &amp;nbsp;&lt;/P&gt;&lt;P&gt;iLogicAuto.RunExternalRule oDoc, RuleName&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&amp;nbsp;iLogicAuto.RunRule oDoc, RuleName&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2012 20:57:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3312939#M138945</guid>
      <dc:creator>meck</dc:creator>
      <dc:date>2012-01-31T20:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3458052#M138946</link>
      <description>&lt;P&gt;I have Inventor pro 2012 but this code doesn't work! I need it can someone help me??????&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2012 15:14:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3458052#M138946</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-15T15:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3458098#M138947</link>
      <description>&lt;P&gt;Have you created an external Rule file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code posted is for External rules only.&amp;nbsp; If your rule is inside the inventor document you cannot use this method..&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2012 15:34:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3458098#M138947</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-15T15:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3458132#M138948</link>
      <description>&lt;P&gt;I fave the esternel rule called DXF_PDF_zsolt and in VBA i have this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Sub DXF_PDF_Creator()

  RuniLogic "DXF_PDF_zsolt"

End Sub


Public Sub RuniLogic(ByVal RuleName As String)
  Dim iLogicAuto As Object
  Dim oDoc As Document

  Set oDoc = ThisApplication.ActiveDocument
  If oDoc Is Nothing Then
    MsgBox "Missing Inventor Document"
    Exit Sub
  End If

  Set iLogicAuto = GetiLogicAddin(ThisApplication)
  If (iLogicAuto Is Nothing) Then Exit Sub

  iLogicAuto.RunExternalRule oDoc, RuleName
End Sub

 

Function GetiLogicAddin(oApplication As Inventor.Application) As Object
Set addIns = oApplication.ApplicationAddIns

'Find the add-in you are looking for
Dim addIn As ApplicationAddIn
On Error GoTo NotFound
Set addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79?-2179-4b11-8a5a-257b1c0263ac}")

If (addIn Is Nothing) Then Exit Function

addIn.Activate
Set GetiLogicAddin = addIn.Automation
Exit Function
NotFound:
End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2012 15:56:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3458132#M138948</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-15T15:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3458270#M138949</link>
      <description>&lt;P&gt;if you put a break in your VBA code at&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"RuniLogic "DXF_PDF_zsolt"&lt;/P&gt;&lt;P&gt;Run the VBA code and step through the code one line at a time with F8&amp;nbsp;where does it fail?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS.&amp;nbsp; Why are you using an iLogic to creare a PDF?&amp;nbsp; You can do it all in VBA.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2012 16:58:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3458270#M138949</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-15T16:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3460966#M138950</link>
      <description>&lt;P&gt;When i tun the vba conde step by step with F8 in works fine. There is no errer, but it don't execute the external rule! When you tun the vba code he don't do nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use ilogic because i don't be able to do this in vba.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is&amp;nbsp;my ilogic rule:&lt;/P&gt;&lt;PRE&gt;' Percorsi dove veranno salvati il DXF e il PDF
oPath = "C:\Users\varga\Desktop\"
PN = iProperties.Value("Project", "Part Number")


' Get the DXF translator Add-In.
Dim DXFAddIn As TranslatorAddIn
DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")
'Set a reference to the active document (the document to be published).
Dim oDocument As Document
oDocument = ThisApplication.ActiveDocument
Dim oContext As TranslationContext
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Create a DataMedium object
Dim oDataMedium As DataMedium
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
' Check whether the translator has 'SaveCopyAs' options
If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
Dim strIniFile As String
strIniFile = "Z:\Autodesk\Inventor2012\iLogic_Rules\fornitori.ini"
' Create the name-value that specifies the ini file to use.
oOptions.Value("Export_Acad_IniFile") = strIniFile
End If
'Set the destination file name
oDataMedium.FileName = oPath &amp;amp; "\" &amp;amp; PN &amp;amp; ".dxf"
'Publish document.
DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

'Crea il File PDF
oPrintMgr = ThisApplication.ActiveDocument.PrintManager
oPrintMgr.Printer = "Adobe PDF"
oPrintMgr.ColorMode = kPrintGrayScale
'oPrintMgr.ColorMode = kPrintColorPalette
oPrintMgr.NumberOfCopies = 1
oPrintMgr.Orientation = kPortraitOrientation
'oPrintMgr.Orientation = kLandscapeOrientation
oPrintMgr.PaperSize = kPaperSizeA4
oPrintMgr.SubmitPrint

'Chiede se vuoi aprire il DXF appena creato
i = MessageBox.Show("Vuoi aprire il file DXF appena creato?", "Anteprima",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
If i = vbYes Then ThisDoc.Launch(oDataMedium.FileName)&lt;/PRE&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;</description>
      <pubDate>Thu, 17 May 2012 07:59:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3460966#M138950</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-17T07:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3462120#M138951</link>
      <description>&lt;P&gt;At a glance that code looks like it should work in VBA just fine.&amp;nbsp; You might have to set a few variables but otherwise you are pretty much where you need to be.&amp;nbsp; I am swamped at the today.&amp;nbsp; Give me some time and I will update it to be VBA code.&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2012 18:29:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3462120#M138951</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-17T18:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3462140#M138952</link>
      <description>Thank you very much you will give me a big hand!! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; I'am waiting for you. Thanks a lot!</description>
      <pubDate>Thu, 17 May 2012 18:38:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3462140#M138952</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-17T18:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3463674#M138953</link>
      <description>&lt;P&gt;Okay,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a VBA version of your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I broke it up into two sub routines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) The main sub routine that gets the filename and calls the translators.&lt;/P&gt;&lt;P&gt;2) The Translator Sub Routine&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I commented out your code that uses the printer to create a PDF and used&lt;/P&gt;&lt;P&gt;the built in PDF Translator Addin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Give it a try AS IS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to get back your Printer PDF Code it is still there.&lt;/P&gt;&lt;P&gt;You just need to uncomment the Printer Code and comment the PDF Translator Code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have Fun&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--- Code Attached below .---&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2012 16:51:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3463674#M138953</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-18T16:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3464380#M138954</link>
      <description>Thank you very very much! As soon as possible I test this code and I let you know how it works.&lt;BR /&gt;P.s. I use the adobe PDF printer and not the integrated PDF creator because sometime the integrated creator do the error in text parts of the drawings I don't know why! With adobe I never have problem.</description>
      <pubDate>Fri, 18 May 2012 23:24:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3464380#M138954</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-18T23:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3465238#M138955</link>
      <description>&lt;P&gt;I've tray to execute the VBA code but it give me this error:&lt;/P&gt;&lt;P&gt;&lt;IMG align="center" title="img.jpg" alt="img.jpg" src="https://forums.autodesk.com/t5/image/serverpage/image-id/28952i1D6BA81E0BF42851/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2012 07:01:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3465238#M138955</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-21T07:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Launch External iLogic rule with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3465356#M138956</link>
      <description>&lt;P&gt;I don't be able to find the error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.s. I need only adobe PDF script not the netive PDF creator.&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2012 10:17:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/launch-external-ilogic-rule-with-vba/m-p/3465356#M138956</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-21T10:17:05Z</dc:date>
    </item>
  </channel>
</rss>

