<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Macro help. entity list if is_empty in PowerMill Forum</title>
    <link>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9087268#M13756</link>
    <description>&lt;P&gt;sorry, I should've paid closer attention. I'm glad you've got an answer. My code should've been something like this:&lt;/P&gt;
&lt;PRE&gt;IF $i == 0 {
  $selected_program = folder(ncprogram)&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;since the variable is already defined outside the loop. i think by re-initializng it inside the loop, it does not carry through once the loop ends.&amp;nbsp; Glad you got there!&lt;/P&gt;</description>
    <pubDate>Tue, 15 Oct 2019 12:29:37 GMT</pubDate>
    <dc:creator>TK.421</dc:creator>
    <dc:date>2019-10-15T12:29:37Z</dc:date>
    <item>
      <title>Macro help. entity list if is_empty</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084286#M13748</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I simply got into a problem.&lt;BR /&gt;I can't exactly figure out how to do this.&lt;/P&gt;&lt;P&gt;I want to check if my list: Selected_ncprogram is empty if it is select all NCPrograms.&lt;/P&gt;&lt;P&gt;I came up with this:&lt;/P&gt;&lt;PRE&gt;		ENTITY LIST Selected_ncprogram=explorer_selected_entities()
	
		IF is_empty(Selected_ncprogram) {
			ENTITY List Selected_ncprogram = folder('NCProgram')
		}

		STRING LIST tools = {}
		FOREACH $nc IN $Selected_ncprogram {
               ........&lt;/PRE&gt;&lt;P&gt;thanks in advance...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 05:58:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084286#M13748</guid>
      <dc:creator>LasseFred</dc:creator>
      <dc:date>2019-10-14T05:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help. entity list if is_empty</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084447#M13749</link>
      <description>&lt;P&gt;Ups sorry..&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is my variable "&lt;SPAN&gt;Selected_ncprogram&lt;/SPAN&gt;" is empty after my bracket.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 08:11:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084447#M13749</guid>
      <dc:creator>LasseFred</dc:creator>
      <dc:date>2019-10-14T08:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help. entity list if is_empty</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084774#M13750</link>
      <description>&lt;P&gt;you have to populate your list after you create it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;STRING LIST selected_ncprogram = {}
FOREACH ncp IN explorer_selected_entities() {
   INT $i = add_last(selected_ncprogram, ncp.name)
}

&lt;/PRE&gt;
&lt;P&gt;Now you can go through your list:&lt;/P&gt;
&lt;PRE&gt;FOREACH ncp IN selected_ncprogram {
   do whatever
}&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Oct 2019 11:23:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084774#M13750</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2019-10-14T11:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help. entity list if is_empty</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084780#M13751</link>
      <description>&lt;P&gt;if you simply want to check if your list is empty you can get the size:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;INT i = size(selected_program)&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 11:27:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084780#M13751</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2019-10-14T11:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help. entity list if is_empty</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084851#M13752</link>
      <description>&lt;P&gt;thanks for the answer. i am looking for something else.&lt;/P&gt;&lt;P&gt;if i "explore select" some nc programs the macro works fine.&lt;/P&gt;&lt;PRE&gt;ENTITY LIST Selected_ncprogram=explorer_selected_entities()&lt;/PRE&gt;&lt;P&gt;But if i dont have some nc programs selected, then list all my nc programs.&lt;/P&gt;&lt;P&gt;with this macro code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;IF is_empty(Selected_ncprogram) {
ENTITY List Selected_ncprogram = folder('NCProgram')
}&lt;/PRE&gt;&lt;P&gt;But after that &lt;SPAN&gt;curly brackets } there is end of my IF is_empty&lt;/SPAN&gt;. the macro "delete all my listed things in my list Selected_ncprogram"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;all the code.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	ENTITY LIST Selected_ncprogram=explorer_selected_entities()
		
	IF is_empty(Selected_ncprogram) {
			ENTITY List Selected_ncprogram = folder('NCProgram')
	}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 11:56:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084851#M13752</guid>
      <dc:creator>LasseFred</dc:creator>
      <dc:date>2019-10-14T11:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help. entity list if is_empty</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084920#M13753</link>
      <description>&lt;P&gt;sorry, i misunderstood.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this:&lt;/P&gt;
&lt;PRE&gt;	ENTITY LIST Selected_ncprogram=explorer_selected_entities()
	&lt;BR /&gt;        INT i = size(Selected_ncprogram)
	IF $i == 0 {
			ENTITY List Selected_ncprogram = folder('NCProgram')
	}&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Oct 2019 12:17:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9084920#M13753</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2019-10-14T12:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help. entity list if is_empty</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9086562#M13754</link>
      <description>&lt;P&gt;Sorry it doesn't work.&lt;/P&gt;&lt;P&gt;it throws away all the listed variables when it does the last&amp;nbsp;&lt;SPAN&gt;curly bracket&lt;/SPAN&gt;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	ENTITY LIST Selected_ncprogram=explorer_selected_entities()
	
        INT i = size(Selected_ncprogram)
	IF $i == 0 {
			ENTITY List Selected_ncprogram = folder('NCProgram')
			&lt;STRONG&gt;// it listed all the nc programs&lt;/STRONG&gt;
	}
			&lt;STRONG&gt;// throws all the listed variables away&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 05:43:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9086562#M13754</guid>
      <dc:creator>LasseFred</dc:creator>
      <dc:date>2019-10-15T05:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help. entity list if is_empty</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9086671#M13755</link>
      <description>&lt;P&gt;Read the "Scope of variables" in PowerMill help&lt;/P&gt;&lt;PRE&gt;ENTITY LIST Selected_ncprogram=explorer_selected_entities()
	
        INT i = size(Selected_ncprogram)
	IF $i == 0 {
		//&lt;FONT color="#ff0000"&gt;&lt;STRIKE&gt;	ENTITY List Selected_ncprogram = folder('NCProgram')&lt;/STRIKE&gt;&lt;/FONT&gt;
		$Selected_ncprogram = folder('NCProgram')
			// it listed all the nc programs
	}&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Oct 2019 07:05:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9086671#M13755</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-15T07:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help. entity list if is_empty</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9087268#M13756</link>
      <description>&lt;P&gt;sorry, I should've paid closer attention. I'm glad you've got an answer. My code should've been something like this:&lt;/P&gt;
&lt;PRE&gt;IF $i == 0 {
  $selected_program = folder(ncprogram)&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;since the variable is already defined outside the loop. i think by re-initializng it inside the loop, it does not carry through once the loop ends.&amp;nbsp; Glad you got there!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 12:29:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9087268#M13756</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2019-10-15T12:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help. entity list if is_empty</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9087349#M13757</link>
      <description>&lt;P&gt;Thanks to your both.&lt;/P&gt;&lt;P&gt;i have forgot all about&amp;nbsp;re-initializing in {curly-brackets}.&lt;/P&gt;&lt;P&gt;it's been some time since i last worked with macro.&lt;/P&gt;&lt;P&gt;but when you get started again. it's like riding a bike &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 12:56:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-help-entity-list-if-is-empty/m-p/9087349#M13757</guid>
      <dc:creator>LasseFred</dc:creator>
      <dc:date>2019-10-15T12:56:31Z</dc:date>
    </item>
  </channel>
</rss>

