Hallo, vielen Dank für die Info.
Jetzt werden von allen Blättern eine dxf erstellt, kann man auch nur von der Abwicklung eine dxf erstellen. Die Abwicklung hat die Option "nicht zählen" und "nicht drucken". Kann man das über diese Optionen machen?
Aktuell sieht der Code so aus:
If ThisApplication.ActiveDocument.DocumentType <> Inventor.DocumentTypeEnum.kDrawingDocumentObject Then
Return
End If
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim basePath As String
basePath = System.IO.Path.GetDirectoryName(oDrawDoc.FullFileName)
Dim baseName As String
baseName = System.IO.Path.GetFileNameWithoutExtension(oDrawDoc.FullFileName)
Dim oContext As TranslationContext
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
' PDF Translator
Dim oPDFAddIn As TranslatorAddIn
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
' DXF Translator
Dim oDXFAddIn As TranslatorAddIn
oDXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")
Dim i As Integer = 1
Dim totalSheets As Integer = oDrawDoc.Sheets.Count
Dim lastSheetIndex As Integer = totalSheets ' Das letzte Blatt ist der höchste Index
' Schleife durch alle Blätter der Zeichnung
For Each oSheet As Sheet In oDrawDoc.Sheets
Dim sheetName As String
sheetName = oSheet.Name
' Sonderzeichen entfernen
sheetName = System.Text.RegularExpressions.Regex.Replace(sheetName, "[\\\/:*?""<>|]", "_")
' PDF Export für alle Blätter außer dem letzten
If i < lastSheetIndex Then
' PDF Export vorbereiten
Dim oDataMedium As DataMedium
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
Dim oPDFOptions As NameValueMap
oPDFOptions = ThisApplication.TransientObjects.CreateNameValueMap
If oPDFAddIn.HasSaveCopyAsOptions(oDrawDoc, oContext, oPDFOptions) Then
oPDFOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintSheetRange
oPDFOptions.Value("Custom_Begin_Sheet") = i
oPDFOptions.Value("Custom_End_Sheet") = i
oPDFOptions.Value("Vector_Resolution") = 400
End If
' PDF-Datei speichern
oDataMedium.FileName = basePath & "\" & baseName & "_" & sheetName & ".pdf"
oPDFAddIn.SaveCopyAs(oDrawDoc, oContext, oPDFOptions, oDataMedium)
End If
' DXF Export nur für das letzte Blatt
If i = lastSheetIndex Then
' DXF Export vorbereiten
Dim oDXFOptions As NameValueMap
oDXFOptions = ThisApplication.TransientObjects.CreateNameValueMap
If oDXFAddIn.HasSaveCopyAsOptions(oDrawDoc, oContext, oDXFOptions) Then
oDXFOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintSheetRange
oDXFOptions.Value("Custom_Begin_Sheet") = i
oDXFOptions.Value("Custom_End_Sheet") = i
End If
' DXF-Datei speichern
Dim oDataMedium As DataMedium
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
oDataMedium.FileName = basePath & "\" & baseName & ".dxf"
oDXFAddIn.SaveCopyAs(oDrawDoc, oContext, oDXFOptions, oDataMedium)
End If
i += 1
Next
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP