Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

C++ API CONNECT TO ROBODK ON PORT

#1
I am having some difficulty using the C++ API to connect to RoboDK on a specific port. Can you please provide an example of doing this?

My specific use case is inside a class instance, connecting to an existing instance of RoboDK that was already started by another process. I can pass either pass the desired port number to connect to to the class constructor or to an init() method, but I do need to be sure that the class variable RDK is linked to that specific port number. The RDK variable needs to be available to all other class methods.
#2
You can check the port of the running instance of RoboDK by selecting Tools-Options-Other. When you connect via the API you should specify this same port.

This port is 20500 by default unless you started RoboDK with a custom -PORT command or you have multiple instances of RoboDK running.
#3
Hi Albert, thanks for the reply. That's what I assumed based on my previous use of the Python API.

It looks like the issue I was having was caused by two things:
- An instance of the RoboDK class is constructed and starts RoboDK.exe when constructing a parent class that has it as a class variable. (My own misunderstanding of C++.)
- The documentation for how to pass arguments is unclear because it does not directly follow from the Python API's method of passing arguments.

Marking this as resolved, but for future reference, the equivalency is below. It would be nice to add this information, or an example construction with args!="", here: https://github.com/RoboDK/RoboDK-API/tre...er/C%2B%2B or here: https://robodk.com/doc/en/CppAPI/index.html.
Python: RDK = robolink.Robolink(port=my_port, args=['-SKIPMAINT', '-NOUI'])
C++: RDK = new RoboDK("", my_port, "-SKIPMAINT -NOUI");
#4
OK great, thank you for your feedback!

We'll try to improve the docs and examples.
  




Users browsing this thread:
1 Guest(s)