Hello,
I'm trying to implement this warning into my PDF preview code. However I'm not able to check the referenced part material, or the iproperties material value of the drawing. Could someone help me with adding generic warning to my existing code ?
This is my current preview code:
'Update date
oTime = Now.ToShortDateString
iProperties.Value("Project", "Creation Date") = oTime
iLogicVb.UpdateWhenDone = True
temp_folder = System.IO.Path.GetTempPath()
'Update checked by user
oNAME = ThisApplication.GeneralOptions.UserName
iProperties.Value("Status", "Checked by") = oNAME
'Declare
oPath = ThisDoc.Path
oFileName = ThisDoc.FileName(False) 'without extension
oRevNum = iProperties.Value("Project", "Revision Number")
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
'2D of 3D bestand
If ThisDoc.Document.DocumentType <> kDrawingDocumentObject Then
'3D bestand error
MessageBox.Show("Het is niet mogelijk een 3D Bestand als PDF te openen", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
'2D bestand
Else
'------------------------------------------------------------------------
'PDF settings
oOptions.Value("All_Color_AS_Color") = 0
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
'2D bestand naar PDF folder zoeken
oFolder = Left(oPath, InStrRev(oPath, "\")) & "PDF"
'PDF naam definieren
oDataMedium.FileName = temp_folder & "\" & oFileName & _
"" & "" & ".pdf"
'PDF opslaan
Try
'probeer PDF op te slaan
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
'Open PDF with default program
ThisDoc.Launch(oDataMedium.FileName)
Catch
'Als opslaan niet lukt, geef error
MessageBox.Show("ERROR met PDF weergeven", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If