iLogic save to PDF and DXF (ask before run)

iLogic save to PDF and DXF (ask before run)

Anonymous
Not applicable
1,532 Views
3 Replies
Message 1 of 4

iLogic save to PDF and DXF (ask before run)

Anonymous
Not applicable

Dear Inventor users,

 

I got 2 iLogic rules in my Inventor (save document as .PDF and save as .DXF) and they run when saving a document.

they work perfectly.

They are named:

- Save as DXF

- Save as PDF

 

Now they are triggered by saving my document.

I would like to have a pop up before running these two rules with a textbox saying yes/no

if yes run both rules, if no do nothing.

 

Please help me how to make this.

 

Thanks in advance.

0 Likes
Accepted solutions (1)
1,533 Views
3 Replies
Replies (3)
Message 2 of 4

MechMachineMan
Advisor
Advisor
Accepted solution

Step 1: change ruleFileName to match the name of your rule.

Step 2: Add this as an external rule.

Step 3: If using 2018: Add this as an event trigger that occurs on all drawings on save.

 

If not using 2018, it's a much more difficult process and it involves creating an add-in.

 

Sub Main()
   
   Dim oDoc As Document
   oDoc = ThisDoc.Document  

  If isVisible(oDoc) = False Then
      Exit Sub
  End If

  If MsgBox("Export Files?", MsgBoxStyle.YesNo, "MacroMagic") = vbYes
     iLogicVb.RunExternalRule("ruleFileName")
     iLogicVb.RunExternalRule("ruleFileName")
  End if

End Sub

Function isVisible(oDoc As Document) As Boolean
    For Each oVisDoc in ThisApplication.Documents.VisibleDocuments
        If oVisDoc Is oDoc Then
	    Return True
	End If
    Next
    Return False
End Function

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 4

Anonymous
Not applicable

Lol, I'm using inventor 2017 and it works.

Thank you very much MechMachineMan

0 Likes
Message 4 of 4

MechMachineMan
Advisor
Advisor

You mean you can attach event triggers to the individual documents you want this to happen on in 2017 (manually, via CodeInjector, or via templates)

 

In 2018 there are Global event triggers that make this much easier to manage.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes