Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic printing issue

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
kroweJ56Y9
205 Views, 5 Replies

iLogic printing issue

In the code that we have written for printing to our printer for some reason I keep getting an error message on "line 27 which is (oPrintMgr.Printer = PrinterSelect) or on "line 29" which is (oPrintMgr.ColorMode kPrintDefaultColorMode) but I posted the section in case there is something I am missing. This started when IT changed the name of our printers and the path where they were located. I updated all that as our form wasn't working but now those errors are popping up.

 Dim oPrintMgr As PrintManager
 oPrintMgr = oDocument.PrintManager
 'specify your printer name
 oPrintMgr.Printer = PrinterSelect
 
 oPrintMgr.ColorMode = kPrintDefaultColorMode
 oPrintMgr.Orientation = kLandscapeOrientation
 oPrintMgr.Scalemode = kCustomScale
 oPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
 oPrintMgr.PaperSize = SizePaper

 

5 REPLIES 5
Message 2 of 6
A.Acheson
in reply to: kroweJ56Y9

Hi @kroweJ56Y9 

It sounds like the printer name isn’t correct? Can you confirm the string value is right. Maybe check against the actual printer name when manually printing. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 6
kroweJ56Y9
in reply to: A.Acheson

Yes the print name is correct. I'll be completely honest I don't know very much about all this I'm just kind of muddling my way through. The guy that worked on all this, left the company and I've been trying to fix stuff/keep it updated. This is just being a thorn in my side. 

Message 4 of 6
A.Acheson
in reply to: kroweJ56Y9

I don’t use this type of code either so I am asking questions so hopefully another can spot the error. Can you show the whole code your using? This is only showing a partial code and not enough to do any testing. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 5 of 6
WCrihfield
in reply to: kroweJ56Y9

Hi @kroweJ56Y9.  It is very difficult, if not impossible, to debug code when we do not have access to the whole code.  For instance, what does 'PrinterSelect' represent, and what does 'SizePaper' represent in that code example.  It does not have any quotation marks around it, so it looks like either a local variable, or possibly the name of a Function routine that is supposed to return a String, or the unquoted name of a local parameter representing a text type UserParameter.  I also highly recommend that you include the names of those Enums, before the Enum variations, when setting those property values.  When writing code in VBA, it encourages us to only include the textual Enum variation, but in iLogic & vb.net, we are supposed to include the name of the Enum, before the name of the Enum variation.

 

Also, if this is a drawing (not a part or assembly) you are trying to print from, then you should 'declare' the variable's Type as DrawingPrintManager, not just as PrintManager, that way you have access to more specific properties, related to printing drawings.  The value of the PrintManager.PaperSize property is supposed to be a variation of the PaperSizeEnum, so if your 'SizePaper' variable does not represent that, it will likely not work either.

Dim oPrintMgr As DrawingPrintManager = oDocument.PrintManager
'specify your printer name
oPrintMgr.Printer = PrinterSelect '???
oPrintMgr.ColorMode = Inventor.PrintColorModeEnum.kPrintDefaultColorMode
oPrintMgr.Orientation = Inventor.PrintOrientationEnum.kLandscapeOrientation
'oPrintMgr.ScaleMode = Inventor.PrintScaleModeEnum.kPrintCustomScale
oPrintMgr.ScaleMode = Inventor.PrintScaleModeEnum.kPrintBestFitScale
oPrintMgr.PaperSize = SizePaper 'Inventor.PaperSizeEnum.kPaperSizeLetter

Just some additional thoughts / ideas to help figure this out for you.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 6
kroweJ56Y9
in reply to: kroweJ56Y9

I was a space off in the print name... Fixed that and everything worked as it should. Thank you everyone for your assistance!!

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report