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: 

print with ilogic

24 REPLIES 24
Reply
Message 1 of 25
ChristinaForest
7223 Views, 24 Replies

print with ilogic

dont have a before print Event Triggers 😉

 

i want to make a rule with automatic print with a right sheet size, but in all my try dont work 😞

that is my last one

 

'Dim oDraw As Document

oDraw = ThisApplication.ActiveDocument

oDrawDoc = ThisApplication.ActiveDocument

 

oDrgPrintMgr = oDrawDoc.PrintManager

oDrgPrintMgr.PrintRange = kPrintAllSheets

oDrgPrintMgr.AllColorsAsBlack = False

oDrgPrintMgr.ScaleMode = kPrintBestFitScale 'oDrgPrintMgr.ScaleMode = kPrintModel

 

'Printer setup, default printer

oPrintMgr = ThisApplication.ActiveDocument.PrintManager

oPrintMgr.ColorMode = kPrintDefaultColorMode

oPrintMgr.Orientation = kLandscapeOrientation

oPrintMgr.PaperSize = SizeActiveSheet
oPrintMgr.SubmitPrint

 

Sorry for my horrible english again and thanks for your help!

 

24 REPLIES 24
Message 2 of 25

another test

 

'impression

Dim oDraw As Document

 

oDraw = ThisApplication.ActiveDocument

oDrawDoc = ThisApplication.ActiveDocument

oDrgPrintMgr = oDrawDoc.PrintManager

question = MessageBox.Show("IMPRESSION DE LA PAGE ACTIVE?", "PRINT MANAGER",MessageBoxButtons.YesNo,MessageBoxIcon.Question)

nombredecopie = InputBox("COMBIEN DE COPIE", "PRINT MANAGER", "1")

 

If Cancel

Return

Else If question = vbNo Then

oDrgPrintMgr.PrintRange = kPrintAllSheets

oDrgPrintMgr.AllColorsAsBlack = False

oDrgPrintMgr.ScaleMode = kPrintBestFitScale

'oDrgPrintMgr.ScaleMode = kPrintBestFitScale

oPrintMgr = ThisApplication.ActiveDocument.PrintManager

oPrintMgr.ColorMode = kPrintDefaultColorMode

oPrintMgr.Orientation = kLandscapeOrientation

oPrintMgr.PaperSize = kPaperSizeB

oPrintMgr.SubmitPrint

Return

Else If question = vbYes Then

oDrgPrintMgr.PrintRange = kPrintCurrentSheet

oDrgPrintMgr.AllColorsAsBlack = False

oDrgPrintMgr.ScaleMode = kPrintBestFitScale

'oDrgPrintMgr.ScaleMode = kPrintBestFitScale

oPrintMgr = ThisApplication.ActiveDocument.PrintManager

oPrintMgr.ColorMode = kPrintDefaultColorMode

oPrintMgr.NumberOfCopies = nombredecopie

oPrintMgr.Orientation = kLandscapeOrientation

oPrintMgr.PaperSize = kPaperSizeB

oPrintMgr.SubmitPrint

End If 

Message 3 of 25

Hi,

 

I am struggling to understand your question, but the following code works well at my side. Could you take a look if it helps?

 

Dim oDrawDoc As Document
oDrawDoc = ThisApplication.ActiveDocument
 
 
 Dim oPrintMgr As PrintManager
 oPrintMgr = oDrawDoc.PrintManager
 'specify your printer name
 oPrintMgr.Printer = "\\cnbeipdwccmss01\BEIPRN002"
 
oPrintMgr.ColorMode = kPrintDefaultColorMode
oPrintMgr.Orientation = kLandscapeOrientation
oPrintMgr.PaperSize = SizeActiveSheet
oPrintMgr.SubmitPrint

 

Message 4 of 25
Cadmanto
in reply to: xiaodong_liang

Xiaodong,

I found this thread when doing a search.  I am trying to create an iLogic rule to print to my default printer.

This is what I have and the errors that show up.

rule.PNG

Can you tell me what I am missing and how to make it work?

Thanks

 

Inventor Suite 2012
Windows 7

Best Regards,
Scott McFadden
(Colossians 3:23-25)


Message 5 of 25

Hi Cadmanto,
I didn't test it, but I think you want to use:

kPrintBestFitScale rather than Best Fit

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 6 of 25

Hi Curtis,

I tried that and I am still getting this error message.

error.PNG

Here is what my code looks like.  Can you tell if there is anything that doesn't look right?

 

Inventor Suite 2012
Windows 7

 

Best Regards,
Scott McFadden
(Colossians 3:23-25)


Message 7 of 25

Hi Cadmanto,

 

I don't see the code listed just the error message, but here's a snippet to try. I tested this with my printer name and it works.

 

Note: please check your printer name for accuracy, in case I've retyped it incorrectly.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Dim oDrawDoc As Document
oDrawDoc = ThisApplication.ActiveDocument
 
Dim oPrintMgr As PrintManager
oPrintMgr = oDrawDoc.PrintManager

Dim sMyPrinter As String
sMyPrinter = "KONICA MINOLTA 423SeriesPCLFiltration" oPrintMgr.Printer = sMyPrinter oPrintMgr.ColorMode = kPrintDefaultColorMode oPrintMgr.Orientation = kLandscapeOrientation oPrintMgr.Scale = kPrintBestFitScale
oPrintMgr.PaperSize = kPaperSizeB
oPrintMgr.SubmitPrint

 

Message 8 of 25

Sorry Curtis.  I forgot to include the screen shot.  I have since modified it as per your suggestions and I am still getting the same error.

 

code.PNG

 

Inventor Suite 2012
Windows 7

Best Regards,
Scott McFadden
(Colossians 3:23-25)


Message 9 of 25

Hi Cadmanto,

 

hmmm, I'm not sure what would be the issue.

 

As a test can you comment out the Printer line as such:

' oPrintMgr.Printer = sMyPrinter

 

The printer used should then just be the last used printer. This will test to see if the problem concerns the printer name or some other line in the snippet.

 

Another thought would be to change the paper size line to:

oPrintMgr.PaperSize = kPaperSize11x17
or
oPrintMgr.PaperSize =kPaperSizeLetter
 
...just to make sure it isn't an issue with the printer not having the papersize specification as a choice.
 
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Message 10 of 25
xiaodong_liang
in reply to: Cadmanto

Hi Cadmanto,

 

Are you still having this issue? I agree with what 

Message 11 of 25
Cadmanto
in reply to: xiaodong_liang

Yes, I am still having the issue.  I at the moment have moved away from it.  I already have one that works for pdf, so I have tried that.  Thanks for the suggestion.  I did try what Curtis suggested, but at this point I am thinking this has something to do with how our network code to that printer is setup.

Usually things like this are something very simple.

 

Inventor Suite 2012
Windows 7 Professional
Intel (R) Xeon (R) CPU 3.47 GHz
12.0 GB Memory, 64 bit OS

Best Regards,
Scott McFadden
(Colossians 3:23-25)


Message 12 of 25
VdVeek
in reply to: Cadmanto

Scott, Where did you get your printername from?

When i copy my name from the standard print option from within Inventor and use this in the code for me it's working

So i use this code sMyPrinter = "\\SERVER001\7525_Boven"

 

PrintScreen.JPG

See also post 3 from xiaodong.liang for code that works.

Rob.

Autodesk Inventor 2015 Certified Professional & Autodesk Inventor 2012 Certified Professional.
Message 13 of 25
Cadmanto
in reply to: VdVeek

Hi Rob,

I originally got the printer name from the printer properties inside of control panel.

I tried what you suggested and it appears it has moved on from the printer name.

Now it is hanging up on the "Original Size".

These are the options in print manager.

print.PNG

and here is what I have so far in the code.

code.PNG

Inventor Suite 2012
Windows 7 Professional
Intel (R) Xeon (R) CPU 3.47 GHz
12.0 GB Memory, 64 bit OS

Best Regards,
Scott McFadden
(Colossians 3:23-25)


Message 14 of 25
VdVeek
in reply to: Cadmanto

oPrintMgr.OriginalSize is no option for the printer API. You did used oPrintMgr.PaperSize before in your code you posted here. That's the right option to set the size of the printerpaper. See also the post from Curtis where he wrote this:

oPrintMgr.PaperSize = kPaperSize11x17

or
oPrintMgr.PaperSize =kPaperSizeLetter

A good resource for this is the Autodesk Inventor 201* COM API Reference found under the questionmark Right-Top in the Inventor program. Go to Community resources, Programming Help and search for : Inventor.PaperSizeEnum Enumeration. Here you find all the posible sizes. There is also a sample about printing in the API reference.
 
If you read this tread back you find all the info you're looking for.
 
Rob.
Autodesk Inventor 2015 Certified Professional & Autodesk Inventor 2012 Certified Professional.
Message 15 of 25
Cadmanto
in reply to: VdVeek

Rob,

I have been playing with this all afternoon.  I have been going through this thread trying all kinds of variations that have been suggested here.  In my experimenting I have figured out that the "oPrintMgr.PaperSize" is the way to go.

Since I last posted I have at least gotten the rule to send to the printer.  Now the problem is it is coming out on letter size.  Even though I have specified both the "Bsize" and 11x17 and everytime I run the rule I get this message now.

Print.PNG

Thanks for the suggested links.  I will check them out.

 

Inventor Suite 2012
Windows 7 Professional
Intel (R) Xeon (R) CPU 3.47 GHz
12.0 GB Memory, 64 bit OS

Best Regards,
Scott McFadden
(Colossians 3:23-25)


Message 16 of 25
Cadmanto
in reply to: VdVeek

Rob,

I found the segment under the help, and I tried what they suggested (which was close to what I had), but it still printed out the 11 x 17 drawing on letter size.  I even went as far as commenting out this line and got the same result with the same error message as I posted in the last posting.

Kind of makes me wonder if this code line is even beeing recognized by the rule/printer.

This is what I got so far.

code.PNG

 

Inventor Suite 2012
Windows 7 Professional
Intel (R) Xeon (R) CPU 3.47 GHz
12.0 GB Memory, 64 bit OS

Best Regards,
Scott McFadden
(Colossians 3:23-25)


Message 17 of 25
VdVeek
in reply to: Cadmanto

It looks like the Inventor information isn't right. You need to use the PaperSizeEnum. before the papersize name or find the Value for the papersize format.

This is the way it works on my printer.

 

oPrintMgr.PaperSize = PaperSizeEnum.kPaperSizeA3

or

oPrintMgr.PaperSize = 14340

 

You can find this information in the Api help under: PaperSizeEnum Enumerator 

A part of this page:

kPaperSize10x1414337Paper size for 10x14.
kPaperSize11x1714338Paper size for 11x17.
kPaperSizeA014357Paper size for ISO A0 (Applicable to drawings only).
kPaperSizeA0Oversize14358Paper size for ISO A0 Oversize (Applicable to drawings only).
kPaperSizeA114359

Paper size for ISO A1 (Applicable to drawings only).

 

Rob.

Autodesk Inventor 2015 Certified Professional & Autodesk Inventor 2012 Certified Professional.
Message 18 of 25
Cadmanto
in reply to: VdVeek

Rob,

I actually thought you might have been on to something.  As it turns out it gives me the same error message as I have been getting.  I still get a print on an "A" size showing the middle of the 11 x 17 drawing.  I tried both the code and the text string based on what you suggested. from the API portion of the help.

log.PNG

code.PNG

 

error.PNGerror.PNG

 

I will continue to play with this trying different combinations.

Thanks again for your help.

 

Inventor Suite 2012
Windows 7 Professional
Intel (R) Xeon (R) CPU 3.47 GHz
12.0 GB Memory, 64 bit OS

Best Regards,
Scott McFadden
(Colossians 3:23-25)


Message 19 of 25
Ragnar111
in reply to: Cadmanto

Hi,

Oled topic but i have almost same problem like above writers.

Namely,

oPrintMgr.Scale = Bestfit

Doesn't work. Tried all varations.

oPrintMgr.Scale = kPrintBestFitScale
oPrintMgr.ScaleMode = kPrintBestFitScale
oPrintMgr.Scale = 1

etc.
Nothing works, still printing out as 1:1 .

Im using Inventor 2014.
(All other code is same as above)
Message 20 of 25
VdVeek
in reply to: Ragnar111

Ragnar111 to use the BestFitScale you first need to set the Scalemode to kCustomScale.

And than use PrintScaleModeEnum before the print scale. 

 

Hope this works for you.

Rob.

oPrintMgr.Scalemode = kCustomScale
oPrintMgr.ScaleMode = PrintScaleModeEnum.kPrintBestFitScale
Autodesk Inventor 2015 Certified Professional & Autodesk Inventor 2012 Certified Professional.

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

Post to forums  

Autodesk Design & Make Report