<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Trying to Use Python Script to Exclude Certain Objects from Build</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/40dd2f139a/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/40dd2f139a/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/40dd2f139a/</id><updated>2020-02-27T14:51:09.202000Z</updated><subtitle>Recent posts to Trying to Use Python Script to Exclude Certain Objects from Build</subtitle><entry><title>Trying to Use Python Script to Exclude Certain Objects from Build</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/40dd2f139a/?limit=25#6515" rel="alternate"/><published>2020-02-27T14:51:09.202000Z</published><updated>2020-02-27T14:51:09.202000Z</updated><author><name>mkeller</name><uri>https://forge.codesys.com/u/mkeller/</uri></author><id>https://forge.codesys.com5280c20adb366f1fbd23bcffc59262d84e539b23</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi KP_Henrob.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;KP_Henrob hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Hello all,&lt;br/&gt;
My goal is to have the same project be able to automatically decide which objects to include in a build based on what device its going to run on, or at least have an easy way to switch between possibilities. My first thought was to make a Python script that includes/excludes a pre-set list of objects in a build. I've been trying to use the .exclude_from_build property, however every object I've tried it on results in an error about it not having this attribute. After some research online, I saw someone used .build_properties before using .exclude_from_build, however tying this yields the same exact error. &lt;br/&gt;
Is there something I'm doing wrong/not doing? Is this the right way to go about my goal in the first place? Any ideas are greatly appreciated. &lt;br/&gt;
Codesys V3.5 SP12 Patch 1&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here is some example code:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;proj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;projects&lt;/span&gt;.&lt;span class="nv"&gt;primary&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nv"&gt;obj&lt;/span&gt; &lt;span class="nv"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;proj&lt;/span&gt;.&lt;span class="nv"&gt;get_children&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;True&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;:
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;obj&lt;/span&gt;.&lt;span class="nv"&gt;build_properties&lt;/span&gt; &lt;span class="nv"&gt;and&lt;/span&gt; &lt;span class="nv"&gt;obj&lt;/span&gt;.&lt;span class="nv"&gt;build_properties&lt;/span&gt;.&lt;span class="nv"&gt;exclude_from_build_is_valid&lt;/span&gt;:
        &lt;span class="nv"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;obj&lt;/span&gt;.&lt;span class="nv"&gt;get_name&lt;/span&gt;&lt;span class="ss"&gt;()&lt;/span&gt;
        &lt;span class="nv"&gt;print&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Object '{}' supports exclude from build&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;.&lt;span class="nv"&gt;format&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="ss"&gt;))&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;name&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MyFB&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;:
            &lt;span class="nv"&gt;obj&lt;/span&gt;.&lt;span class="nv"&gt;build_properties&lt;/span&gt;.&lt;span class="nv"&gt;exclude_from_build&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;True&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;BR&lt;br/&gt;
Martin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Trying to Use Python Script to Exclude Certain Objects from Build</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/40dd2f139a/?limit=25#1b0a" rel="alternate"/><published>2020-02-27T14:51:07.609000Z</published><updated>2020-02-27T14:51:07.609000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com516e4af48066b58c4b1e6e622fa2626a56f31015</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; KP_Henrob&lt;/p&gt;
&lt;p&gt;Hello all,&lt;br/&gt;
My goal is to have the same project be able to automatically decide which objects to include in a build based on what device its going to run on, or at least have an easy way to switch between possibilities. My first thought was to make a Python script that includes/excludes a pre-set list of objects in a build. I've been trying to use the .exclude_from_build property, however every object I've tried it on results in an error about it not having this attribute. After some research online, I saw someone used .build_properties before using .exclude_from_build, however tying this yields the same exact error. &lt;br/&gt;
Is there something I'm doing wrong/not doing? Is this the right way to go about my goal in the first place? Any ideas are greatly appreciated. &lt;/p&gt;
&lt;p&gt;Codesys V3.5 SP12 Patch 1&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>