print excluded sheets (pdf) using API

print excluded sheets (pdf) using API

Anonymous
Not applicable
599 Views
5 Replies
Message 1 of 6

print excluded sheets (pdf) using API

Anonymous
Not applicable

How to print excluded sheets to PDF via API. Is there any name value map for this?

0 Likes
600 Views
5 Replies
Replies (5)
Message 2 of 6

MechMachineMan
Advisor
Advisor

Use print manager API object to access things req'd for printing.

Use API help/"Programming Help" from inventor/the search feature on the forums to find out how to do this all without relying on forum replies

 

 

Dim oDoc as Document

oDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet

For Each oSheet in oDoc.Sheets

     oSheet.Activate

     If oSheet.ExcludeFromCount = True

              'Run print to pdf code here

     End if

Next


--------------------------------------
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 6

Anonymous
Not applicable

thanks for your replay, but this will work only when you want to print individual sheets as individual pdf files. And Iam using the same for that purpose in my Addinns. My requirement is to us the function for all Sheet and sheets in range. which is not mentioned in any of the API helps and forum threads.

0 Likes
Message 4 of 6

MechMachineMan
Advisor
Advisor

Are you actually PRINTING to pdf, or are you just exporting using the translator add-in?

 

(Does the pdf have layers or not?)


--------------------------------------
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 5 of 6

MechMachineMan
Advisor
Advisor

One thing you could do is just iterate through the sheets and flip the excluded status temporarily so that you can print the originally excluded sheets as the non-excluded sheets.

 

Also. ThisApplication.ActiveDocument.DrawingPrintManager might be something to look at. [Which is easily found through Programming help]

 

 


--------------------------------------
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 6 of 6

Anonymous
Not applicable

drawing print manager will work if it is a print job. I am using translator addin to create the pdf with various options as required. presently I am using a workaround to do the same.

 

Dim oSheet As Sheet
            If Me.CheckBoxExcluded.Checked = True Then
                For Each oSheet In oDrgDoc.Sheets
                    If oSheet.ExcludeFromPrinting = True Then
                        oSheet.ExcludeFromPrinting = False
                    End If
                Next
            End If

' and as below
ElseIf RB_SheetsInRange.Checked = True Then
                    Dim i As Integer
                    i = Me.NumericUpDownStart.Value
                    Do
                        oDrgDoc.Sheets(i).Activate()
                        oDoc = oDrgDoc.ActiveSheet.DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument
                        strfilename = oDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
                        oDataMedium.FileName = Me.PathTextBox.Text & "\" & strfilename & ".pdf"
                        PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
                        i = i + 1
                    Loop Until i = Me.NumericUpDownEnd.Value + 1
                End If

 above is a part of my code which is using the workaround

0 Likes