Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 783

Export PDF to TC w/Sorting

$
0
0

I have recently setup a new journal with the code below from this comment, http://nxjournaling.com/comment/4868#comment-4868. Is it possible to add sorting to this? When I use this to export, the sheets are not sorted numerically per sheet name/number. Using NX9.

Imports System
Imports NXOpen
 
Module NXJournal
Sub Main (ByVal args() As String) 
 
Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
 
Dim displayPart As NXOpen.Part = theSession.Parts.Display
 
Dim printPDFBuilder1 As NXOpen.PrintPDFBuilder = Nothing
printPDFBuilder1 = workPart.PlotManager.CreatePrintPdfbuilder()
 
'Get part number attribute (drawing must be work part)
Dim partnumber = workPart.GetUserAttribute("DB_PART_NO", NXObject.AttributeType.String, -1)
Dim partnumberstring = partnumber.StringValue
 
'Parameters
printPDFBuilder1.Relation = NXOpen.PrintPDFBuilder.RelationOption.Manifestation
 
printPDFBuilder1.DatasetType = "PDF"
 
printPDFBuilder1.NamedReferenceType = "PDF_Reference"
 
printPDFBuilder1.Scale = 1.0
 
printPDFBuilder1.Colors = NXOpen.PrintPDFBuilder.Color.BlackOnWhite
 
printPDFBuilder1.Size = NXOpen.PrintPDFBuilder.SizeOption.ScaleFactor
 
printPDFBuilder1.Units = NXOpen.PrintPDFBuilder.UnitsOption.English
 
printPDFBuilder1.RasterImages = True
 
printPDFBuilder1.ImageResolution = NXOpen.PrintPDFBuilder.ImageResolutionOption.Medium
 
printPDFBuilder1.Assign()
 
'Set sheets to an array of all drawing sheets
printPDFBuilder1.SourceBuilder.SetSheets(workpart.DrawingSheets.ToArray)
 
'Get part number attribute (drawing must be work part) and set as string
Dim partnumber = workPart.GetUserAttribute("DB_PART_NO", NXObject.AttributeType.String, -1)
Dim partnumberstring = partnumber.StringValue
 
'Assign Dataset name as part number
printPDFBuilder1.DatasetName = partnumberstring
 
Dim nXObject1 As NXOpen.NXObject = Nothing
nXObject1 = printPDFBuilder1.Commit()
 
printPDFBuilder1.Destroy()
 
End Sub
End Module

Viewing all articles
Browse latest Browse all 783

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>