This course covers how to use the SystemWeaver API in Python. The user needs basic knowledge of Python and a Python interpreter installed. This tutorial is written and has been tested for Python 3.5.

What You Need

You need to install the pythonnet package from and run the following from a command prompt: 

pip3 install pythonnet

Make sure that SystemWeaverClientAPI.dll and RVFUtility64.dll are located in the same directory as your python file. 

Log in and Import API

In the first lines of your python file, use the following code to log in and import the API:

import clr

from SystemWeaverAPI import *
from SystemWeaver.Common import *


The following small example illustrates how you can log in to the test database and read data. You can follow the examples from Introduction to the SystemWeaver API in C# with only slight differences in the syntax.

    SWConnection.Instance.LoginName = "student"
    SWConnection.Instance.Password = "student"
    SWConnection.Instance.ServerMachineName = "localhost"
    SWConnection.Instance.ServerPort = 1768
    if SWConnection.Instance.Connected:
        handle = SWHandleUtility.ToHandle("x0400000000000296")
        item = SWConnection.Instance.Broker.GetItem(handle)
        for i in item.GetPartItems("EXAC"):        
            print("Component: %s \n" % i.Name)
except SWInvalidUsernameOrPasswordException:
    print("Invalid user or password\n")
except Exception:
    print("Could not connect to server\n")