CODESYS - the IEC 61131-3 automation software
https://forum.codesys.com/

Import of .gdc files
https://forum.codesys.com/viewtopic.php?f=18&t=9406
Page 1 of 1

Author:  aritra666 [ Tue Dec 25, 2018 11:27 am ]
Post subject:  Import of .gdc files

Cannot import .gdc file using scripts.

Code given below...


#---------- Import handler class
class Handler(NativeImportHandler):
def conflict(self, name, obj, guid):
print("Object already exists: ",name)
return NativeImportResolve.skip

def progress(self, name, obj, exception):
print("in progess: ", name)

def skipped(self, list):
for obj in list:
print("Skipped: ", obj.get_name())
def importFilter(name, guid,type,path):
return True;

handler = Handler()

#----------
proj = projects.primary

found = proj.find("Application", True)
app = found[0]

##Select Ethercat
drbus = proj.find('EtherCAT_Master', True)[0]
Drive_1 = drbus.find("Drive1",True)[0]
if Drive_1:
Drive_1.import_native("C:\\Users\\Aritra\\Desktop\\Exported files\\Drive1.gdc", importFilter, handler)
else:
print("Drive Not Found")

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/