Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

OPC COM communicaton [Python, win32com]

More
20 Feb 2024 17:38 #12557 by support
Examples for OPC client and subscriber development in Python are now on GitHub: github.com/OPCLabs/Examples-QuickOPC-Python .

Please Log in or Create an account to join the conversation.

More
21 Nov 2023 13:44 #12408 by support
Note: QuickOPC now supports Python in much better way, cleaner syntax, and public packages (pypi.org/project/opclabs-quickopc/) on Python Package Index . See What's new in QuickOPC 2023.2 for more information. And, over 270 examples are available in the User's Guide!

Please Log in or Create an account to join the conversation.

More
21 Jan 2015 13:25 #2625 by support
I'm afraid that I cannot help you much. Note that there are some discussions on the Web (Google for it) about the same or similar problem. Anyway, I would look at following:

- Whether there isn't a 64-bit vs. 32-bit mismatch (e.g. the hosting process being run as 64-bit process but the Python extension DLL being compiled for 32 bits)
- How Blender determines where to load the Python extensions from (which directory), and whether win32com is truly placed there.

Best regards

Please Log in or Create an account to join the conversation.

More
21 Jan 2015 10:54 #2624 by n.cigala
Hello,

I'm triyng basically the same thing explained in this post, but I have problems importing wincom32.client in Blender's Python interpreter. I always get this error:
"ImportError: DLL load failed: %1 is not a valid Win32 application."

Same script in "normal" Python distribution works, so I think is a Blender configuration problem.

Best regards

Please Log in or Create an account to join the conversation.

More
08 May 2014 06:31 - 08 May 2014 06:37 #1947 by support
Dear Sir,

I have earlier thought about using various game and graphics engines to do interesting things with OPC data, and therefore I very much like what you are doing.

There is one part in your explanation that I do not understand, and I think that it is the main problem on your side as well, so let's focus on clarifying that first. The part is:

...I found your software (EasyOPC-DA) and I add the ProgID of this software to my python script. This just links python in blender to an OPC Client software, so I only read tags from the OPC Client software, and link them to my blender script logic to make what I need. But there is a problem, If I want to use a Matrikon OPC Client, I cannot find the ProgID to ink it with Python, and your software is the onlyone that can make that "ProgID = OPCLabs.EasyDAClient.5.2"

Therefore, I want to make some scripts to search tags, fing OPC Servers connected in my Network, write to tags on the PLC via OPC, etc, using your COM OPC Client via python.


OPC Data Access servers are COM objects (with their ProgIDs), but their interface is such that it cannot be consumed directly from Python. Our tool (EasyDAClient component in QuickOPC.COM) is yet another COM object, with its own ProgID, which connects to the underlying OPC servers. So, first you need to understand the difference between the ProgID of our component (which is always "OPCLabs.EasyDAClient.5.2", in the current version), and the ProgIDs of the OPC servers you actually want to connect to. For example, we provide our simulation OPC server, and its ProgID is "'OPCLabs.KitServer.2'".

You can see both of these in the code example:
import win32com.client
 
# Create EasyOPC-DA component 
easydaclient = win32com.client.Dispatch('OPCLabs.EasyDAClient.5.2') 
 
# Read item value and display it
print(easydaclient.ReadItemValue('', 'OPCLabs.KitServer.2', 'Demo.Single'))

In order to connect to different OPC servers, you need to find out what their ProgIDs are, and that provide that ProgID in the method call (e.g. ReadItemValue). You may find out the ProgIDs in various ways:
  • They should be in the documentation of each server
  • You can use some other OPC client with user interface (such as Matrikon, or even our Demo app for .NET or other demos) to view the servers installed, together with their ProgIDs - if you need help with this, let me know.
  • Programmatically, using QuickOPC, you can use the BrowseServers method, and it will return the information about OPC servers installed on a computer, including their ProgIDs - is that what you are interested in?

A question from my side: Were you able to make the basic connection, i.e. at least read a single tag (from our simulation server) into your Blender solution, or do you still need to figure that out?

Best regards
Last edit: 08 May 2014 06:37 by support.

Please Log in or Create an account to join the conversation.

More
08 May 2014 06:19 - 18 Jul 2014 06:56 #1946 by support
Dear Zbynek Zahradnik.

First, I want to apologize because my english is not very good loking, and because I answered late to your e-mail response because of the time here in Mexico.

Of course you can upload our conversation to your online Forum.

For me, it's a great experience having your help to this project.

So, I will start writing the obective and the things that I woud like to do.

I want to connect a Blender Game Engine project to a OPC Server, in order to adquire Tags sended by a PLC.

Blender is done with python, so, all the scripts made in python are easy inserted to it.

I have a model done in Solidworks and added to blender. This model is a mechanical piece that acts in real live when a pipe is near to it. It transfers a pipe fromone side to other. ike a stair.

I send you a Image of the Blender Model.

(image removed upon request of the author)

Then, I add physics to mi mechanical piece and the pipe, so, when it is in game engine module, it will act with gravity, forces, movement, aceleration, velocity, etc.

Now, I need to add a sensor to "sense" the pipe location. For this, I wil connect a PLC to a OPC Server that has the real sensor and the real KOP logic.

With that, I need that Blender goes for the state of the TAG that my OPC Server has. To do it, I know that OpenOPC has a library in python to search, connect, write, read, and do more things with the OPC Servers availabe on the net.

I add the link of this source: openopc.sourceforge.net/

The problem here is that OpenOPC is made for python 2.x versions, and Bender has 3.x versions. The syntaxis is diferent in many cases, and also it is difficult to interpretate them (because I am not an expert in python code).

The solution that I found here was to use win32com libraries for python, because this communicates the COM files betwen softwares, so there is where I found your software (EasyOPC-DA) and I add the ProgID of this software to my python script. This just links python in blender to an OPC Client software, so I only read tags from the OPC Client software, and link them to my blender script logic to make what I need. But there is a problem, If I want to use a Matrikon OPC Client, I cannot find the ProgID to ink it with Python, and your software is the onlyone that can make that "ProgID = OPCLabs.EasyDAClient.5.2"

Therefore, I want to make some scripts to search tags, fing OPC Servers connected in my Network, write to tags on the PLC via OPC, etc, using your COM OPC Client via python.

If you need more information of my research, I wil be gladly give it to you, and I hope that we coud find an answer to it.

Best regards!!
Last edit: 18 Jul 2014 06:56 by support.

Please Log in or Create an account to join the conversation.

More
08 May 2014 06:17 #1945 by support
Dear Sir,
Thank you for your interest in our products.

The QuickOPC-COM components can be used from many tools that are capable of acting as OLE automation controllers, and it is therefore nearly impossible to provide a big amount of examples in all of them. We generally resort to making a “proof of feasibility” with certain tool or language, for start, and then we add examples when there is more interest, or as they are created based on user requests as yours.

It looks like that you have already found the basic Python example, is that correct? (www.opclabs.com/products/quickopc/languages-and-tools/python ). This example will work with any OPC-DA server, provided that you have its ProgID, and the ItemID of the item you want to read.

If you need assistance with accommodating this to your server, or need more examples (e.g. browsing, writing), let me know. I will work with you to create them, if possible (we are not Python experts here, but we know our product very well).
What precisely do you need? Please describe it, and we will go from there.

Please Log in or Create an account to join the conversation.

More
08 May 2014 06:17 #1944 by support
Hi, let me introduce myself.
My name is M., and I'm working with the trial of EasyOPC.

Actually I'm interested in making a COM interface with python languaje, using win32com module. I'm trying to make some simulation with blender 3d software.

I woud like to know if you can send me more information about the COM usage, because I have only found in your webpage how to read a Tag from your ProgID.

Have a nice day, and let me know if you can help me, and I would like buy your app after my deveopment.

Best regards.

M.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.062 seconds