All_Colors_As_Black not working properly

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to run a macro to export all of the .idw files in a folder to PDF. I managed to run everything smoothly, but some of my exported files are not completely black.
Some of them have gray lines which are not sharp at all, and others have even light blue lines.
I have tried to run the same procedure without the All_Color_As_Black option, and the gray lines stayed exactly the same, while the lines that were translated properly are now colored (red and green).
My code is the following:
' Get the PDF translator Add-In.
Dim PDFAddIn As TranslatorAddIn
Set PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
'Set a reference to the active document (the document to be published).
Dim oDocument As Document
Set oDocument = ThisApplication.ActiveDocument
Dim oContext As TranslationContext
Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
' Create a NameValueMap object for PDF exportation
Dim oOptions As NameValueMap
Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Create a DataMedium object for PDF exportation
Dim oDataMedium As DataMedium
Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
' Check whether the translator has 'SaveCopyAs' options
If PDFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
' Options for drawings...
oOptions.Value("All_Color_AS_Black") = 1
oOptions.Value("Remove_Line_Weights") = 0
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2
'oOptions.Value("Custom_End_Sheet") = 4
End If
For Each oDocument In ThisApplication.Documents.VisibleDocuments
' Make sure a drawing document is active.
If Not (TypeOf oDocument Is DrawingDocument) Then
'MsgBox "A drawing must be active."
GoTo NextDoc
End If
'Get model iProperties'
' Get the PropertySets object.
Dim oPropSets As PropertySets
Set oPropSets = oDocument.PropertySets
' Get the Inventor Summary Information set.
Dim oPropSet As PropertySet
Set oPropSet = oPropSets.Item("Inventor Summary Information")
' Get the revision number iProperty.
Dim RevNumber As Property
Set RevNumber = oPropSet.Item("Revision Number")
' Get the design tracking property set.
Set oPropSet = oPropSets.Item("Design Tracking Properties")
' Get the part number iProperty.
Dim PartNumber As Property
Set PartNumber = oPropSet.Item("Part Number")
'Get referenced Model iProperties'
Dim oDV As DrawingView
Dim oReffDoc As Document
Dim oReffPropSet As PropertySet
Dim oReffCustProp1 As Property
Dim oReffCustProp2 As Property
Dim oReffCustProp3 As Property
Dim oReffCustProp4 As Property
Dim drawDoc As DrawingDocument
Set drawDoc = oDocument
'Get file name'
FileName = Left(drawDoc.DisplayName, Len(drawDoc.DisplayName) - 4)
'Set the destination file name for PDFs
oDataMedium.FileName = FullPath & FileName & "_" & RevNumber.Value & ".pdf"
'Publish document.
Call PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
I don't understand why some drawings come out perfectly, while others (usually the most complicated ones) fail partially. The fact that when I deactivate the option All_Colors_As_Black only some lines change color made me think that the problem was in the idw file. But if I manually export the PDF from Inventor, setting all colors as black, then it works fine.
Any suggestion is much appreciated
Thanks
Alessandro