<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Insert new POU</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/</id><updated>2020-02-27T14:50:59.688000Z</updated><subtitle>Recent posts to Insert new POU</subtitle><entry><title>Insert new POU</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/?limit=25#d0fe" rel="alternate"/><published>2020-02-27T14:50:59.688000Z</published><updated>2020-02-27T14:50:59.688000Z</updated><author><name>PLKM</name><uri>https://forge.codesys.com/u/plkm/</uri></author><id>https://forge.codesys.com58e77e6c1cab494f513cec2ba18561c6afc9fe76</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;M.Schaber hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Hi,&lt;br/&gt;
In my test, it works with SP7.&lt;br/&gt;
One common mistake is that your script might work on the Task Call object below the Task configuration which is calling your PROGRAM - it has the same name as the PROGRAM it calls, and thus the script might accidentally find it, instead of the PROGRAM itself.&lt;br/&gt;
If that is not your problem, please send a stripped-down example project and script to  e &lt;a class="" href="mailto:support@codesys.com"&gt;support@codesys.com&lt;/a&gt; e , so we can reproduce and fix the problem.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;My fault. As you said i had chosen the PLC_PRG task instead of the PROGRAM itself.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Insert new POU</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/?limit=25#cea6" rel="alternate"/><published>2020-02-27T14:50:58.976000Z</published><updated>2020-02-27T14:50:58.976000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com3b994c832197e66e58e7fc18b14802b2a0829764</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; M.Schaber&lt;/p&gt;
&lt;p&gt;Hi,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;PLKM hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Is it possible that only POUs from type Function_Block can be edited with the IScriptTextDocument Methods.&lt;br/&gt;
Because a POU of type Program returns at request for has_textual_declaration and has_textual_implementation both with false (3.5 SP7), while returning true for type of Function_Block.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In my test, it works with SP7.&lt;/p&gt;
&lt;p&gt;One common mistake is that your script might work on the Task Call object below the Task configuration which is calling your PROGRAM - it has the same name as the PROGRAM it calls, and thus the script might accidentally find it, instead of the PROGRAM itself.&lt;/p&gt;
&lt;p&gt;If that is not your problem, please send a stripped-down example project and script to  e &lt;a class="" href="mailto:support@codesys.com"&gt;support@codesys.com&lt;/a&gt; e , so we can reproduce and fix the problem.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Insert new POU</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/?limit=25#307a" rel="alternate"/><published>2020-02-27T14:50:58.332000Z</published><updated>2020-02-27T14:50:58.332000Z</updated><author><name>PLKM</name><uri>https://forge.codesys.com/u/plkm/</uri></author><id>https://forge.codesys.combe0bbbec05f159f0108ee34b90ff49642d6b5d7d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;M.Schaber hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Hi,&lt;br/&gt;
Yes, they have to be created - but for creating them, you could always use the same PLCOpenXML template of an empty POU, which you could even embed as a string into your Python script. Then use rename and text editing functions to populate it.&lt;br/&gt;
HTH,&lt;br/&gt;
Markus&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Is it possible that only POUs from type Function_Block can be edited with the IScriptTextDocument Methods.&lt;/p&gt;
&lt;p&gt;Because a POU of type Program returns at request for has_textual_declaration and has_textual_implementation both with false (3.5 SP7), while returning true for type of Function_Block.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Insert new POU</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/?limit=25#a0c0" rel="alternate"/><published>2020-02-27T14:50:56.698000Z</published><updated>2020-02-27T14:50:56.698000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com929f952542c8c9fa131a99d35c9f96740bf94085</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; M.Schaber&lt;/p&gt;
&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, they have to be created - but for creating them, you could always use the same PLCOpenXML template of an empty POU, which you could even embed as a string into your Python script. Then use rename and text editing functions to populate it.&lt;/p&gt;
&lt;p&gt;HTH,&lt;br/&gt;
Markus&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Insert new POU</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/?limit=25#b1ea" rel="alternate"/><published>2020-02-27T14:50:56.077000Z</published><updated>2020-02-27T14:50:56.077000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.coma2e7cf0bf0ab7021e8294c93d9b04bff0f8dd8b5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; Maximilian.Blase&lt;/p&gt;
&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;let me first say thank you for your very quick response. Less than 30 minutes. I am impressed. Also it is a little bit funny because we are both from germany. Who cares.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;M.Keller hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
...&lt;br/&gt;
Since CODESYS V3.5 SP6 you can read and write the textual declaration and/or implementation part of POU objects which have one. Search for "IScriptTextDocument" and "IScriptTextualObjectMarker" in the ScriptEngine documentation.&lt;br/&gt;
...&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I've already read about this possibility and so this was my intention at the second step.  But at first i have to create new POUs and DTUs, or? Otherwise the objects have to be generated in the past manualy. This is the point i want to avoid.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br/&gt;
Maximilian&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Insert new POU</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/?limit=25#ec84" rel="alternate"/><published>2020-02-27T14:50:55.482000Z</published><updated>2020-02-27T14:50:55.482000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.com4b1a5dc90f2c4691ddeb3ac969855eefc1ef03ef</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi M. Blase.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Maximilian.Blase hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Hi @ all,&lt;br/&gt;
over four years have passed since the last entry. Therefore i wannted to ask again, if it is now possible to create a new POU or DTU with Python without xml im- and export.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Right now, this is not yet possible, but this improvement is already listed in our Jira tracker &lt;a class="" href="http://jira.3s-software.com/browse/CDS-44087" rel="nofollow"&gt;CDS-44087&lt;/a&gt; , so it will be implemented eventually.&lt;/p&gt;
&lt;p&gt;Since CODESYS V3.5 SP6 you can read and write the textual declaration and/or implementation part of POU objects which have one. Search for "IScriptTextDocument" and "IScriptTextualObjectMarker" in the ScriptEngine documentation.&lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Martin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Insert new POU</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/?limit=25#7ebc" rel="alternate"/><published>2020-02-27T14:50:53.848000Z</published><updated>2020-02-27T14:50:53.848000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com0ddca8206cb86b2ccab3fcbcc441e7daea19c4d8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; Maximilian.Blase&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;jbo hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Hi,&lt;br/&gt;
is it possible to insert a new POU by Python script?&lt;br/&gt;
Best regards,&lt;br/&gt;
jbo&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Hi @ all,&lt;br/&gt;
over four years have passed since the last entry. Therefore i wannted to ask again, if it is now possible to create a new POU or DTU with Python without xml im- and export.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br/&gt;
M. Blase&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Insert new POU</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/?limit=25#3e83" rel="alternate"/><published>2020-02-27T14:50:53.280000Z</published><updated>2020-02-27T14:50:53.280000Z</updated><author><name>timvh</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.comebe3ace5262dcb692d0ddb93b2aa81c6f83dc868</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Actually that is the normal behaviour, because you start a new empty project and then add the Device.&lt;br/&gt;
With the (manual) CoDeSys File New "Wizard" you can choose a standard project which let you select the Device and POU language. Only then it will add the Task and PLC_PRG automatically.&lt;br/&gt;
With the script I think the only solution is to add this yourself.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Insert new POU</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/?limit=25#f958" rel="alternate"/><published>2020-02-27T14:50:52.705000Z</published><updated>2020-02-27T14:50:52.705000Z</updated><author><name>jbo</name><uri>https://forge.codesys.com/u/jbo/</uri></author><id>https://forge.codesys.com99c414887978ccb9345819e8475449df4cecb5a6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;jbo hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
I have just tried out with CoDeSys V3.4 SP3 Patch 2 ==&amp;gt; It works&lt;br/&gt;
Was is a bug in CoDeSys V3.4 SP3 Hotfix 1?&lt;br/&gt;
I only changed the device version (3.4.3.0 ==&amp;gt;3.4.3.20):&lt;code&gt;\# add PLC
proj.add("LMC_PacDrive",4096,"0000 0001","3.4.3.20&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Sorry, that was a mistake.&lt;br/&gt;
It does not work&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: Geraete.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=228"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Insert new POU</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/0ca75f3fdc/?limit=25#b82d" rel="alternate"/><published>2020-02-27T14:50:51.078000Z</published><updated>2020-02-27T14:50:51.078000Z</updated><author><name>timvh</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.comba2669693bc16540bac6599325c5020ac5c7eb4c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I am not 100% sure, but I believe it is related to the device description file of the PLC.&lt;br/&gt;
If you haven't un-installed the previous version, you could choose the new device description in this older version and run the script again.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>