Skip to main content

Python Package Allows to interact with AVEVA E3D2.1.0.3 using AVEVA Embadded Python Interaction dll..

Project description

PyAVEVAE3D

PyAVEVAE3D contains Proof of Concept for Python 3 embedding into AVEVA Plant Design Products ( e.g. PDMS, E3D2.1/ 3.1, Diagrams, Engineering). These software are based on PML & PML.Net.

This repository has Visual Studio Project Solution. The Solution contains 2 main projects:

  • PyAVEVAInteraction : It contains the architectural skeleton for Python Embadding into AVEVA E3D2.1.0.3. and It invoks the either system level python or virtual enviroment python.

  • PyAVEVAE3DExt : It's Python extension module. It contains the c++ & python classes which allows python to directly interact with the AVEVA E3D.

Build Environment Information

  • AVEVA E3D Version : Mk2.1.0.3[Z2103-12] (WINDOWS-NT 6.1) (27 Apr 2016 : 23:54)
  • Python : Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 22:57:10) [MSC v.1929 32 bit (Intel)] on win32
  • Visual Studio : 2022

Procedure For Utilizing the Enviroment

  1. Copy following files from solution to the pmllib folder,

    ..\PyAVEVAE3D\PyAVEVAE3DExt\DataBridge.pmlobj

    ..\PyAVEVAE3D\PyAVEVAInteraction\RunPy.pmlfrm

  2. Create Python 32bit Virtual enviroment. and Create PML Global Variable for Accessing Python Virtual from E3D Session. Use the following pml command,

    !!pyVenv = |path to virtual environment/Scripts/python.exe|
    
  3. Copy Dll files from repository to Aveva Installation Directory.

    From : ..\PyAVEVAE3D\SampleDlls\PyAVEVAInteraction.dll

    To : %AVEVA_DESIGN_EXE%

  4. Install pyavevae3dext

    -- Method 1: using pip install pyavevae3dext.

    -- Method 2: Build the .pyd file based on the your module dependencies and build the package. Refer Development Documetation Section

  5. Open RunPy form using pml command Show !!RunPy. RunPy Form is used to write a test python scripts.

  6. Run Python Script form the Form. And All the output from python scripts will be printed in the AVEVA console. e.g. print("abc") in python will give the output in the python console.

More information on pyavevae3dext PiPy Package.

pyavevae3dext PiPy package has basically 3 classes.

  1. COMMON:

    Common Class Instentiation,

    from pyavevae3dext import *
    c = COMMON()
    

    Method to know about current mdb.

    c.mdb()
    

    Method to execute Savework command.

    c.savework()
    

    Method to execute Getwork command.

    c.getwork()
    

    Getter-Setter for CE,

    print(c.ce()) #Getter
    c.ce = "/ElementName" #Setter
    
  2. DB:

    Db Class Instentiation,

    from pyavevae3dext import *
    d = DB()
    

    Method to know Attributes on current elements,

    att = d.attributes()
    print(att)
    

    Method to Get Collection as List for the Element,

    elms = d.collectAllForElement("/SITE-CABLE-AREA03")
    print(elms)
    

    Method to Get Collection as List for the Element,

    elms = d.collectAllFor("PIPE BRAN", "/SITE-PIPING-AREA01 /SITE-PIPING-AREA02")
    print(elms)
    

    Method to Set String Attribute for Element,

    d.SetStringAttribute("/SITE-PIPING-AREA03", "Description",  "This is test description")
    

    Method to Set Real Attribute for Element,

    d.SetRealAttribute("/SITE-PIPING-AREA03", "Number", 5)
    

    Method to Set Bool Attribute for Element,

    d.SetBoolAttribute("/SITE-PIPING-AREA03", "Lock", True)
    
  3. PML:

    PML Class Instentiation,

    from pyavevae3dext import *
    p = PML()
    

    Method to Run the PML Command in PDMS Console,

    p.RunInPdms("$p This Message is From Python...")
    

    Method to Run the PML Command in .Net Environment,

    p.Run("/SITE-CABLE-AREA03") # /SITE-CABLE-AREA03 will be set as current element 
    

    To utilize the methods mentioned below, the variables in the PML Commandline must be defined as global variable.

    Run the below code in PML Commandline to define the pml global variable,

    !!AR[1] = 'A'
    !!AR[2] = 'b1'
    !!AR[3] = 'C'
    !BOOL = true
    !REAL = 5
    !STR = |Hii.. This message is From PML.|
    

    Method to get the Value of the PML Variable as String,

    value = p.GetPmlString("STR")
    print(value)
    

    Method to get the Value of the PML Variable as Long,

    value = p.GetPmlReal("REAL")
    print(value)
    

    Method to get the Value of the PML Variable as Bool,

    value = p.GetPmlBool("BOOL")
    print(value)
    

    Method to get the Value of the PML Variable as Array/ List,

    value = p.GetPmlArray("AR")
    print(value)
    

Procedure For Setting Up Development Enviroment

Refer the Development Documetation Section for Detailed Procedure for setting up development environment.

General Guideline

-- For Utilzing Python with Other AVEVA Software, Please install the Python version compatible to the AVEVA module architecture e.g. (x86, x64). and Make sure the platform architectural dependencies (Python and AVEVA Dll) for Build/ Release.

-- conda Environment as well conpatible. Make sure the conda environment platform architecture e.g. (x86, x64).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyavevae3dext-0.0.2.tar.gz (48.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyavevae3dext-0.0.2-py3-none-any.whl (45.6 kB view details)

Uploaded Python 3

File details

Details for the file pyavevae3dext-0.0.2.tar.gz.

File metadata

  • Download URL: pyavevae3dext-0.0.2.tar.gz
  • Upload date:
  • Size: 48.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.4

File hashes

Hashes for pyavevae3dext-0.0.2.tar.gz
Algorithm Hash digest
SHA256 58aac9e8bf85ce30ed615998c53795bcbf6b7d4a689ffac013cd13aecc6c0fe1
MD5 c29698fdfe7d93885bb4b3b5135e2ee0
BLAKE2b-256 51b1fd0de9994076bfe55d07451a5b27e0b4687b0947bd7f65ae49f4b2e4831c

See more details on using hashes here.

File details

Details for the file pyavevae3dext-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyavevae3dext-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 45.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.4

File hashes

Hashes for pyavevae3dext-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb27c67083f2925c86d3b98fe398c4f3f51beacc9819f8e537cb5a7aeb884386
MD5 5dd16315d495ce0e6989c13d57459b82
BLAKE2b-256 85949cd72e2d6aff57a5ed246e4d047220b7cbdec61d4c741207836e38eac554

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page