Community
cite="mid03D6E0B4CB2205E974C3C79089BD4003@in.WebX.maYIadrTaRb">
It loops (usually twice but up to infinity) in both 5.3 and 6 when I have
the printer specified directly or use the default printer. Doesn't seem to
make a difference as to version.
Was the bug in R6 and fixed in SP1. The particular machine I'm using
doesn't have SP1 loaded yet.
--
Sean Dotson, PE
http://www.sdotson.com
...sleep is for the weak..
-----------------------------------------
"Charles Bliss" <cbliss@cbliss.com> wrote in message
news:3DD26096.3020307@cbliss.com...
Is this user on R6 SP1 (106) or R5.3? If not, setting
PrintManager.Printer could be a dangerous thing as there was a defect
and the printer name would not be properly set. Try setting everything
up with "5D PDF Creator" as the Windows default printer and make sure
that is what Inventor is defaulting to then REM out the line in your
code which is oPrintMgr.Printer = "5D PDF Creator"
(then tell us if that was it)
"Sean Dotson wrote:
For another user I pieced together a quick and dirty way for a user to
a PDF (just calls the print routine) when the status of an IDW is set to
released. It works fine (print on a save) but for some reason after it
prints to the PDF it try to print again. Loops sometimes once or twice
and
sometimes forever. Thsi is the class module that is called by a sub..See
anything that jumps out at you?
BTW you'll have to change the printer manager value to your printer for
it
to run..... TIA
Private WithEvents oApplicationEvents As ApplicationEvents
Public Sub connect()
Set oApplicationEvents = ThisApplication.ApplicationEvents
End Sub
Private Sub oApplicationEvents_OnSaveDocument(ByVal DocumentObject As
Document, ByVal BeforeOrAfter As EventTimingEnum, ByVal Context As
NameValueMap, HandlingCode As HandlingCodeEnum)
'check to see if this is an IDW, if not then skip the whole macro
If ThisApplication.ActiveDocument.DocumentType = kDrawingDocumentObject T
hen
'Check if file is set to Released
' Declare the Application object
Dim oApplication As Inventor.Application
' Obtain the Inventor Application object.
' This assumes Inventor is already running.
Set oApplication = GetObject(, "Inventor.Application")
' Set a reference to the active document.
' This assumes a document is open.
Dim oDoc As Document
Set oDoc = oApplication.ActiveDocument
' Obtain the PropertySets collection object
Dim oPropsets As PropertySets
Set oPropsets = oDoc.PropertySets
' Access the value of the "Design Status" Property
Dim StatusValue As Variant
StatusValue =
oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kDesi
g
nStatusDesignTrackingProperties).Value
'If set to Released then print PDF file
If StatusValue = "3" Then
' Set a reference to the print manager object of the active document.
' This will fail if a drawing document is not active.
Dim oPrintMgr As DrawingPrintManager
Set oPrintMgr = ThisApplication.ActiveDocument.PrintManager
'Set the printer
oPrintMgr.Printer = "5D PDF Creator"
' Set to print in color.
oPrintMgr.ColorMode = kPrintColorPalette
' Set to print two copies.
oPrintMgr.NumberOfCopies = 2
' Set to print using portrait orientation.
oPrintMgr.Orientation = kPortraitOrientation
' Set the paper size.
oPrintMgr.PaperSize = kPaperSize11x17
' Get the name of the printer that will be used.
If MsgBox("Using printer """ & oPrintMgr.Printer & """ Do you want
to
continue?", vbYesNo + vbQuestion) = vbNo Then
' Change to another printer.
Dim sPrinterName As String
sPrinterName = InputBox("Enter name of new printer:", "New
Printer")
If sPrinterName = "" Then
Exit Sub
Else
oPrintMgr.Printer = sPrinterName
End If
End If
' Set to print all sheets.
oPrintMgr.PrintRange = kPrintAllSheets
' Set to print full scale.
oPrintMgr.ScaleMode = kPrintBestFitScale
' Submit the print.
oPrintMgr.SubmitPrint
' Change the number of copies to 1.
oPrintMgr.NumberOfCopies = 1
' Change the paper size to a custom size. The units are in
centimeters.
oPrintMgr.PaperSize = kPaperSize11x17
' Get and set the current sheet range.
Dim iFromSheet As Long
Dim iToSheet As Long
Call oPrintMgr.GetSheetRange(iFromSheet, iToSheet)
' Change the print range to print sheets 1 through 2.
oPrintMgr.PrintRange = kPrintSheetRange
Call oPrintMgr.SetSheetRange(1, 2)
' Submit the print.
oPrintMgr.SubmitPrint
Else
End If
Else
End If
End Sub
--
Sean Dotson, PE
http://www.sdotson.com
...sleep is for the weak..
-----------------------------------------
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Charles Bliss" <The
href="mailto:cbliss@cbliss.com">cbliss@cbliss.com> wrote in message
href="news:3DD266CE.1080502@cbliss.com">news:3DD266CE.1080502@cbliss.com...
bug was supposed to be fixed in R6SP1 (106). I haven't checked it in 106
yet. This problem did not exist in R5.3 so I suspect your problem is
elsewhere if the user is on R5.3sp2
@sean Dotson wrote:
type="cite">It loops (usually twice but up to infinity) in both 5.3 and 6 when I have
the printer specified directly or use the default printer. Doesn't seem to
make a difference as to version.
Was the bug in R6 and fixed in SP1. The particular machine I'm using
doesn't have SP1 loaded yet.
--
Sean Dotson, PE
http://www.sdotson.com
...sleep is for the weak..
-----------------------------------------
"Charles Bliss" <cbliss@cbliss.com> wrote in message
news:3DD26096.3020307@cbliss.com...
Is this user on R6 SP1 (106) or R5.3? If not, setting
PrintManager.Printer could be a dangerous thing as there was a defect
and the printer name would not be properly set. Try setting everything
up with "5D PDF Creator" as the Windows default printer and make sure
that is what Inventor is defaulting to then REM out the line in your
code which is oPrintMgr.Printer = "5D PDF Creator"
(then tell us if that was it)
"Sean Dotson wrote:
For another user I pieced together a quick and dirty way for a user to
a PDF (just calls the print routine) when the status of an IDW is set to
released. It works fine (print on a save) but for some reason after it
prints to the PDF it try to print again. Loops sometimes once or twice
and
sometimes forever. Thsi is the class module that is called by a sub..See
anything that jumps out at you?
BTW you'll have to change the printer manager value to your printer for
it
to run..... TIA
Private WithEvents oApplicationEvents As ApplicationEvents
Public Sub connect()
Set oApplicationEvents = ThisApplication.ApplicationEvents
End Sub
Private Sub oApplicationEvents_OnSaveDocument(ByVal DocumentObject As
Document, ByVal BeforeOrAfter As EventTimingEnum, ByVal Context As
NameValueMap, HandlingCode As HandlingCodeEnum)
'check to see if this is an IDW, if not then skip the whole macro
If ThisApplication.ActiveDocument.DocumentType = kDrawingDocumentObject T
hen
'Check if file is set to Released
' Declare the Application object
Dim oApplication As Inventor.Application
' Obtain the Inventor Application object.
' This assumes Inventor is already running.
Set oApplication = GetObject(, "Inventor.Application")
' Set a reference to the active document.
' This assumes a document is open.
Dim oDoc As Document
Set oDoc = oApplication.ActiveDocument
' Obtain the PropertySets collection object
Dim oPropsets As PropertySets
Set oPropsets = oDoc.PropertySets
' Access the value of the "Design Status" Property
Dim StatusValue As Variant
StatusValue =
oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kDesi
g
nStatusDesignTrackingProperties).Value
'If set to Released then print PDF file
If StatusValue = "3" Then
' Set a reference to the print manager object of the active document.
' This will fail if a drawing document is not active.
Dim oPrintMgr As DrawingPrintManager
Set oPrintMgr = ThisApplication.ActiveDocument.PrintManager
'Set the printer
oPrintMgr.Printer = "5D PDF Creator"
' Set to print in color.
oPrintMgr.ColorMode = kPrintColorPalette
' Set to print two copies.
oPrintMgr.NumberOfCopies = 2
' Set to print using portrait orientation.
oPrintMgr.Orientation = kPortraitOrientation
' Set the paper size.
oPrintMgr.PaperSize = kPaperSize11x17
' Get the name of the printer that will be used.
If MsgBox("Using printer """ & oPrintMgr.Printer & """ Do you want
to
continue?", vbYesNo + vbQuestion) = vbNo Then
' Change to another printer.
Dim sPrinterName As String
sPrinterName = InputBox("Enter name of new printer:", "New
Printer")
If sPrinterName = "" Then
Exit Sub
Else
oPrintMgr.Printer = sPrinterName
End If
End If
' Set to print all sheets.
oPrintMgr.PrintRange = kPrintAllSheets
' Set to print full scale.
oPrintMgr.ScaleMode = kPrintBestFitScale
' Submit the print.
oPrintMgr.SubmitPrint
' Change the number of copies to 1.
oPrintMgr.NumberOfCopies = 1
' Change the paper size to a custom size. The units are in
centimeters.
oPrintMgr.PaperSize = kPaperSize11x17
' Get and set the current sheet range.
Dim iFromSheet As Long
Dim iToSheet As Long
Call oPrintMgr.GetSheetRange(iFromSheet, iToSheet)
' Change the print range to print sheets 1 through 2.
oPrintMgr.PrintRange = kPrintSheetRange
Call oPrintMgr.SetSheetRange(1, 2)
' Submit the print.
oPrintMgr.SubmitPrint
Else
End If
Else
End If
End Sub
--
Sean Dotson, PE
http://www.sdotson.com
...sleep is for the weak..
-----------------------------------------
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Sean Dotson" <sean at sdotson dot com> wrote in message
href="news:1FDF4AF59379962294024FE4DF0165CB@in.WebX.maYIadrTaRb">news:1FDF4AF59379962294024FE4DF0......
D'oh.. just found it...
I have two oPrintMgr.SubmitPrint
commands in the code...getting rid of one of them fixes the
problem
<bonehead> sorry....
but I wonder why i was getting three prints
sometimes?
--
Sean Dotson, PE
href="http://www.sdotson.com">http://www.sdotson.com
...sleep is for
the weak..
-----------------------------------------
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Charles Bliss" <The
href="mailto:cbliss@cbliss.com">cbliss@cbliss.com> wrote in message
href="news:3DD266CE.1080502@cbliss.com">news:3DD266CE.1080502@cbliss.com...
bug was supposed to be fixed in R6SP1 (106). I haven't checked it in
106 yet. This problem did not exist in R5.3 so I suspect your problem
is elsewhere if the user is on R5.3sp2
@sean Dotson wrote:
type="cite">It loops (usually twice but up to infinity) in both 5.3 and 6 when I have
the printer specified directly or use the default printer. Doesn't seem to
make a difference as to version.
Was the bug in R6 and fixed in SP1. The particular machine I'm using
doesn't have SP1 loaded yet.
--
Sean Dotson, PE
http://www.sdotson.com
...sleep is for the weak..
-----------------------------------------
"Charles Bliss" <cbliss@cbliss.com> wrote in message
news:3DD26096.3020307@cbliss.com...
Is this user on R6 SP1 (106) or R5.3? If not, setting
PrintManager.Printer could be a dangerous thing as there was a defect
and the printer name would not be properly set. Try setting everything
up with "5D PDF Creator" as the Windows default printer and make sure
that is what Inventor is defaulting to then REM out the line in your
code which is oPrintMgr.Printer = "5D PDF Creator"
(then tell us if that was it)
"Sean Dotson wrote:
For another user I pieced together a quick and dirty way for a user to
a PDF (just calls the print routine) when the status of an IDW is set to
released. It works fine (print on a save) but for some reason after it
prints to the PDF it try to print again. Loops sometimes once or twice
and
sometimes forever. Thsi is the class module that is called by a sub..See
anything that jumps out at you?
BTW you'll have to change the printer manager value to your printer for
it
to run..... TIA
Private WithEvents oApplicationEvents As ApplicationEvents
Public Sub connect()
Set oApplicationEvents = ThisApplication.ApplicationEvents
End Sub
Private Sub oApplicationEvents_OnSaveDocument(ByVal DocumentObject As
Document, ByVal BeforeOrAfter As EventTimingEnum, ByVal Context As
NameValueMap, HandlingCode As HandlingCodeEnum)
'check to see if this is an IDW, if not then skip the whole macro
If ThisApplication.ActiveDocument.DocumentType = kDrawingDocumentObject T
hen
'Check if file is set to Released
' Declare the Application object
Dim oApplication As Inventor.Application
' Obtain the Inventor Application object.
' This assumes Inventor is already running.
Set oApplication = GetObject(, "Inventor.Application")
' Set a reference to the active document.
' This assumes a document is open.
Dim oDoc As Document
Set oDoc = oApplication.ActiveDocument
' Obtain the PropertySets collection object
Dim oPropsets As PropertySets
Set oPropsets = oDoc.PropertySets
' Access the value of the "Design Status" Property
Dim StatusValue As Variant
StatusValue =
oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kDesi
g
nStatusDesignTrackingProperties).Value
'If set to Released then print PDF file
If StatusValue = "3" Then
' Set a reference to the print manager object of the active document.
' This will fail if a drawing document is not active.
Dim oPrintMgr As DrawingPrintManager
Set oPrintMgr = ThisApplication.ActiveDocument.PrintManager
'Set the printer
oPrintMgr.Printer = "5D PDF Creator"
' Set to print in color.
oPrintMgr.ColorMode = kPrintColorPalette
' Set to print two copies.
oPrintMgr.NumberOfCopies = 2
' Set to print using portrait orientation.
oPrintMgr.Orientation = kPortraitOrientation
' Set the paper size.
oPrintMgr.PaperSize = kPaperSize11x17
' Get the name of the printer that will be used.
If MsgBox("Using printer """ & oPrintMgr.Printer & """ Do you want
to
continue?", vbYesNo + vbQuestion) = vbNo Then
' Change to another printer.
Dim sPrinterName As String
sPrinterName = InputBox("Enter name of new printer:", "New
Printer")
If sPrinterName = "" Then
Exit Sub
Else
oPrintMgr.Printer = sPrinterName
End If
End If
' Set to print all sheets.
oPrintMgr.PrintRange = kPrintAllSheets
' Set to print full scale.
oPrintMgr.ScaleMode = kPrintBestFitScale
' Submit the print.
oPrintMgr.SubmitPrint
' Change the number of copies to 1.
oPrintMgr.NumberOfCopies = 1
' Change the paper size to a custom size. The units are in
centimeters.
oPrintMgr.PaperSize = kPaperSize11x17
' Get and set the current sheet range.
Dim iFromSheet As Long
Dim iToSheet As Long
Call oPrintMgr.GetSheetRange(iFromSheet, iToSheet)
' Change the print range to print sheets 1 through 2.
oPrintMgr.PrintRange = kPrintSheetRange
Call oPrintMgr.SetSheetRange(1, 2)
' Submit the print.
oPrintMgr.SubmitPrint
Else
End If
Else
End If
End Sub
--
Sean Dotson, PE
http://www.sdotson.com
...sleep is for the weak..
-----------------------------------------
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Brian Ekins" <
href="mailto:brian.ekins@autodesk.com">brian.ekins@autodesk.com> wrote
in message
href="news:6830F9D990DB039A9ACE6E4BBE3465A4@in.WebX.maYIadrTaRb">news:6830F9D990DB039A9ACE6E4BBE3......
I think you also want to add a check at the top
of the function to check the value of the BeforeOrAfter argument. This
event should get fired twice when a document is saved, once before the save
and then again after. It wouldn't matter which one you listen for in
this case, but you only want to respond to one of them.
-Brian
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Sean Dotson" <sean at sdotson dot com> wrote in message
href="news:1FDF4AF59379962294024FE4DF0165CB@in.WebX.maYIadrTaRb">news:1FDF4AF59379962294024FE4D......
D'oh.. just found it...
I have two oPrintMgr.SubmitPrint
commands in the code...getting rid of one of them fixes the
problem
<bonehead> sorry....
but I wonder why i was getting three prints
sometimes?
--
Sean Dotson, PE
href="http://www.sdotson.com">http://www.sdotson.com
...sleep is for
the weak..
-----------------------------------------
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Charles Bliss" <The
href="mailto:cbliss@cbliss.com">cbliss@cbliss.com> wrote in message
href="news:3DD266CE.1080502@cbliss.com">news:3DD266CE.1080502@cbliss.com...
bug was supposed to be fixed in R6SP1 (106). I haven't checked it in
106 yet. This problem did not exist in R5.3 so I suspect your
problem is elsewhere if the user is on R5.3sp2
Sean Dotson
@ wrote:
cite="mid03D6E0B4CB2205E974C3C79089BD4003@in.WebX.maYIadrTaRb">It loops (usually twice but up to infinity) in both 5.3 and 6 when I have
the printer specified directly or use the default printer. Doesn't seem to
make a difference as to version.
Was the bug in R6 and fixed in SP1. The particular machine I'm using
doesn't have SP1 loaded yet.
--
Sean Dotson, PE
http://www.sdotson.com
...sleep is for the weak..
-----------------------------------------
"Charles Bliss" <cbliss@cbliss.com> wrote in message
news:3DD26096.3020307@cbliss.com...
Is this user on R6 SP1 (106) or R5.3? If not, setting
PrintManager.Printer could be a dangerous thing as there was a defect
and the printer name would not be properly set. Try setting everything
up with "5D PDF Creator" as the Windows default printer and make sure
that is what Inventor is defaulting to then REM out the line in your
code which is oPrintMgr.Printer = "5D PDF Creator"
(then tell us if that was it)
"Sean Dotson wrote:
For another user I pieced together a quick and dirty way for a user to
a PDF (just calls the print routine) when the status of an IDW is set to
released. It works fine (print on a save) but for some reason after it
prints to the PDF it try to print again. Loops sometimes once or twice
and
sometimes forever. Thsi is the class module that is called by a sub..See
anything that jumps out at you?
BTW you'll have to change the printer manager value to your printer for
it
to run..... TIA
Private WithEvents oApplicationEvents As ApplicationEvents
Public Sub connect()
Set oApplicationEvents = ThisApplication.ApplicationEvents
End Sub
Private Sub oApplicationEvents_OnSaveDocument(ByVal DocumentObject As
Document, ByVal BeforeOrAfter As EventTimingEnum, ByVal Context As
NameValueMap, HandlingCode As HandlingCodeEnum)
'check to see if this is an IDW, if not then skip the whole macro
If ThisApplication.ActiveDocument.DocumentType = kDrawingDocumentObject T
hen
'Check if file is set to Released
' Declare the Application object
Dim oApplication As Inventor.Application
' Obtain the Inventor Application object.
' This assumes Inventor is already running.
Set oApplication = GetObject(, "Inventor.Application")
' Set a reference to the active document.
' This assumes a document is open.
Dim oDoc As Document
Set oDoc = oApplication.ActiveDocument
' Obtain the PropertySets collection object
Dim oPropsets As PropertySets
Set oPropsets = oDoc.PropertySets
' Access the value of the "Design Status" Property
Dim StatusValue As Variant
StatusValue =
oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kDesi
g
nStatusDesignTrackingProperties).Value
'If set to Released then print PDF file
If StatusValue = "3" Then
' Set a reference to the print manager object of the active document.
' This will fail if a drawing document is not active.
Dim oPrintMgr As DrawingPrintManager
Set oPrintMgr = ThisApplication.ActiveDocument.PrintManager
'Set the printer
oPrintMgr.Printer = "5D PDF Creator"
' Set to print in color.
oPrintMgr.ColorMode = kPrintColorPalette
' Set to print two copies.
oPrintMgr.NumberOfCopies = 2
' Set to print using portrait orientation.
oPrintMgr.Orientation = kPortraitOrientation
' Set the paper size.
oPrintMgr.PaperSize = kPaperSize11x17
' Get the name of the printer that will be used.
If MsgBox("Using printer """ & oPrintMgr.Printer & """ Do you want
to
continue?", vbYesNo + vbQuestion) = vbNo Then
' Change to another printer.
Dim sPrinterName As String
sPrinterName = InputBox("Enter name of new printer:", "New
Printer")
If sPrinterName = "" Then
Exit Sub
Else
oPrintMgr.Printer = sPrinterName
End If
End If
' Set to print all sheets.
oPrintMgr.PrintRange = kPrintAllSheets
' Set to print full scale.
oPrintMgr.ScaleMode = kPrintBestFitScale
' Submit the print.
oPrintMgr.SubmitPrint
' Change the number of copies to 1.
oPrintMgr.NumberOfCopies = 1
' Change the paper size to a custom size. The units are in
centimeters.
oPrintMgr.PaperSize = kPaperSize11x17
' Get and set the current sheet range.
Dim iFromSheet As Long
Dim iToSheet As Long
Call oPrintMgr.GetSheetRange(iFromSheet, iToSheet)
' Change the print range to print sheets 1 through 2.
oPrintMgr.PrintRange = kPrintSheetRange
Call oPrintMgr.SetSheetRange(1, 2)
' Submit the print.
oPrintMgr.SubmitPrint
Else
End If
Else
End If
End Sub
--
Sean Dotson, PE
http://www.sdotson.com
...sleep is for the weak..
-----------------------------------------