I am trying to grab the Session object from a Siemens NX server (on the same machine, i.e. localhost). I am using python 3.6 with pythonnet, since the remote connection (apparently) only works through .NET - I am VERY new to pythonnet (only tried it for this one function so far).
I need the Session object via remote because I want to grab some user inputs from the interface, therefore batch via run_journal is not an option.
The approach is based on what i found here: https://github.com/pythonnet/pythonnet/issues/276, but i get the error "TypeError: No method matches given arguments for GetObject"
import NXOpen
import clr
import System
theSession = System.Activator.GetObject(NXOpen.Session, "http://localhost:4574/Session")
I have also tried with GetObject(type(NXOpen.Session), ...)
with the same error.
How do I have to feed the NXOpen object type into the GetObject function?
alternatively, are there any better ways to remotely connect to a Siemens NX Session using Python?
The server is the sample NXOpen .NET remote server as found in \Siemens\NX 12.0\UGOPEN\SampleNXOpenApplications.NET\RemotingExample\Server
Late, but it seems i found a solution after all. First, as i installed python 'for all users', i copied all NXOpen libraries in the NX python module directory (i doesn't use an IDE, just Notepad++).
Here's a working example, runs fine with
python.exe file.py
and a .NET remoting server.