cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Python library

Python library

Antonio3
Member

Hi everybody,

I am recently experimenting with Python scripting in PLC Engineering, and wondering if there is any python library to navigate through Objects(System, projects, etc.) more easily?

For example instead of studying the object "path" e.g. system.ui.choose() step by step from CODESYS Scripting Engine online help, just to type . and have access to some suggestions as usual. I think it would make programming much faster.

Kind regards

4 REPLIES 4

Sgilk
Contributor

Hello,

It looks like CODESYS has a Python Editor add-on with intellisense. I haven't used this, so no comment on its utility.

CODESYS Python Editor 

Alternatively, you could develop Python scripts in the environment of your choice (VS Code has tons of Python extensions) and execute them using the Python Runtime application on the ctrlX CORE via the PLC.

See CODESYS library documentation here: CXA_Python 

HmiGuide
Community Moderator
Community Moderator

There are 2 python programming environments in the ctrlX environment that have nothing to do with each other. Two different things, just use the same programming language.

1. python app of the ctrlX
Runs on the ctrlX and can execute e.g. motion commands. The python app is used by the IDE app.

2. plc engineering python script
Runs on the engineering PC. With this you can e.g. read and change PLC program code. There is a licenses for a python editor which makes it easier to create programs, by code completion and other help. But you do not need it. I don't have any experiance with this editor, but my experiance with the CoDeSys Python docu is: Could be much better, is is hard to understand. I got most information from examples, but even there could me more examples. 

Ahh, I see now I misunderstood the initial question.

If you are using the ctrlX PLC Engineering REST API, I don't think intellisense will be possible on the PLC project data since the interaction is stateless.

From a brief review of the CODESYS Python script engine it doesn't look like there is native intellisense functionality. I found a forum discussion around this topic and it looks like there may be a workaround, but I have not tried this myself.

CODESYS Python Engine API 

 

CodeShepherd
Community Moderator
Community Moderator

Are there any news? is this still an issue? Or can this topic be closed?

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist