×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Switch Part tool
4

Switch Part tool

Switch Part tool

(OP)
Hello all,

Switching between parts can be cumbersome and confusing with the Window menu, especially when many parts are open. Here is an alternative solution. See the attached image for a preview.

ADVANTAGES:
- the tool can be placed on a toolbar or used with mouse gestures for quick access (icon is included)
- organizes the parts into a hierarchy for better overview
- provides an image preview by moving the mouse over the parts listing

HOW TO INSTALL:
download the attached "NXSwitchPart_1_0.rar" and extract
place the dll and bmp file anywhere convenient
in NX: Customize ...> New User Command. With the new button, set Default style. Edit Action: Type: NXOpen, browse to the dll file.
Change button image > image name. browse to the bmp file.

Let me know if there are any issues.

NOTE: This tool does not alter any parts. Not tested with Teamcenter.

PREVIEW IMAGE: http://files.engineering.com/getfile.aspx?folder=2...

DLL & ICON: http://files.engineering.com/getfile.aspx?folder=8...

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Hello CNSZU.

Don't get me wrong, I very much appreciate the fact that you freely provide us with such a tool but....

What would be the benefit of this against the functionalities of the Assembly navigator?
I can see some benefit when you have a lot of parts open which are not in an assembly, but then again that's why there is the history navigator.

Ronald van den Broek
Mechanical Engineer
Cad Environment Coordinator
Wärtsilä, Propulsion Services
NX8.5.2 / TC9.1.2
HPZ420 Intel(R) Xeon(R) CPU E5-1620 0 @ 3.60GHz, 32 Gb Win7 64B
Nvidea Quadro4000 2048MB DDR5

RE: Switch Part tool

(OP)
It depends on how you use NX. As for the Assembly Navigator, it's fine if you keep the displayed part at the top level and only change the work part. That way, all the parts will be visible at all times in the navigator. The problem arises when you have several separate assemblies open and want to switch between them or when you change the displayed part. As for the History Navigator, it only displays a history of parts that have been opened, not the parts that are open in the current session. So, in a way, this tool fills a "gap" in the functionality in NX (actually, the Window menu takes care of this, but the tool improves on it).

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

I do not have NXOpen as an option in the button action list, I only have

Journal File
User Function
System Commands
User Tools
Macros
Grip
KF Function

????

Cheers

Si

Best regards

Simon NX 7.5.4.4 MP8 and NX 8.5 (native) - TC 8 www.jcb.com

RE: Switch Part tool

(OP)
A solution for those who don't have "NXOpen" in the list for button action type is as follows. Create a blank journal file and insert the code below:

CODE

Option Strict Off
Imports System
Imports NXOpen
Imports System.IO

Module NXJournal

    Sub Main(ByVal args() As String)

        Dim s As Session = Session.GetSession()
        Dim lw As ListingWindow = s.ListingWindow


'REPLACE THIS PATH WITH THE LOCATION OF THE DLL FILE:
'--------------------------------------------------------
	   Dim fullpath As String = "C:\NXSwitchPart.dll"
'--------------------------------------------------------


        If File.Exists(fullpath) Then

            Dim inObject() As Object = {}
            s.Execute(fullpath, "cNXSwitchPart", "Main", inObject)

        Else

            lw.Open()
            lw.WriteLine("Can't find " & fullpath)

        End If
      
    End Sub

End Module 

Be sure to insert the correct dll file path in the journal file. Or, download the journal file in this post (but you must still edit the dll file path). Now, you can choose "Journal" in the button action type and select the journal file. A disadvantage with this method is a slightly longer delay in the execution of the program.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

I'm running the journal, but it is saying there is an error in line 23 here is the code
Module NXJournal

Sub Main(ByVal args() As String)

Dim s As Session = Session.GetSession()
Dim lw As ListingWindow = s.ListingWindow


'REPLACE THIS PATH WITH THE LOCATION OF THE DLL FILE:
'--------------------------------------------------------
Dim fullpath As String = "H:\NXSwitchPart.dll"
'--------------------------------------------------------


If File.Exists(fullpath) Then

Dim inObject() As Object = {}
s.Execute(fullpath, "cNXSwitchPart", "Main", inObject)

Else

lw.Open()
lw.WriteLine("Can't find " & fullpath)

End If

End Sub

End Module

Best regards

Simon NX 7.5.4.4 MP8 and NX 8.5 (native) - TC 8 www.jcb.com

RE: Switch Part tool

(OP)
The code you pasted has some imports missing at the top. Can you confirm that line 23 is (click the button that says "goto line" in journal editor)

s.Execute(fullpath, "cNXSwitchPart", "Main", inObject)

What is the whole error message?

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

(OP)
This is strange, I'm not able to reproduce the error.

The only things I can think of is to make sure that the journal file has the extension .vb and that it is a vb file that you open with the button action type set to journal. This method has been tested successfully with NX 8.5 native with Windows 7 SP1 64 bit and with installed Microsoft .NET framework 4.5. Perhaps try installing this framework if you don't have it already (listed under installed programs). Otherwise, perhaps fact that you don't have the option NXopen in the button action type is related to this issue and that it prevents you from executing dll files.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Simon,

Is File -> Execute -> NXOpen... an option in your menu?

www.nxjournaling.com

RE: Switch Part tool

Hi Cowski

I don't have the NX open function on menu, but I can instigate it from the command finder when I run the dll file that CNSZU has kindly provided, it returns an error which reads

------------------------------------------------

Failed to load image - see log file for details

Fail name: C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\NXSwitchPart.dll

Function name: ufusr

---------------------------------------------

This is what is in the syslog.

&MACRO DYN_POP_BUTTON 2 ! Start
&MACRO MENU, 0, UG_FILE_RUN_UFUN UG_GATEWAY_MAIN_MENUBAR ! <CommandFinder>
&MACRO FILE_BOX -3, 0 ! Execute User Function
&MACRO MENU, 0, UG_FILE_RUN_UFUN UG_GATEWAY_MAIN_MENUBAR ! <CommandFinder>
&MACRO FILE_BOX -2, C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\NXSwitchPart.dll C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\*.DLL 0 ! Execute User Function
Using C:\Program Files\UGS\NX 7.5\ugii\managed\ManagedLoader.dll to load managed DLL
Trying to load C:\Program Files\UGS\NX 7.5\ugii\managed\ManagedLoader.dll
ManagedLoader.Load: C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\NXSwitchPart.dll Name:NXSwitchPart.dll
There are no context policies.

AppBase: C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\
System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\NXSwitchPart.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'file:///C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\NXSwitchPart.dll'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at ManagedLoader.Load(String assemblyName)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


The reason C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\NXSwitchPart.dll failed to load was:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\NXSwitchPart.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'file:///C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\NXSwitchPart.dll'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at ManagedLoader.Load(String assemblyName)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance pe
&MACRO FOCUS CHANGE OUT 1
&MACRO FOCUS CHANGE OUT 1
&MACRO FOCUS CHANGE IN 1
&MACRO MESSAGE_BOX -2 Failed to load image - see log file for details
&MACRO MESSAGE_TEXT
&MACRO MESSAGE_TEXT File name: C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\NXSwitchPart.dll
&MACRO MESSAGE_TEXT
&MACRO MESSAGE_TEXT Function name: ufusr
&MACRO MESSAGE_TEXT
&MACRO MENU, 0, UG_HELP_SYSTEM_LOG UG_GATEWAY_MAIN_MENUBAR ! <MB/Toolbar>

CHeers Si

Best regards

Simon NX 7.5.4.4 MP8 and NX 8.5 (native) - TC 8 www.jcb.com

RE: Switch Part tool

(OP)
Hi Simon, in your syslog it says "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded." I suspect this means that you have on your computer a .NET framework version lower than 4.5 which causes the dll to fail to load. One solution is to download and install the 4.5 .NET framework from Microsoft. Another solution, if you have .NET framework 4.0 on your computer, to download the "NXSwitchPart.dll" file in this post which has been modified to run on the 4.0 framework. If that fails, the reason might be that you are running NX 7.5, while this tool is compiled with NX Open 8.5.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

@CNSZU,
thank you for this program, something should offer OOTB
the problem is taken from the syslog:
Resolve failed: NXOpen.Utilities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null
Loaded: : NXOpen.Utilities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null
Verifying C:\Downloads\NXSwitchPart.dll for NXOpen signature.
NXOpen.Utilities.MissingResourceException: Assembly has not been compiled with an NX resource bundle
bei NXOpen.Utilities.ResourceUtilities..ctor(Byte[] assemblyData)
bei NXOpen.Utilities.BaseSession.verifyAssembly(String filename, Boolean& alliance_mode, SignatureType signTypeNeeded)
Validation failed

this dll has no signature - the sign resource are also not included.
It will only run with license offer an ufunc_runtime. Newer NX Licenses don't have this option. Was a change between Nx3/4 +5.
The developer must include the signing resource into the source code and use nx_sign from the ugii folder to sign the dll after compilation.
- as developer you need a dotnet author license from siemens.
Or you would be so kind to offer the code as journal.
regards
uwam2ie

RE: Switch Part tool

Thanks for trying, I still can't get to to run, the last journal you posted was as close as I got, but it errored at line 183 or something.

It's shame as this would be really usefull for us as our parts only display as part numbers in the window list so it's impossible to know what is what when we have many parts loaded.

Thanks for your effort anyway, much appreciated.

Si

Best regards

Simon NX 7.5.4.4 MP8 and NX 8.5 (native) - TC 8 www.jcb.com

RE: Switch Part tool

(OP)
Simon, could you give the exact error message or an image of the error?

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Hi

The error that appears reads (and it was line 185 not 183):-

Line 185: Expression expected.
Line 185: Name 'y' is not declared.
Line 185: End of statement expected.

Here is the end of my syslog.

!!!&MACRO CUSTOM 25 CATEGORIES * TL_SELECT * (1) * 0 * 0 ! Selection Bar
!!!&MACRO CUSTOM 25 CATEGORIES * TL_SELECT * (45) * 0 * 1 ! New Button
!!!&MACRO FILE_BOX -2, C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\open_component.bmp C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\*.bmp 0 ! Open Image File
!!!&MACRO FOCUS CHANGE IN 1
!!!&MACRO FILE_BOX -2, C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\NXSwitchPart.vb C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\*.VB 0 ! Open Action File
!!!&MACRO FOCUS CHANGE IN 1
!!!&MACRO EVENT ACTIVATE -50 0, 53, 1, 0, 0! Close
!!!&MACRO ASK_ITEM 53 (1 BLO 0) = 1 ! Close
!!!&MACRO DIALOG_END -3, -1 ! Customize: CANCEL
!!!&MACRO ASK_ITEM 0 (1 BTAB 0) = 8 !
!!!&MACRO ASK_ITEM 3 (1 BLO 0) = 0 ! New...
!!!&MACRO ASK_ITEM 4 (0 BOOL 0) = 0 ! Text Below Icon
!!!&MACRO ASK_ITEM 17 (1 BOOL 0) = 1 ! Always Show Full Menus
!!!&MACRO ASK_ITEM 18 (0 BOOL 0) = 1 ! Show Full Menus After a Short Delay
!!!&MACRO ASK_ITEM 22 (1 BOOL 0) = 1 ! Show ScreenMessages on Menus and Toolbars
!!!&MACRO ASK_ITEM 24 (0 BOOL 0) = 1 ! Show ScreenTips
!!!&MACRO ASK_ITEM 25 (1 BOOL 0) = 1 ! Show Shortcut Keys
!!!&MACRO ASK_ITEM 28 (1 RADI 0) = 1 ! Small (24)
!!!&MACRO ASK_ITEM 29 (1 RADI 0) = 0 ! Extra Small (16)
!!!&MACRO ASK_ITEM 30 (1 BOOL 0) = 0 ! Show Single Toolbar in Toolbar Options
!!!&MACRO ASK_ITEM 38 (1 RADI 0) = 0 ! ##01Top
!!!&MACRO ASK_ITEM 39 (1 RADI 0) = 0 ! Horizontal
!!!&MACRO ASK_ITEM 40 (1 RADI 0) = 0 ! ##01Top
!!!&MACRO ASK_ITEM 41 (1 BOOL 0) = 1 ! Show Selection MiniBar
!!!&MACRO ASK_ITEM 0 (1 BTAB 0) = 8 !
!!!&MACRO ASK_ITEM 53 (1 BLO 0) = 1 ! Close
!!!&MACRO FOCUS CHANGE IN 1
Using C:\Program Files\UGS\NX 7.5\ugii\managed\ManagedLoader.dll to load managed DLL
Trying to load C:\Program Files\UGS\NX 7.5\ugii\managed\ManagedLoader.dll
ManagedLoader.Load: C:\Program Files\UGS\NX 7.5\ugii\managed\NXOpen.Utilities.dll Name:ctx://Journal5fbc9459
There are no context policies.

AppBase: C:\Program Files\UGS\NX 7.5\ugii\managed\
Loaded assembly: NXOpen.Utilities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null from C:\Users\simon.wright\AppData\Local\assembly\dl3\D7EM5Z0G.OER\692853JK.VY0\0bd04c7c\00311fc4_9b0ecc01\NXOpen.Utilities.DLL
Loaded assembly: System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 from C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll
Loaded assembly: System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a from C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll
Adding C:\Program Files\UGS\NX 7.5\ugii\managed\\NXOpen.Utilities.dll as a reference item
Adding C:\Program Files\UGS\NX 7.5\ugii\managed\\NXOpen.dll as a reference item
Adding C:\Program Files\UGS\NX 7.5\ugii\managed\\NXOpen.UF.dll as a reference item
Adding C:\Program Files\UGS\NX 7.5\ugii\managed\\NXOpenUI.dll as a reference item


Journal execution results for C:\Users\simon.wright\Desktop\NXSwitchPart_1_0\NXSwitchPart.vb...
Syntax errors:
Line 185: Expression expected.
Line 185: Name 'y' is not declared.
Line 185: End of statement expected.

&MACRO FOCUS CHANGE OUT 1
&MACRO FOCUS CHANGE OUT 1
&MACRO FOCUS CHANGE IN 1
&MACRO MESSAGE_BOX -2 Line 185: Expression expected.
&MACRO MESSAGE_TEXT Line 185: Name 'y' is not declared.
&MACRO MESSAGE_TEXT Line 185: End of statement expected.
&MACRO MESSAGE_TEXT
&MACRO CUSTOM 24 XFORM_SEQUENCE 0 0.670759 0.740193 -0.046867 -0.296769 0.325769 0.897665 0.679713 -0.588209 0.438179 -1572.68 -43.5643 1836.97 0.10173 !
&MACRO MENU, 0, UG_HELP_SYSTEM_LOG UG_GATEWAY_MAIN_MENUBAR ! <MB/Toolbar>

Many thanks

Si

Best regards

Simon NX 7.5.4.4 MP8 and NX 8.5 (native) - TC 8 www.jcb.com

RE: Switch Part tool

(OP)
I think you get that error because the code on that line only works with .NET framework 4.5. I'm using visual studio and target the framework to 4.0, but still this code slips through, I don't know why. What is the .NET framework on your computer? I strongly urge you to update to the latest version from the microsoft website. Otherwise you might get more errors. If not, simply in the journal file add a " ' " to comment out the lines 183, 185 and 187 (the same way 182 is commented out). However this will prevent alphabetical ordering of the part list.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

OK, so progress!

I have commented out those lines and the journal will now run and open the switch part window and display the list!

However, I'm not getting any component preview in the little window when I move my cursor over a part. This is the same in TC and native NX.

Any ideas?

Cheers

Si

Best regards

Simon NX 7.5.4.4 MP8 and NX 8.5 (native) - TC 8 www.jcb.com

RE: Switch Part tool

(OP)
Congratulations! The reason you're not getting the previews could be that the parts themselves don't have any preview images saved with them. Check the History navigator or the File open dialog, the preview images you see there should be the same as you see in the Switch Part tool. If they are the same then the tool is working correctly.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

CNSZU,
Thanks for offering us the use of your great journal.
I've got it working fine, except, i work with large assemblies, up to 1000 parts. when the list comes up, it fills the screen from top to bottom, in alphabetical order as far as it can, but if i try to scroll down the list by picking the small down arrow at the bottom, it seems to slip off the end of the list, scroll wheel and arrow keys dont help either. Is there a way to go lower down the list?
Thanks

RE: Switch Part tool

and something else i noticed...
If i don't have many things in session, i get an arrow next to the sub-assemblies, but when i have a massive session open, it doesn't show the expand arrows on the sub assemblies.....maybe its to do with memory??

RE: Switch Part tool

(OP)
Hi moog, yes, I noticed that too with the up/down arrows not working, I'll fix that ASAP. About your second point, do you mean that you have one huge assembly where the top level part doesn't show the expand arrow? If we use the preview image on the opening post of this thread as an example, and we assume that A_Assy contains a huge number of parts and that A_Assy doesn't show the expand arrow? Roughly how many parts is in the assembly? It's a bit difficult for me to fix something like this because I don't have a big assembly to test with, but I'll try.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

CNSZU,
My assembly has 3800 parts, the top level, has about 20 assemblies, and then inside those there are single parts, as well as more sub-assemblies, and sub-sub-assemblies.
The top level has the arrow, and i can expand to see the next layer, but most of those are assemblies, which don't have arrows, and so can't be expanded any further.
I loaded an assembly structure with only 800 parts, and what it seems to do is list firstly the sub assemblies, then the single parts (within them, in alphabetical order, until it reaches the bottom of the screen, again, none of those sub-assemblies can be expanded

RE: Switch Part tool

(OP)
Here is a new version 1.1 of the NX Switch Part tool.

-parts are now listed in a tree structure
-all parts are now listed (suppressed and unloaded parts are included)
-all parts are listed exactly the same way as in the Assembly Navigator
-up/down arrows are fixed

HOW TO INSTALL:
download the attached "NXSwitchPart_1_1.rar" and extract
place the vb (journal) and bmp files together in a folder
in NX: Customize ...> New User Command. With the new button, set Default style. Edit Action: Type: Journal File, browse to the vb file.
Change button image > image name. browse to the Window_sc.bmp file.
Replace the path in the beginning of the journal file with the folder with the journal file and bmp files.

If there are any issues, let me know.

PREVIEW IMAGE: http://files.engineering.com/getfile.aspx?folder=1...

ICON & JOURNAL FILES: http://files.engineering.com/getfile.aspx?folder=1...

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Hi CNSZU,

It works very well

This is wonderful, I really appreciate

This is the weekend but I could not wait until Monday to test

Thanks a lot


Regards
Didier Psaltopoulos
http://www.psi-cad.com

RE: Switch Part tool

(OP)
Hi Didier, I appreciate your warm comments, it made it worthwhile for me to make this tool! Hopefully it will be useful to you. If you have any suggestions, let me know.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

(OP)
Hi moog, open the 3800 part assembly (don't open other separate assemblies), run the attached journal file, wait for the listing window to finish and the tool window to appear. Then, without moving the mouse over the tool window parts, close the window, save the listing window to a file, then upload the file here for me to check.

Also, I've noticed that there is a bug where the tool stops working in the "No Part" application (but still are parts in the session). I'll fix this in the next version.

If people have a wish list for extra functionality I'll try to incorporate that too.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

CNSZU,

Thank you for creating the Switch Part Tool journal. I have an enhancement request for the utility. Is there a way to have the journal script give a PACKED parts list to show only one occurrence of a part/assembly within each sub-assembly presented in the dialogs?

Thank you

NxPerson

NX852/Teamcenter 8.3.3.5

RE: Switch Part tool

(OP)
Hi NXPERSON,
I guess you mean by "packed" listing where in NX you right click the Assembly Navigator and choose Pack All? This is doable.
Actually, version 1.0 has an even more compact listing where ALL duplicates are removed from the listing (presented in a flat structure). Also, unopened/suppressed parts are not listed.
I'll create a settings dialog to select how the listing is presented (full/packed/no duplicates).

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Hi CNSZU,
very intersting tool.
It's possible implement the journ to add a custom attribute in the tree, this because the code or part number is not enough clear.

Thank you...

Using NX 8 and TC9.1

RE: Switch Part tool

Let the ER's begin!

Thanks for sharing your code. I hope you don't come to regret it.

www.nxjournaling.com

RE: Switch Part tool

Hi CNZSU,
I'm running into compiling issues (v1.1, NX7.5):
Line 611: AddHandler newContextMenuStrip.Opening, AddressOf newContextMenuStrip_Opening
Line 613: AddHandler newContextMenuStrip.Closing, AddressOf newContextMenuStrip_Closing
Line 614: AddHandler newContextMenuStrip.Closed, AddressOf newContextMenuStrip_Closed

Errors from NX log:
Line 611: Method 'Public Sub newContextMenuStrip_Opening(sender As Object, e As System.EventArgs)' does not have the same signature as delegate 'Delegate Sub CancelEventHandler(sender As Object, e As System.ComponentModel.CancelEventArgs)'.
Line 613: Method 'Public Sub newContextMenuStrip_Closing(sender As Object, e As System.EventArgs)' does not have the same signature as delegate 'Delegate Sub ToolStripDropDownClosingEventHandler(sender As Object, e As System.Windows.Forms.ToolStripDropDownClosingEventArgs)'.
Line 614: Method 'Public Sub newContextMenuStrip_Closed(sender As Object, e As System.EventArgs)' does not have the same signature as delegate 'Delegate Sub ToolStripDropDownClosedEventHandler(sender As Object, e As System.Windows.Forms.ToolStripDropDownClosedEventArgs)'.

If I comment these lines the script seems to work. What do these lines actually do? Does this have anything to do with my version of NX or the .net framework?

RE: Switch Part tool

(OP)
moog2: The last line in your debug file is "ERROR 9: C:\open_part.bmp". This means that the tool can't find the bmp files. Please change the path line in the debug journal file to point to the bmp files, then run the debug version journal again.

Cubalibre00: Do you mean to have a custom attribute to appear together with the part name in the Switch Part tool listing? This sounds like a very cool idea, I will look into it.

cowski: No, no, it's my pleasure. I'd be delighted if I can help people work more efficiently and enjoyable with this great program that is NX.

MartijnH: I think it's to do with your version of NX. It seems the compiler might be more fussy than in 8.5. And yes, those lines of code have no effect on the program, they were originally used for debugging.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Hi CNSZU,
yes, I mean to have a custom attribute to appear together with the part name in the Switch Part tool listing.
It's possible to have an input box at the top of the mask that filter or/and search trough the word entered ?

Thank you...

Using NX 8 and TC9.1

RE: Switch Part tool

CNSZU,
Here's a proper version of the debug window, you asked for..... Except, i DO get the proper final window with this debug version, and it seems to work a bit quicker as well (unless its because i have something to watch while its doing its thing).
But as i hover over the icons in the window, it shows the images, but it vanishes if i try to follow one of the sub-assemblies across, or move more than half way down the list.
And the last debug line then reads.... "ERROR 9: Error creating window handle."

RE: Switch Part tool

CNSZU,

Yes I would like to see the packed assembly as you have stated with an options dialog.

I have an issue when switching from a part while in the manufacturing application to a part that does not contain any manufacturing data. The part switches in NX, then the Manufacturing Environment dialog opens asking to create manufacturing setup in the switched to part. Now both the Manufacturing Environment and the Switch Part dialog boxes are both open. The only option that I have is to use task manager to close NX and to restart the software. It appears that the Switch Part tool dialogs need to be closed before the part is changed.

When switching from one part with manufacturing data to another part with manufacturing data, the Switch Part utility works as designed.

Thanks for your time with this utility to help the NX community. Looking forward to the next release of the utility.

NxPerson

NX852/Teamcenter 8.3.3.5

RE: Switch Part tool

(OP)
Finally, here is version 1.2 of the NX Switch Part tool which includes all feature enhancements and bug fixes requested by the posters.

Among the highlights, now it's possible to control the display of parts with attribute values as well as search against criteria such as part name, attribute and part state.

Version 1.2 change log:

Added options dialog box
Added option for packed/full listing
Addded option for item text (part name and up to 3 attribute values)
Added search dialog box
Added search option for part states (open, suppressed, closed, hidden)
Added search option for part name and attributes
Added method to open displayed part in Windows Explorer
Added statusbar with option to change listing view between Standard and Search
Added tooltips to show full path for each part
Added bold font for current display part
Faster startup time for large assemblies
Fixed bug where the tool would freeze for large assemblies (thousands of parts)
Fixed bug where the tool freezes in No Part mode
Fixed bug where some assemblies would get mixed up when multiple separate assemblies are open
Fixed bug where NX would freeze when switching to a non-manufacturing part in the Manufacturing application

Notes:
A file containing options will automatically be created in the path set in the journal file.
Access the menu by right-clicking anywhere in the window.
The options applies to both Standard List and Search List.
The tool might freeze when searching large assemblies where the search results in thousands of parts. Moog2, please test for me!
Tested with NX 8.5 native, Win 7 SP1, .NET framework 4.5

HOW TO INSTALL:
Download the attached "NXSwitchPart_1_2.rar" and extract (keep all files together in the same folder)
In NX: Customize ...> New User Command. With the new button, set Default style. Edit Action: Type: Journal File, browse to the vb file.
Change button image > image name. Browse to the Window_sc.bmp file.
Use notepad to replace the path in the beginning of the journal (vb) file with the folder with the journal file and image files.

As always, if there are bugs or feature requests, let me know:)

PREVIEW IMAGE: http://files.engineering.com/getfile.aspx?folder=8...

ICON & JOURNAL FILES: http://files.engineering.com/getfile.aspx?folder=7...

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Thanks for the new version, but unfortunately I get the following errors:

Syntax errors:
Line 466: 'GetUserAttributes' is not a member of 'NXOpen.Assemblies.Component'.
Line 485: 'GetUserAttributes' is not a member of 'NXOpen.Assemblies.Component'.
Line 781: 'GetUserAttributes' is not a member of 'NXOpen.Assemblies.Component'.
Line 791: 'StringValue' is not a member of 'NXOpen.NXObject.AttributeInformation'.
Line 798: 'StringValue' is not a member of 'NXOpen.NXObject.AttributeInformation'.
Line 1162: Method 'Public Sub newContextMenuStrip_Opening(sender As Object, e As System.EventArgs)' does not have the same signature as delegate 'Delegate Sub CancelEventHandler(sender As Object, e As System.ComponentModel.CancelEventArgs)'.
Line 1320: 'GetUserAttributes' is not a member of 'NXOpen.Assemblies.Component'.
Line 1328: 'StringValue' is not a member of 'NXOpen.NXObject.AttributeInformation'.
Line 1337: 'StringValue' is not a member of 'NXOpen.NXObject.AttributeInformation'.
Line 1346: 'StringValue' is not a member of 'NXOpen.NXObject.AttributeInformation'.

Does NXOpen have an other syntax in NX85? I'm working with NX7.5, windows 7 64bit

RE: Switch Part tool

(OP)
Hi MartijnH,

For the issue with "GetUserAttributes", that syntax is for NX 8.0 and above. To solve it, comment out
line 309
line 777 to 810
line 1317 to 1351
This will disable attribute functionality, but will at least get the program running.

For the issue on line 1162, to solve it, replace the "e As System.EventArgs" with "e As System.ComponentModel.CancelEventArgs".

Let me know if this helps. I will see what I can do to make attributes work with NX 7.5.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

I did not find the "e As System.EventArgs" in the actual VB code, but I commented line 1162 and that also works. Furthermore I had to comment line 466 and 485 also to get it working. I haven't tested it completely but it looks like everything is working. However, previews of the file does not work (it also did not work in version 1.1).

Thanks for this addon! I'm definitely going to use this.

RE: Switch Part tool

Hi CNSZU,
for me the tool works without error in NX8.
The only problem is the performance.
My OS is XP 32 bit, maybe an 64 bit OS is different, or maybe the code can be improved.

Thank you...

Using NX 8 and TC9.1

RE: Switch Part tool

(OP)
Hi Cubalibre00,

For performance there is not much I can do about the coding. At the startup, by far the longest time is spent loading the Windows form elements. Changing to a different type of interface, like the NX Block Styler, MIGHT be faster, however that has limitations (no flyout menus). Anyway, with my PC specs, the tool loads in about 3 seconds regardless of the number of parts open in the NX session. When the tool is loaded, it works smoothly.

Here are some tips to improve performance:
- Use an SSD hard disk
- If you have NXOpen, convert the journal to a DLL file and use that instead of the journal. After the first use, any subsequent loadings will be instant (within the session).
- Upgrading to Win7 and/or .NET framework 4.5 MIGHT also improve performance.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Thank you CNSZU for the tool developped.
At the moment I've the XP.
I will try to convert the .vb into .dll.

Thank you...

Using NX 8 and TC9.1

RE: Switch Part tool

Hi CNSZU,

I found an other 'bug' using NX75. Your script does not show subassys (it does with version 1.1). It only shows one sublevel, but not the 3rd level. Is this somewhere in the options which I have to set?

RE: Switch Part tool

(OP)
Hi MartijnH,
Is the listing view set to "Standard List"? What .NET framework version do you have?

For debugging, replace the sub around line 1536 with:

Sub newContextMenuStrip_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs)
cNXSwitchPart.LW.Open()
cNXSwitchPart.LW.WriteLine("newContextMenuStrip_Opening1")
Cursor = Cursors.WaitCursor
cNXSwitchPart.LW.WriteLine("newContextMenuStrip_Opening2")
If cNXSwitchPart.bSearchResult = False Then
cNXSwitchPart.LW.WriteLine("newContextMenuStrip_Opening3")
For i As Integer = 0 To sender.Items.Count - 1
cNXSwitchPart.LW.WriteLine("newContextMenuStrip_Opening4")
Dim modifyMenuItem As ToolStripMenuItem
modifyMenuItem = sender.Items(i)
If modifyMenuItem.DropDown.Items.Count = 0 And modifyMenuItem.Tag.childlist.count > 0 Then
cNXSwitchPart.LW.WriteLine("newContextMenuStrip_Opening5")
modifyMenuItem.DropDown = AddMenuItems(modifyMenuItem.Tag, 0)
End If
Next
End If
Cursor = Cursors.Default
End Sub

Run it (a listing window should appear when you move the mouse over an assembly) and let me know the result of the listing window.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

oh my god...... OH......MY......GOD this thing is brilliant. I loaded 2 very large assemblies and searched for a material that probably 80 percent of all the parts are made from, it took a minute or two, but it did it.....
And HOW FAST is this one at starting up EH? Congratulation CNSZU ... awesome.. it worked faultlessly NX8pc3thumbsup2

RE: Switch Part tool

(OP)
Hi moog2,

Thank you for testing it! And I'm very glad you're happy with it, if you want anything else to make it better, let me know:)

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Hi CNSZU,
I made a mistake interpreting your post about replacing e as System.EventArgs... Now I replaced the code in line 1536 and it now looks like: Sub newContextMenuStrip_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs). I also uncommented 1162, because that line calls this sub and now subassys do work again. However, I still do not see a preview, does this have to do something with .NET Framework? I have .NET 4.0 client.

RE: Switch Part tool

(OP)
Here is version 1.3 of the NX Switch Part tool.

Now it is possible to expand to the current displayed part by clicking a button on the status bar. Preview images should now work for NX 7.5.

Version 1.3 change log:

Added statusbar button to expand the menus to the displayed part (clicking again will cycle through multiple solutions if there are duplicate parts)
Added option for alphabetical listing of Standard List (requires restarting the tool)
Pressing ESC key will close tool windows
Fixed bug where the preview image was missing in NX 7.5
Fixed bug where the displayed part would sometimes change when closing the tool window
Fixed bug where a packed search list would show packed suppressed parts (now replaced with open parts)
Fixed other minor bugs

HOW TO INSTALL:
Download the attached "NXSwitchPart_1_3.rar" and extract (keep all files together in the same folder)
In NX: Customize ...> New User Command. With the new button, set Default style. Edit Action: Type: Journal File, browse to the vb file (choose NXSwitchPart75.vb for NX7.5)
Change button image > image name. Browse to the Window_sc.bmp file.
Use notepad to replace the path in the beginning of the journal (vb) file with the folder with the journal file and image files.

Additional details and instructions are found in the beginning of the vb file.

JOURNAL FILES: http://files.engineering.com/getfile.aspx?folder=d...

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

CNSZU

Thanks for your time creating this utility. This is a great addition to making NX more user friendly.

NxPerson

NX852/Teamcenter 8.3.3.5

RE: Switch Part tool

Dear CNSZU.

First of all. Congratulations on the tool! It is superb!

Version 1.3 seems to have 2 bugs for us.

1. Some issue when pressing the expand to displayed part:



Full error message

CODE -->

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at fMain.tsddbExpand_Click(Object sender, EventArgs e) in C:\Users\jevtho04\AppData\Local\Temp\NXJournals10148\journal.vb:line 1863
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.StatusStrip.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18052 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
ManagedLoader
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.0.0
    CodeBase: file:///C:/Program%20Files/Siemens/NX80/ugii/managed/ManagedLoader.DLL
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18044 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18060 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18060 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
NXOpen.Utilities
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.0.0
    CodeBase: file:///C:/Program%20Files/Siemens/NX80/ugii/managed/NXOpen.Utilities.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18047 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.18021 built by: FX45RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
journal
    Assembly Version: 0.0.0.0
    Win32 Version: 0.0.0.0
    CodeBase: file:///C:/Users/jevtho04/AppData/Local/Temp/NXJournals10148/journal.dll
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 10.0.0.0
    Win32 Version: 11.0.50709.17929 built by: FX45RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
NXOpen
    Assembly Version: 8.0.3.4
    Win32 Version: 8.0.3.4
    CodeBase: file:///C:/Program%20Files/Siemens/NX80/ugii/managed/NXOpen.DLL
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box. 

Descriptive part name is set to description.

2. It does not pack the components either:


NX8.0.3.4 TC 9.1.2.3.
HP Z820 / Quadro2000

RE: Switch Part tool

Hi

I have tried to get the latest version to run on NX7.5 and NX8.5 however both return this error.

ERROR: \\rocfp02\users\Roc-MIS\simon.wright\My Documents\NX_Switch_Part_1_3open_part.bmp

Any ideas what is causing this.

Cheers

Si

Best regards

Simon NX 7.5.4.4 MP8 and NX 8.5 (native) - TC 8 www.jcb.com

RE: Switch Part tool

(OP)
Hi Thor,

I'm sorry, I don't know why you're getting these problems, so I need your help in finding the solution.

1. expand to display part issue:
Does the error occur for only some displayed parts or all?
Does the error occur for just this assembly or all assemblies?

Please replace the code between
Private Sub tsddbExpand_Click(sender As Object, e As EventArgs) Handles tsddbExpand.Click
and
End Sub
with

CODE

Dim bFound As Boolean = False

        For Each c As ContextMenuStrip In openedContextMenuStripList
            c.Close()
        Next

        cNXSwitchPart.LW.Open()
        cNXSwitchPart.LW.WriteLine("start expand")
        cNXSwitchPart.LW.WriteLine("cNXSwitchPart.CycleIndex1: " & cNXSwitchPart.CycleIndex)

        cNXSwitchPart.CycleIndex += 1
        If cNXSwitchPart.CycleIndex > cNXSwitchPart.DisplayPartPathList.Count - 1 Then cNXSwitchPart.CycleIndex = 0

        cNXSwitchPart.LW.WriteLine("cNXSwitchPart.DisplayPartPathList.Count: " & cNXSwitchPart.DisplayPartPathList.Count)
        cNXSwitchPart.LW.WriteLine("cNXSwitchPart.CycleIndex2: " & cNXSwitchPart.CycleIndex)

        For i As Integer = 0 To cNXSwitchPart.DisplayPartPathList(cNXSwitchPart.CycleIndex).Count - 1

            cNXSwitchPart.LW.WriteLine("path: " & i & " " & cNXSwitchPart.DisplayPartPathList(cNXSwitchPart.CycleIndex)(i).name)

        Next


        Dim bToolStripMenuItem As New ToolStripMenuItem

        For i As Integer = 0 To cNXSwitchPart.DisplayPartPathList(cNXSwitchPart.CycleIndex).Count - 2 'do not include the last component (displayed part)

            cNXSwitchPart.LW.WriteLine("i: " & i)

            If i = 0 Then
                For j As Integer = 0 To tsMain.Items.Count - 1

                    cNXSwitchPart.LW.WriteLine("j1: " & j)

                    If tsMain.Items(j).Tag.name = cNXSwitchPart.DisplayPartPathList(cNXSwitchPart.CycleIndex)(i).name Then

                        cNXSwitchPart.LW.WriteLine("showdropdown1")

                        Dim aToolStripSplitButton As ToolStripSplitButton = tsMain.Items(j)
                        aToolStripSplitButton.ShowDropDown()

                        bToolStripMenuItem.DropDown = aToolStripSplitButton.DropDown

                    End If
                Next


            Else
                For j As Integer = 0 To bToolStripMenuItem.DropDownItems.Count - 1

                    cNXSwitchPart.LW.WriteLine("j2: " & j)

                    If bToolStripMenuItem.DropDownItems(j).Tag.name = cNXSwitchPart.DisplayPartPathList(cNXSwitchPart.CycleIndex)(i).name Then

                        cNXSwitchPart.LW.WriteLine("showdropdown2")

                        bToolStripMenuItem = bToolStripMenuItem.DropDownItems(j)
                        bToolStripMenuItem.ShowDropDown()
                        Exit For
                    End If
                Next
            End If
        Next

        For i As Integer = 0 To bToolStripMenuItem.DropDownItems.Count - 1
            If bToolStripMenuItem.DropDownItems(i).Tag.displayPart = True Then

                cNXSwitchPart.LW.WriteLine("select1")

                bToolStripMenuItem.DropDownItems(i).Select()
                AllMouseEnter(bToolStripMenuItem.DropDownItems(i).Tag)
                bFound = True
                Exit For

            End If
        Next

        If cNXSwitchPart.DisplayPartPathList(cNXSwitchPart.CycleIndex).Count = 1 Then

            cNXSwitchPart.LW.WriteLine("Count = 1")

            For i As Integer = 0 To tsMain.Items.Count - 1

                cNXSwitchPart.LW.WriteLine("i3: " & i)

                If tsMain.Items(i).Tag.displayPart = True Then

                    cNXSwitchPart.LW.WriteLine("select2")

                    tsMain.Items(i).Select()
                    AllMouseEnter(tsMain.Items(i).Tag)
                    Exit For
                End If
            Next
        End If

        If cNXSwitchPart.DisplayPartPathList.Count = 1 Then tsddbExpand.Enabled = False 

Run the journal again, press the button to expand to the troubled display part to recreate the error (a listing windows should open), then post the contents of the listing window here or upload it as a text file.

2. Packed list problem:
Have you selected the option "Packed" for listing view in the options? (right click the window to access it)
If you have, if you then do a search, does the search list show the parts as packed? (note down what the tool window title says)
This option should affect both Standard and Search List.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

(OP)
Hi Simon,

You need to add a backslash "\" after the path in the journal file. So in your case it should be ...My Documents\NX_Switch_Part_1_3\

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Dear CNSZU

Thanks for the prompt response.

1. It happens for all displayed parts in NX Managed. It works in a native assembly. I suppose the error is somewhere in our TC config.


CODE -->

start expand
cNXSwitchPart.CycleIndex1: -1
cNXSwitchPart.DisplayPartPathList.Count: 0
cNXSwitchPart.CycleIndex2: 0 


2. No, I was not aware of the right click possibility. It is working without issues. peace

NX8.0.3.4 TC 9.1.2.3.
HP Z820 / Quadro2000

RE: Switch Part tool

(OP)
Hi Thor,

I'm surprised you even got it running under TC, since I'm unable to test it in that mode. So unfortunately I can't fix that issue, unless someone can "convert" the code to work with TC.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

(OP)
Wow, it's fascinating to watch your video, Simon, and it shows everybody works in a different manner. I see that most of your parts are separate, rather than in an assembly. One bug I noticed is that some parts have the preview image shown as not loaded, but the icon is still a loaded icon (rather than a closed icon). So I guess there is some small issue with the code where in TC mode it doesn't retrieve the correct part states.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Hi CNSZU,
I'm testing your tool on windows 8.1 in Italian language and NX9 in English and during the use I've the error reported in the image attached.

P.S:I see you are good programmer, then, can you implement, if you have time and desire, the journal present in this forum that import component from text file.
I would like the journal that import components from Excel file (exported from a ERP) with quantity.

Thank you...

Using NX 8 and TC9.1

RE: Switch Part tool

(OP)
Hi Cubalibre00,

Are you using Windows 7?

For all the lines with the error, try adding "System." (without quotes) in front of "Windows". For example, on line 1755,

Cursor = Windows.Forms.Cursors.WaitCursor
becomes
Cursor = System.Windows.Forms.Cursors.WaitCursor

If that fails, try installing the latest .NET framework version.

As for your request, although I'm happy to add relevant functionality to this tool, I suggest you find someone to help you :)

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Hi CNSZU,
I'm using Windows 8.1.
The solution is to put 'System.' in fronto of all 'Windows' string.
I've error when I try to open the setting.
Windows 8.1 has .NET Framework 4.5 installed as default.

Thank you...

Using NX 8 and TC9.1

RE: Switch Part tool

(OP)
Hi Cubalibre00,

Do you mean adding "System." solved the problem? And now there is a different error? What do you mean by opening the setting? Could you give a screenshot?

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Hi CNSZU,
sorry for the delay.
For the first error, yes, I've resolved to put "System." in front of each string that start with 'Windows.', but another error came out if if open search or setting option.
Attached the error.
Remember that this error came out on Windows 8.1 and NX9.
In other situation works well.

Thank you...

Using NX 8 and TC9.1

RE: Switch Part tool

Hi CNSZU,

What is the difference resp. atvantage of your tool in comparison to the "Window" -> "More..." -> "Change Window" function, which is offered by NX as default? If I have the "Assembly Navigator" open and select one of the parts in the "Change Window" application in NX 7.5 the ANT - Preview Window reflects the preview of the selected part. In the "Change Window" application I have also the capability to filter the entire list by a search for a specific "term" in the name.

Regards

Matthias

RE: Switch Part tool

So maybe build the ANT preview window into the "Change Window" function?

Khimani Mohiki
Design Engineer - Aston Martin
NX8.5

RE: Switch Part tool

(OP)
Hi Matthias,

The main advantage of the Switch Part tool is that it gives you an overall view of the assemblies. Yes, the Change Windows tool will give you a preview if you click on the parts listed in the window, but the listing is not arranged in a hierarchy (as the Assembly Navigator provides). However, the Assembly Navigator does not show the whole structure if the displayed part is not at the top level. Moreover, the Switch Part tool provides a vital advantage in that it displays SEPARATE assembly structures that are currently open.

At the end of the day, how useful this tool is depends on the way you work with NX.

NX8.5 Win7SP1 64bit i7-3770K@4.3Ghz 16GB Quadro2000

RE: Switch Part tool

Good Morning Mathias

Try it and you will adopt it. It works also very well with Teamcenter TC8.3/NX7.5

The only disadvantage is the time to open with large assemblies


Regards
Didier Psaltopoulos
http://www.psi-cad.com

RE: Switch Part tool

Hi CNSZU,

What's the difference between Standard and Search list ?

And find below some enhancement request to your wonderfull program:


- Save the screen position
- Ability to have it already running ?

Regards
Didier Psaltopoulos
http://www.psi-cad.com

RE: Switch Part tool

(OP)
Hi Didier,

Standard List: Hierarchical display of all components.
Search List: Single level display of components. Which components to display is defined in the search options (right click to access).

Saving the position of the tool relative to the screen can be done.
By 'already running' do you mean that the tool is automatically executed when NX starts? This I don't know how to do. Maybe someone could give me advice on how to achieve this. Otherwise, a solution could be that the tool is constantly running, i.e. it doesn't close when you select a component, but this will prevent you from interacting with NX. If you are concerned about the time it takes to start up the tool, I would suggest that you convert the journal into a dll.

NX9 Win8.1 64bit i7-3770K 16GB Quadro2000

RE: Switch Part tool

Hi CNSZU,

The solution to Simon's issue with the path to the bmp file got me thinking. Would you consider dynamically setting the values for JournalDirectory and SettingsFile in the init() function so that the need to edit the source file to set installation location can be eliminated?

CODE --> VB.Net

JournalDirectory = Path.GetDirectoryName(theSession.ExecutingJournal) & "\"
SettingsFile = JournalDirectory & "Settings.dat" 

Regards,

Joe

RE: Switch Part tool

(OP)
That's brilliant, Joe! If that method works, it will certainly be useful in the future.

NX9 Win8.1 64bit i7-3770K 16GB Quadro2000

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources