Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX filesize problem 1

Status
Not open for further replies.

nx-sk

Automotive
Jun 13, 2018
3
Hi, i am new in this board.
i am working since 2005 with UG NX - and now i have a problem....
I have to update a huge drawing and performance is killing my workstation...

drawing comes from NX3, contains 2 sheets and up to 120 views. Actual filesize is about 530MB!!!
One nearly identical drawing is 200MB.
Now i am working with NX11 and i am shure that there is much hidden garbage in that file that i can't find.
I tried several times partcleanup with all options.
Meanwhile I deleted all content of that drawing file (sheets, spreadsheets, ...) and the empty file is still at 250MB.

Does someone have any idea how i can find hidden elements, garbage or else that makes 250MB in an empty file?
 
Replies continue below

Recommended for you

Have you looked into seeing what is on your Layer 257? For us there were thousands if not million of extra lines on this hidden layer. You can only get to it VIA Vb programing. We had an issue with large Files sizes. This was our issue.
Run this program, it should spit out couple numbers, if they are not equal to each other, then this could be your issue. A guy here wrote this so hope it works for you. One more thing it may take a couple minutes to run.. If this is your issue. There is a program on GTAC to start you off with on how to delete these Extra lines.
Code:
Option Strict Off
Imports System
'Imports System.Linq
Imports System.Collections
Imports NXOpen

Module NXJournal
    Dim s As Session = Session.GetSession()
    Dim theSession As Session = s
    Sub Main()
		
        Dim theSession As Session = Session.GetSession()
        Dim wp As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
            Dim mark1 As Session.UndoMarkId = _
            theSession.SetUndoMark(Session.MarkVisibility.Visible, "mark1")

        'Dim objs As NXObject() = getAllObjectsInPart(wp)
        lw.Open()
        'lw.WriteLine(wp.Leaf & " has " & objs.Length.ToString & " objects")
		Dim objList As ArrayList = New ArrayList
		Dim cnt as integer
		Dim tmp as string
		cnt = 0
			
		Dim KeepList as ArrayList = New ArrayList


        	For ii As Integer = 1 To 256
            Dim objs As NXObject() = wp.Layers.GetAllObjectsOnLayer(ii)
            For Each obj As NXObject In objs
                if mid(obj.tostring,1,4) = "Line" then
				KeepList.Add(obj)
				'lw.WriteLine(obj.tag & " - " & obj.tostring)
				'cnt +=1
				'if	cnt>10 then exit for
			end if

			 'lw.WriteLine(obj.tag)	
            Next
        	Next

		
		
		Dim allLines() As Line = wp.Lines.ToArray()
		Dim DelLines() as Line
		Dim TtlList as ArrayList = New ArrayList(allLines)
		Dim i as long
		lw.WriteLine("Lines Count on 256 Layers" & KeepList.Count)
		lw.WriteLine("Lines Count on All Layers" & allLines.length)

		
'Dim myIndex As Integer

		'for i=0 to KeepList.Count-1
			'TtlList.
'myIndex As = myList.BinarySearch(myObject)
     




			'TtlList.Remove(KeepList(i))
		'Next

		'lw.WriteLine("Lines to Remove Count Layers" & TtlList.Count)

		'DelLines = CType(TtlList,NXObject)

		'theSession.UpdateManager.AddToDeleteList(DelLines)


		'theSession.UpdateManager.DoUpdate(mark1)

		'msgbox(KeepList.Count & " :: " & ubound(allLines)  & " :: " & TtlList.Count)
		
		'msgbox(KeepList.Count & " " & ubound(allLines))
		

exit sub


		
lw.WriteLine("End of Items 1-256")
msgbox("End of Layers")

cnt = 0
'Dim allLines() As Line = wp.Lines.ToArray()
			For Each thisLine As Line In allLines
				tmp = thisline.layer.tostring
				if tmp="257" then
				   'theSession.UpdateManager.AddToDeleteList(thisLine)
				echo(thisline.tostring)
					cnt=cnt+1
				end if 

	if	cnt>100 then exit for


	Next

'exit sub








    End Sub

    Sub Echo(ByVal output As String)

        s.ListingWindow.Open()
        s.ListingWindow.WriteLine(output)
        s.LogFile.WriteLine(output)

    End Sub

    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        Return Session.LibraryUnloadOption.Immediately
    End Function


End Module
 
Hmm...that seems to be the problem:
Output of your code is:

Lines Count on 256 Layers0
Lines Count on All Layers3731664

Now i have to look how get access to that GTAC Tool....

Thanks!
 
Holly cow you have the same problem we did. Ok Run this code below. You may want to run it on a different machine. It will take a long long time to run, Being 15 minutes to hours. Once again a guy here wrote this. He is good and give him props for this code. Hope this helps.

Code:
'Option Strict Off
Imports System
'Imports System.Linq
Imports System.Collections
Imports NXOpen

Module NXJournal
    Dim s As Session = Session.GetSession()
    Dim theSession As Session = s
	Dim KeepList as ArrayList = New ArrayList
    Sub Main()
		
        Dim theSession As Session = Session.GetSession()
        Dim wp As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
            Dim mark1 As Session.UndoMarkId = _
            theSession.SetUndoMark(Session.MarkVisibility.Visible, "mark1")

        lw.Open()

		Dim objList As ArrayList = New ArrayList
		Dim cnt as integer
		Dim tmp as string
		cnt = 0
		


		'Lines To keep	
		
        	For ii As Integer = 1 To 256
            Dim objs As NXObject() = wp.Layers.GetAllObjectsOnLayer(ii)
            For Each obj As NXObject In objs
                if mid(obj.tostring,1,4) = "Line" then
				KeepList.Add(obj)
				'lw.WriteLine("Lines to keep:" & obj.tag)
			end if
            Next
        	Next
		
		Dim allLines() As Line = wp.Lines.ToArray()
		Dim LineArray as ArrayList = new ArrayList(allLines)

		Dim i as long

		for i = 0 to KeepList.Count-1
			LineArray.Remove(KeepList(i))
		Next
		
		Dim DelLines as Line() = CType(LineArray.ToArray(GetType(Line)),Line())




		lw.WriteLine("Lines Count on 256 Layers " & KeepList.Count)
		lw.WriteLine("Lines Count on All Layers " & allLines.length)
		lw.WriteLine("First Value in allLines " & allLines(0).tostring)
		lw.WriteLine("First Value in KeepListLines " & KeepList(0).tostring)
		lw.WriteLine("Start Time " & Now)
		lw.WriteLine("Line Array Count " & LineArray.Count)
		lw.WriteLine("Line Array Count " & DelLines.Length)

		
		
				lw.WriteLine("Start Deleting" & now)
		theSession.UpdateManager.AddToDeleteList(DelLines)
		theSession.UpdateManager.DoUpdate(mark1)
		lw.WriteLine("Done Deleting" & now)

		
		exit sub
		
		
		




		'Dim j as integer
		'Dim n as integer
		'j=0
		'n=0
		'Dim kflg as boolean
		'for i = 0 to ubound(allLines)
			'kflg = InList(allLines(i).ToString)

			'if kflg = false then
				'if n = 0 then
					'DelLines(n) = allLines(i)
				'else
					'Redim Preserve DelLines(Ubound(DelLines)+1)
					'delLines(n) = allLines(i)
				'end if
				'lw.WriteLine("Lines to Delete " & delLines(n).tostring)
				'n+=1		
				
			'end if

		'next


	lw.WriteLine("End Time " & Now)


	'catch ex as exception


	'end try

		lw.WriteLine("Start Deleting" & now)
		theSession.UpdateManager.AddToDeleteList(DelLines)
		theSession.UpdateManager.DoUpdate(mark1)
		lw.WriteLine("Done Deleting" & now)


    End Sub

    Sub Echo(ByVal output As String)

        s.ListingWindow.Open()
        s.ListingWindow.WriteLine(output)
        s.LogFile.WriteLine(output)

    End Sub

    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        Return Session.LibraryUnloadOption.Immediately
    End Function

	Public Function InList(ByVal LineTag as string) as Boolean
		Dim m as integer
		Dim flg as boolean
		flg = false
	for m = 0 to KeepList.Count-1

		if KeepList(m).ToString = LineTag then
			flg = True
		else
			KeepList.Remove(LineTag)
		end if
		
	Next
	
	return flg	


	end Function



End Module
 
Hi SDETERS,
problem is now solved - with your code...
...it needed 9 1/2 hours to delete.
I first tried the GTAC Code - but that deleted only small part of that ghost-data.
Thanks!
 
NX frequently uses layer 257 to hide things permanently,
As you probably know we can only, interactively, control layer 1-256 .
once in a while one get to see that object xx is "on" layer 257.
I think that if one has NX set such that a sketch used by a extrusion disappears from the part navigator, - the curves and dimensions etc are moved to Layer 257.

But, it appears that in some rare cases NX drafting leaves large amounts of data that isn't used on layer 257.
I have reported such a case to GTAC.

Regards,
Tomas

 
I noticed that there are more of such layers... The CMM tool (while converting)moves stuff to layer 258.
I also saw that there is a NXopen sample which moves stuff to layer 257. So you could do this yourself if needed.

CMM converted part in History mode.
Timestamp_r8lgji.png


After switch from history to history-free mode and back.
258_xgxz3t.png


Ronald van den Broek
Senior Application Engineer
Winterthur Gas & Diesel Ltd
NX9 / TC10.1.2

Building new PLM environment from Scratch using NX11 / TC11
 
When we contacted GTAC, they wanted us to send the data into them to clean it. After going back and forth and waiting weeks to get our data cleaned, the above code is what was developed, We saw the bloat of our drawing in NX Version 7.5 or 7.0. Our drawings have been through the CMM process from I-Deas. So our drawings went from 23-30MB to 250MB to 23-30MB after we run the program above. huge improvements. We kind of narrowed it down to NX7 or NX7.5 time frame.

When the Drawing was CMM'd over the file size was fine, but when we did a saveas to a new revision the bloat happened.

I would like to see GTAC add something into the part cleanup. But They mentioned it did not have an impact on many customers. So just left it as is.

We just run this code when needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor