I created a journal that exports the Mass properties data to an excel sheet. However I wanted to try to implememnt a feature or an ability inside my spreadsheet. I am not sure what to call it, or even if it is possible.
The result of my code is the model part number, description and mass properties data for the active model. What I want to be able to do is, after exporting the data, when I select a cell that has the model part or description of a part, the part becomes highlighted in NX. So if I select multiple descriptive cells, the correspinding parts will become highlited in NX.
Do you guys think this can be accomplished?
You can probably do this with Remoting. the first step is to start a listener in your interactive NX session so that it is ready for the other program to try to connect to it.
Then your program running in Excel would make a remote call into the NX session to turn on highlighting. I have talked to at least one user who was able to get a VB program running in Excel to make remote calls into an NX session to manipulate geometry. This is not a trivial undertaking, and you will definitely need the NXOpen for .Net Author license, because this will only work with a compiled program. A Journal is automatically unloaded after it runs, but the program that starts the listener process has to stay loaded.
Search our online examples for the word "remoting". And good luck!
Hi, thanks for your answer. I was wondering if you knew where I could find some sample code that I might be able to work with to start devloping this?
I was doing some reading in the help docs about remoting, and it seems there is an option to access NX like you would a server, with no UI.
Could there be any potential benefits to working with large assemblies this way?
Also, how do I check to see if have the proper licenses?
If you have access to your license file, open it with any text editor and search for "dotnet_author".
If you do not find it, you will need to get it before you will be able to run an NXOpen .DLL or .EXE successfully.
We provide some remoting examples with the NX installation. Find your "ugopen" folder, and then under that, look for "SampleNXOpenApplications\.NET\RemotingExample". The Server code starts the listener, and the client attaches to the server process to create a part and some geometry in the server session. We also have some examples on the Solution Center - search for "nxopen sample remoting" and after the initial search, filter by Document Type for nx_api.
(I do not have any examples that demonstrate how to launch your client from Excel.)
Okay thanks. I had one more question actually.
Could you run Measure Bodies remotely if NX were running as a dedicated server process, or could that only be through the UI?
Well, I have not tested it, but the Inheritance Hierarchy for the MeasureBodies class shows that it inherits from NXRemotableObject, so I would expect it to work.
Hi, so I have successfully started the NX server process, and I am trying to run a .exe file that I got from the sample files included in my NX installation. I followed the instructions in the "Read Me" text file and compiled the sample code into an executable. I went to C:\ugs\nx10\UGOPEN\SampleNXOpenApplications\.NET\RemotingExample\Server.
The script is in C#.
When I go to run the client executable, NX just hangs and does not do anything. It freezes actually. I have to kill the process and restart everytime I try to run a remote process. The code was provided by siemens, and I didn't edit it at all.
The server code starts just fine however. Any ideas on why this is happening?
What version of NX are you running?
Did you build the .EXE as an x64 application, or as a Win32 application? In some releases, NX does not like for the executables to be built as "Any CPU".
If that doesn't resolve it, look in the syslog. You can set the UGII_TMP_DIR environment variable to control what folder NX uses to store the syslog.
If you can't tell from the log what is happening, please log an IR with GTAC, and provide the syslog.
I just thought of one more thing that might be causing you trouble.
Any time you want to run an NXOpen .Net .EXE, you must first copy all four of the NXOpen*.dll files from ...ugii\managed into the same folder where your .EXE lives. Do not rely on the fact that they look like they are in the PATH - just copy them over before you try to run the .EXE.
I just built the remoting examples in NX10.0.2, and they worked fine for me. Note that I did build the .EXE as an x64 application.
Also it is necessary to add a Reference to System.Runtime.Remoting to each project before building. I was surprised that this was not mentioned in the Readme.
Okay I went ahead and rebuilt the files into x64 applications. I also copied over those nxopen.dlls into the client directory. As far as adding a reference to System.Runtime.Remoting, does that mean I have to reference another .dll file in the project?