iLogic print printer set up scale output too small

iLogic print printer set up scale output too small

andrew_canfield
Collaborator Collaborator
1,059 Views
5 Replies
Message 1 of 6

iLogic print printer set up scale output too small

andrew_canfield
Collaborator
Collaborator

Hello

 

This is the iLogic  script within the snippet:

	oPrintMgr = ThisApplication.ActiveDocument.PrintManager
oPrintMgr.ColorMode = kPrintGrayScale
'oPrintMgr.ColorMode = kPrintColorPalette
oPrintMgr.NumberOfCopies = 1
oPrintMgr.Orientation = kPortraitOrientation
'oPrintMgr.Orientation = kLandscapeOrientation
oPrintMgr.PaperSize = kPaperSizeCustom
oPrintMgr.PaperHeight = 11
oPrintMgr.PaperWidth = 8.5
oPrintMgr.SubmitPrint
	

 I was expecting the A2 drawing to be scaled to fit onto an A4 sheet - hopefully the printer settings are clear enough to read.

 

print1.JPG

 

 but it appears to be scaled down past A4 to A6 (or A7)? Basically much smaller than expected.

 

small print.JPG

 

Is there a 'fit to paper' option?

 

Regards

 

Andrew

0 Likes
Accepted solutions (1)
1,060 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

You need to access the DrawingPrintManager instead of the regular PrintManager, when printing drawings.  It has alot more options.  Here is an example I have used.

 

 

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDrgPrintMgr As DrawingPrintManager = oDDoc.PrintManager
' Set the printer name' comment this line to use default printer or assign another one
oDrgPrintMgr.Printer = "\\div29-fs-01\DIV29_ENGINEERING"
'To set the page range to "All Sheets", un-comment the next line, then comment out the rest of the page range lines.
oDrgPrintMgr.PrintRange = PrintRangeEnum.kPrintAllSheets
'To set the page range to "Current Sheet", uncomment the next line, then set all other page range lines to commented.
'oDrgPrintMgr.PrintRange = PrintRangeEnum.kPrintCurrentSheet
'To set the page range to "Sheets In Range", uncomment the next line, then set all other page range lines to commented.
'oDrgPrintMgr.PrintRange = PrintRangeEnum.kPrintSheetRange
'To set the "From" and "To" portion of the "Sheets In Range", un-comment the next line.   Only used when "Sheets In Range" is selected. example (first page of range , last page of range)
'oDrgPrintMgr.GetSheetRange(1,3)
oDrgPrintMgr.PrintExcludedSheets = False
oDrgPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
oDrgPrintMgr.PaperSize = PaperSizeEnum.kPaperSizeLetter
oDrgPrintMgr.Orientation = PageOrientationTypeEnum.kLandscapePageOrientation
oDrgPrintMgr.ColorMode = PrintColorModeEnum.kPrintDefaultColorMode
oDrgPrintMgr.NumberOfCopies = 1
oDrgPrintMgr.Rotate90Degrees = False
oDrgPrintMgr.AllColorsAsBlack = False
oDrgPrintMgr.RemoveLineWeights = False
oDrgPrintMgr.TilingEnabled = False
oDrgPrintMgr.SubmitPrint

 

 

I hope this helps.
If this solves your problem, or answers your questions, please click 'Accept As Solution".
Or, if this helps you reach your goal, please click 'LIKES" 👍.

 

Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.
If you agree with any of them, please vote for them.

  • Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
  • MessageBox, InputBox, and InputListBox Size & Format Options Click Here
  • Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
  • Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
  • Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
  • Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
  • SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

andrew_canfield
Collaborator
Collaborator

thanks

 

I'd like to run this as an external rule & different users have different printers.

Is there a way to use the printer they have set?

 

Regards

 

Andrew

 

0 Likes
Message 4 of 6

WCrihfield
Mentor
Mentor
Accepted solution

Yes.  Just leave out the line which defines which printer to use, and it should use whatever printer is default on the current system.

There are many things that could be done to customize the event.  I listed a lot of them in that code.  Almost all of them are optional, so you don't have to specify them if you don't want to, but if you don't it leaves those things up to change, and whatever setting was last used by the user when printing.

In the code below I show a simple example of how to set the scale for the output print, based on curent drawing sheet size, and Page Size of the expected output.

You could also have an InputListBox pop-up asking you to choose an output Paper size, if wanted, although that would take away some of the quick automation.

Also, in this revision of the code, you'll notice that I've captured the Orientation of the active Drawing Sheet, to use within the print settings.  I have also captured the active Drawing Sheet's size, Hight, & Width, for possible use within the print settings, for scale purposes.

 

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Drawing Documents.",vbOK, "WRONG DOCUMENT TYPE")
	Return
End If

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDPrintMgr As DrawingPrintManager = oDDoc.PrintManager
Dim oSheet As Sheet = oDDoc.ActiveSheet
Dim oSheetSize As DrawingSheetSizeEnum = oSheet.Size
Dim oSheetHeight As Double = oSheet.Height
Dim oSheetWidth As Double = oSheet.Width
Dim oOrientation As PageOrientationTypeEnum = oSheet.Orientation

'Set the printer name' comment this line to use default printer or assign another one
'oDPrintMgr.Printer = "\\div29-fs-01\DIV29_ENGINEERING"
oDPrintMgr.PrintRange = PrintRangeEnum.kPrintAllSheets
'oDPrintMgr.PrintRange = PrintRangeEnum.kPrintCurrentSheet
'oDPrintMgr.PrintRange = PrintRangeEnum.kPrintSheetRange
'oDPrintMgr.SetSheetRange(1,3)
oDPrintMgr.PrintExcludedSheets = False
'For custom scaled prints
oDPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintCustomScale
'Use math to compare Drawing Sheet size to Output Sheet Size to get scale factor
oDPrintMgr.Scale = 
'The following, if not specified, defaults to the Printer's default paper size
oDPrintMgr.PaperSize = PaperSizeEnum.kPaperSizeA4
oDPrintMgr.Orientation = oOrientation
oDPrintMgr.ColorMode = PrintColorModeEnum.kPrintDefaultColorMode
oDPrintMgr.NumberOfCopies = 1
oDPrintMgr.Rotate90Degrees = False
oDPrintMgr.AllColorsAsBlack = False
oDPrintMgr.RemoveLineWeights = False
oDPrintMgr.TilingEnabled = False
oDPrintMgr.SubmitPrint

 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 6

andrew_canfield
Collaborator
Collaborator

Thanks again - not sure if this is possible but... 

https://forums.autodesk.com/t5/inventor-customization/list-open-drawings-using-ilogic/m-p/9295202#M105388

this post started it off & the solution works were pdf's of all open drawings are created.

there are two subroutines -

1) .sub main iterates, 

2) sub pdf saves the files.

I thought I could replace the contents of 2) sub pdf with your code to print all open drawings -

But my copied code prints the same drawing 3 times  (if 3 drawings are open - fits to paper now!)

Sub Main
	Dim oDoc As Document
	
	'count open drawings 
	i = 0
	For Each oDoc In ThisApplication.Documents
		If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
			i+=1
		End If
	Next		
	
	'Get user input
	RUsure = MessageBox.Show("Within Inventor select FILE (Orange tab top left); PRINT; PRINT SET UP to select the printer & settings to use." _
	& vbLf & i & " Drawings open - Printing could take a while, do you want to continue?", "iLogic", _
	MessageBoxButtons.YesNo, MessageBoxIcon.Question)

	
	If RUsure = vbNo Then
	Return
	Else
	End If

	For Each oDoc In ThisApplication.Documents
		If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
			Call PrintPDF(oDoc)
			MessageBox.Show(i, "Title")

		End If
	Next		
	
'	If oDoc Is ThisApplication.ActiveDocument Then
'	oDoc.DrawingSettings.DeferUpdates = "True"
'	oDoc.Save
'	End If
	
'	MessageBox.Show("PDFs complete", "iLogic")
	
'	Try
'		Process.Start(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) & "\PDF")
'	Catch
'	End Try

End Sub

Sub PrintPDF(oDoc As Document)
	
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDrgPrintMgr As DrawingPrintManager = oDDoc.PrintManager
' Set the printer name' comment this line to use default printer or assign another one
''oDrgPrintMgr.Printer = "\\div29-fs-01\DIV29_ENGINEERING"
'To set the page range to "All Sheets", un-comment the next line, then comment out the rest of the page range lines.
oDrgPrintMgr.PrintRange = PrintRangeEnum.kPrintAllSheets
'To set the page range to "Current Sheet", uncomment the next line, then set all other page range lines to commented.
'oDrgPrintMgr.PrintRange = PrintRangeEnum.kPrintCurrentSheet
'To set the page range to "Sheets In Range", uncomment the next line, then set all other page range lines to commented.
'oDrgPrintMgr.PrintRange = PrintRangeEnum.kPrintSheetRange
'To set the "From" and "To" portion of the "Sheets In Range", un-comment the next line.   Only used when "Sheets In Range" is selected. example (first page of range , last page of range)
'oDrgPrintMgr.GetSheetRange(1,3)
oDrgPrintMgr.PrintExcludedSheets = False
oDrgPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
oDrgPrintMgr.PaperSize = PaperSizeEnum.kPaperSizeLetter
oDrgPrintMgr.Orientation = PageOrientationTypeEnum.kLandscapePageOrientation
oDrgPrintMgr.ColorMode = PrintColorModeEnum.kPrintDefaultColorMode
oDrgPrintMgr.NumberOfCopies = 1
oDrgPrintMgr.Rotate90Degrees = False
oDrgPrintMgr.AllColorsAsBlack = False
oDrgPrintMgr.RemoveLineWeights = False
oDrgPrintMgr.TilingEnabled = False
oDrgPrintMgr.SubmitPrint
	
	End Sub

 

very puzzling

 

Regards

 

Andrew.

 

 

0 Likes
Message 6 of 6

andrew_canfield
Collaborator
Collaborator

Can't believe I've sorted it!

 

replace lines 47 & 48 with

'Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDrgPrintMgr As DrawingPrintManager = oDoc.PrintManager

oDoc replaces oDDoc - guess sub routine main passed over the 3 drawings but subroutine 2 redefined each drawing as drawing 1 - thanks again.

0 Likes