Message 1 of 2
Rule :Model to PDF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have this code to export all parts to IMAGE file . But now i need to change to export all parts to PDF. I tried to edit the rule myself, but unsuccessfully.
Would anyone help me change this rule to *.PDF instead of *.jpg
Thansk,
Sub Main Dim oDoc As Document = ThisDoc.Document Dim oDocName As String = System.IO.Path.GetDirectoryName(oDoc.FullFileName) & "\" & System.IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName) If Not (oDoc.DocumentType = kAssemblyDocumentObject Or oDoc.DocumentType = kDrawingDocumentObject) Then MessageBox.Show(" " , "iLogic") Exit Sub End If For Each oRefDoc As Document In oDoc.AllReferencedDocuments DoBMP (oRefDoc) Next End Sub Sub DoBMP (ByVal aDoc As Document) Dim oDoc As Document = Nothing Try oDoc = ThisApplication.Documents.Open(aDoc.FullFileName, True) Dim FName As String = GetFName(oDoc.FullFileName) Dim sPN As String = iProperties.Value("Project", "Part Number") Dim sPNS = Mid(sPN, 7, 3) Dim sPZ As String = vbNullString If Not IsNumeric(sPNS) Then Exit Sub If Len(sPN) >= 3 Then sPZ = Left(sPN, 3) Else sPZ = sPN If iProperties.Value(FName, "Project", "Cost Center") = "V" Then Return If Val(sPN) >= 3 And Val(sSZ) < 900 Then Return ' Dim FName As String = oDoc.FullFileName Dim FNP As Integer = InStrRev(FName, "\", -1) FName = Mid(FName, FNP + 1) Dim oDTPs As PropertySet = oDoc.PropertySets.Item("Design Tracking Properties") Dim oPN As String = oDTPs.Item("Part Number").Value oPathAndName = Replace(oDoc.FullFileName, FName, oPN) Dim m_CV As Inventor.View = ThisApplication.ActiveView Dim m_Camera As Inventor.Camera = m_CV.Camera Dim m_TO As Inventor.TransientObjects = ThisApplication.TransientObjects m_Camera.ViewOrientationType = Inventor.ViewOrientationTypeEnum.kIsoTopLeftViewOrientation m_Camera.Fit() m_Camera.ApplyWithoutTransition() Dim m_PrevMode As Integer = m_CV.DisplayMode Dim m_Disp3D As Boolean = ThisApplication.DisplayOptions.Show3DIndicator m_CV.DisplayMode = Inventor.DisplayModeEnum.kShadedWithEdgesRendering ThisApplication.DisplayOptions.Show3DIndicator = False m_CV.Update() Dim oPath As String = "C:\PDF"& oPN &".jpg" If IO.File.Exists(oPath) Then IO.File.Delete(oPath) m_Camera.SaveAsBitmap(oPath, 800, 600, m_TO.CreateColor(255,255,255)) m_CV.DisplayMode = m_PrevMode ThisApplication.DisplayOptions.Show3DIndicator = m_Disp3D m_CV.Update() Catch ex As Exception MsgBox(ex.Message) Finally If oDoc IsNot Nothing Then oDoc.Close(True) End Try End Sub Function GetFName(FullName As String) As String Dim FNP As Integer = InStrRev(FullName, "\", - 1) Dim FName As String = Mid(FullName, FNP + 1, Len(FullName) - FNP) Return FName End Function