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

NX crash with pdf export journal

$
0
0

Dear all,

I'm currently working on a journal file. The journal should export only the current drawing sheet to the file location of the part file of the current sheet.

However, something strange happens. During testing I discovered something weird. If I use the journal on a sheet it works fine. However, if I change the sheet size and use the journal file again NX crashes. I need windows task manager to get me out the mess I created.

The problems started when I changed the journal to incoperate the sheet size into the pdf. Before this the journal seemed to work fine but generated strange size pdf files.

I use NX10 on windows 7. I'm using the metric system (no idea why this should be important btw).

Any help would be greatly appreciated!

Kind regards,

Frank

Option Strict Off
Imports System
Imports System.IOImports System.CollectionsImports System.Windows.FormsImports System.Windows.Forms.MessageBoxImports NXOpen
Imports NXOpen.UF'MsgBox 
Module NXJournal
	Sub Main (ByVal args()AsString) 
		'0) StartDim theSession As NXOpen.Session= NXOpen.Session.GetSession()Dim workPart As NXOpen.Part= theSession.Parts.WorkDim displayPart As NXOpen.Part= theSession.Parts.DisplayDim sheet As Drawings.DrawingSheetDim FileLocation asstring 
			'Bepaal de volledige file locatie met part name
			FileLocation = theSession.Parts.Work.FullPath
			FileLocation = FileLocation.Substring(0, FileLocation.Length-4)'remove the last 4 characters of the path (de .prt) 
		'1) Open drafting
			theSession.ApplicationSwitchImmediate("UG_APP_DRAFTING") 
		'2) Updates all views in all drawings maar verandert niet de current sheets zodat enkel de current sheet geëxporteerd kan worden na pdf verderop in de code.ForEach tempSheet As Drawings.DrawingSheetIn workPart.DrawingSheetsForEach tempView As Drawings.DraftingViewIn tempSheet.GetDraftingViewsIf tempView.IsOutOfDateThen
						tempView.Update()EndIfNextNext 
		'3) Export PDF	+ 4)Overschrijf PDF	Dim dwg As Drawings.DrawingSheet= displayPart.DrawingSheets().CurrentDrawingSheetDim printPDFBuilder1 As NXOpen.PrintPDFBuilder
			printPDFBuilder1 = workPart.PlotManager.CreatePrintPdfbuilder()
			printPDFBuilder1.Scale=1.0
			printPDFBuilder1.Action= PrintPDFBuilder.ActionOption.Native
			printPDFBuilder1.Colors= PrintPDFBuilder.Color.BlackOnWhite
			printPDFBuilder1.Size= NXOpen.PrintPDFBuilder.SizeOption.ScaleFactor
			printPDFBuilder1.Units= NXOpen.PrintPDFBuilder.UnitsOption.English
			printPDFBuilder1.XDimension= dwg.height
			printPDFBuilder1.YDimension= dwg.length
			printPDFBuilder1.OutputText= NXOpen.PrintPDFBuilder.OutputTextOption.Polylines
			printPDFBuilder1.RasterImages=True
			printPDFBuilder1.Watermark=""Dim sheets1(0)As NXOpen.NXObjectDim drawingSheet1 As Drawings.DrawingSheet=CType(dwg, Drawings.DrawingSheet)
			sheets1(0)= drawingSheet1
			printPDFBuilder1.SourceBuilder.SetSheets(sheets1)
			printPDFBuilder1.Filename= FileLocation &".pdf"Dim nXObject2 As NXOpen.NXObject
			nXObject2 = printPDFBuilder1.Commit()
			printPDFBuilder1.Destroy() 
 
	EndSubEndModule

Viewing all articles
Browse latest Browse all 783

Trending Articles



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