<?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: Needing macro help with proper use and reference of $tool.type ...., in PowerMill Forum</title>
    <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8939046#M14708</link>
    <description>&lt;P&gt;&lt;FONT&gt;Some Powermill commands do not work well with variables, in which case the DoCommand statement should be used.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Please run&amp;nbsp;&lt;FONT&gt; the next example&amp;nbsp; in debugger step by step:&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;STRING T=folder('tool')[0].Name
ACTIVATE TOOL $T // -working
DELETE TOOL $T // -working
EDIT RECYCLER RECOVER Tool $T // -working
&lt;FONT color="#ff0000"&gt;FORM TOOL $T  // -not working&lt;/FONT&gt;
// Use instead the next sequence
STRING CMD="FORM TOOL '"+$T+"'"
DoCommand $CMD // -working

&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jul 2019 16:38:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-07-30T16:38:48Z</dc:date>
    <item>
      <title>Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8920079#M14688</link>
      <description>&lt;P&gt;Using tool.xml user menu with multiple selection function, I am stuck on how to find all $tool.types in folder 'tool'.&lt;/P&gt;&lt;P&gt;Then based on results, create individual folders (eg. BallNose, TipRad, TippedDisc....,) for found $tool.types and move each tool.type to corresponding tool.type folder created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 18:40:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8920079#M14688</guid>
      <dc:creator>stheroux</dc:creator>
      <dc:date>2019-07-19T18:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8920331#M14689</link>
      <description>&lt;PRE&gt;// Make a string expression for accessing all the tools
ENTITY LIST tools = folder('tool')
// Get tool type names in current language
STRING LIST Tt_names = values(tools[0].Type)
// Get the tool types used
STRING LIST Ttypes = remove_duplicates(extract(tools,'Type'))

FOREACH t IN Ttypes {
  // get list of all tools of given type
  ENTITY LIST tools_of_type = extract(filter(tools,'Type==t'),'Name')
  // get name of tool type in current language
  INT type_id = tools_of_type[0].Type
  STRING Type_name = Tl_names[type_id]
  // Create a folder if it doesn't already exist
  STRING Folder_name = "Tool\$Type_name"
  IF NOT folder_exists(fname) {
    CREATE FOLDER Tool $Type_name
  }
  // Move the tools to the folder
  FOREACH tt IN tools_of_type {
    EDIT FOLDER $Folder_name INSERT $tt.Name Last
  }
}&lt;/PRE&gt;&lt;P&gt;Something like the above not tested so you may have to debug it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 21:05:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8920331#M14689</guid>
      <dc:creator>urizenYHS3W</dc:creator>
      <dc:date>2019-07-19T21:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8922786#M14690</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4282186"&gt;@urizenYHS3W&lt;/a&gt;&amp;nbsp; for getting me on the right path. I did a basic copy and paste...,&lt;/P&gt;&lt;P&gt;I'm trying&amp;nbsp; to get this macro to function using "selected tools" only. Function in &lt;FONT color="#3366FF"&gt;BLUE.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Running macro debug through tool.xml menu, errs right away on line 1 "Variable missing" . I use this same code&lt;/P&gt;&lt;P&gt;on all my other tool macros and works fine..., Gets through it if I run macro without debugger. Should I be modifying this Function as it seems other than string selected, the rest is redundant?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I delete Function from Macro and allow macro to pick all tools , I get an error on line 8&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error.PNG" style="width: 274px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/659739iDD075BC1BA09E79F/image-dimensions/274x227?v=v2" width="274" height="227" role="button" title="error.PNG" alt="error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Not knowing what to fix on line 8 I can't debug further. Any additional help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;Function Main( STRING $Selected ) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;STRING LIST $ToolNames = {}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;CALL Get_Tool_List($Selected, $ToolNames)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;//string expression for accessing all the tools&lt;BR /&gt;ENTITY LIST tools = folder('tool')&lt;BR /&gt;// Get tool type names in current language&lt;BR /&gt;STRING LIST Tt_names = values(tools[0].Type)&lt;BR /&gt;// Get the tool types used&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;STRING LIST Ttypes = remove_duplicates(extract(tools,'Type')) &lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;FOREACH tl IN $Tt_names {&lt;BR /&gt;// get list of all tools of given type&lt;BR /&gt;ENTITY LIST tools_of_type = extract(filter(tools,'Type==t'),'Name')&lt;BR /&gt;// get name of tool type in current language&lt;BR /&gt;INT type_id = tools_of_type[0].Type&lt;BR /&gt;STRING Type_name = Tl_names[type_id]&lt;BR /&gt;// Create a folder if it doesn't already exist&lt;BR /&gt;STRING Folder_name = "Tool\$Type_name"&lt;BR /&gt;IF NOT folder_exists(fname) {&lt;BR /&gt;CREATE FOLDER Tool $Type_name&lt;BR /&gt;// Move the tools to the folder&lt;BR /&gt;&lt;BR /&gt;FOREACH tt IN $tools_of_type {&lt;BR /&gt;EDIT FOLDER $Folder_name INSERT $tt.Name Last&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;Function Get_Tool_List(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;STRING $Selected&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;OUTPUT STRING LIST $Selected_Tools&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;) &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;If $powermill.Status.MultipleSelection.total == 0 OR $powermill.Status.MultipleSelection.First {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;IF NOT member(project._keys,"Multiple_Selected_Names") {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;EDIT PAR CREATE STRING "Multiple_Selected_Names"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;$Project.Multiple_Selected_Names = ""&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;} ELSE {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;$Project.Multiple_Selected_Names = $Project.Multiple_Selected_Names + "\" &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;$Project.Multiple_Selected_Names = $Project.Multiple_Selected_Names + $Selected &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;IF NOT($powermill.Status.MultipleSelection.Last or $powermill.Status.MultipleSelection.total == 0) {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;MACRO ABORT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;} &lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;$Selected_Tools = TOKENS($Project.Multiple_Selected_Names, "\")&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#3366FF"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 12:43:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8922786#M14690</guid>
      <dc:creator>stheroux</dc:creator>
      <dc:date>2019-07-22T12:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8925489#M14691</link>
      <description>&lt;P&gt;Needs to be split:&lt;/P&gt;&lt;PRE&gt;STRING LIST Ttypes = extract(tools,'Type')&lt;BR /&gt;INT num = remove_duplicates(Ttypes)&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jul 2019 13:01:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8925489#M14691</guid>
      <dc:creator>urizenYHS3W</dc:creator>
      <dc:date>2019-07-23T13:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8925752#M14692</link>
      <description>&lt;P&gt;Thanks again&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4282186"&gt;@urizenYHS3W&lt;/a&gt;&amp;nbsp;. Made the suggested changes ...&lt;/P&gt;&lt;P&gt;Populates tools list and lists all possible tool.types available to powermill then line 6 generates error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way, on line 4, to list only the $tool.types in folder 'tool' or in the entity list 'tools'&amp;nbsp; or is there not enough available information acquired at this point to give a result and I have to get past this line 6 hurtle to get there?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I find it odd that&amp;nbsp; tool.type so far is represented as both&amp;nbsp;&lt;/P&gt;&lt;P&gt;(STRING) = "End Mill" in Ttnames and as (ENUM) Type = tip_radiused in (TOOL)..., so many names!.. what to reference? Can anything be done using (ENUM)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Debug.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/660247i78B2040CC4906CFC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Debug.PNG" alt="Debug.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Make a string expression for accessing all the tools&lt;BR /&gt;ENTITY LIST tools = folder('tool')&lt;BR /&gt;// Get tool type names in current language&lt;BR /&gt;STRING LIST Tt_names = values(tools[0].Type)&lt;BR /&gt;// Get the tool types used&lt;BR /&gt;STRING LIST Ttypes = extract(tools,'Type')&lt;BR /&gt;INT num = remove_duplicates(Ttypes)&lt;BR /&gt;FOREACH t IN Ttypes {&lt;BR /&gt;// get list of all tools of given type&lt;BR /&gt;ENTITY LIST tools_of_type = extract(filter(tools,'Type==t'),'Name')&lt;BR /&gt;// get name of tool type in current language&lt;BR /&gt;INT type_id = tools_of_type[0].Type&lt;BR /&gt;STRING Type_name = Tl_names[type_id]&lt;BR /&gt;// Create a folder if it doesn't already exist&lt;BR /&gt;STRING Folder_name = "Tool\$Type_name"&lt;BR /&gt;IF NOT folder_exists(fname) {&lt;BR /&gt;CREATE FOLDER Tool $Type_name&lt;BR /&gt;}&lt;BR /&gt;// Move the tools to the folder&lt;BR /&gt;FOREACH tt IN tools_of_type {&lt;BR /&gt;EDIT FOLDER $Folder_name INSERT $tt.Name Last&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 14:32:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8925752#M14692</guid>
      <dc:creator>stheroux</dc:creator>
      <dc:date>2019-07-23T14:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8925800#M14693</link>
      <description>&lt;P&gt;..sorry had a copy paste error there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I find it odd that&amp;nbsp; tool.type so far is represented as both&amp;nbsp;&lt;/P&gt;&lt;P&gt;(STRING) = "End Mill" in Ttnames and as &lt;FONT color="#3366FF"&gt;(ENUM) Type = end_mill&lt;/FONT&gt; in (TOOL)..., so many names!.. what to reference? Can anything be done using (ENUM)?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 14:51:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8925800#M14693</guid>
      <dc:creator>stheroux</dc:creator>
      <dc:date>2019-07-23T14:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8925842#M14694</link>
      <description>&lt;P&gt;The values() method returns the data in the appropriate natural language, and in human readable terms. So you'll get the names in German, French, Chinese or whatever. If you are satisfied with the enum names then don't do the conversion.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 15:12:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8925842#M14694</guid>
      <dc:creator>urizenYHS3W</dc:creator>
      <dc:date>2019-07-23T15:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8925940#M14695</link>
      <description>&lt;P&gt;Thank you for the clarification. I do prefer your&lt;SPAN&gt;&amp;nbsp;appropriate natural language result much more than the ENUM names, was just confused why there are 2 different results for the same thing. Now that I understand why code is the way it is , I still need help getting past this line of code STRING LIST Ttypes = extract(tools,'Type'). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR 'Type mismatch assigning 'Type to parameter'.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;No matter how much troubleshooting I try on this line, I'm getting nowhere.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've never been successful getting tool.type to work in a macro other than the basic IF $Tool.Type == 'end_mill' or&amp;nbsp;IF $Tool.Type != 'ball_nosed'.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Getting list of tool.types in folder'tool' as result is much harder than I anticipated it would be ...let alone&amp;nbsp;removing duplicate entities which I hadn't even realized would need be addressed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;ENTITY LIST tools = folder('tool')&amp;nbsp;&amp;nbsp;&lt;FONT color="#00FF00"&gt;OK&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STRING LIST Tt_names = values(tools[0].Type)&amp;nbsp; &lt;FONT color="#00FF00"&gt;OK&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STRING LIST Ttypes = extract(tools,'Type') --- At a loss ---&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;INT num = remove_duplicates(Ttypes) &amp;lt;----&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2019 15:50:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8925940#M14695</guid>
      <dc:creator>stheroux</dc:creator>
      <dc:date>2019-07-23T15:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8927477#M14696</link>
      <description>&lt;PRE&gt;STRING LIST Ttypes = apply(tools,'string(Type)') &lt;/PRE&gt;&lt;P&gt;Type checking appears to be too strict. Type is an ENUM which converts to a string but isn't. The above should work as it explicitly converts the Type to a string by applying the string function to Type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 09:56:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8927477#M14696</guid>
      <dc:creator>urizenYHS3W</dc:creator>
      <dc:date>2019-07-24T09:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8930731#M14697</link>
      <description>&lt;P&gt;Thanks again, again, again&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4282186"&gt;@urizenYHS3W&lt;/a&gt;&amp;nbsp;, that did the trick.&lt;/P&gt;&lt;P&gt;But as expected, I am unable to troubleshoot the next line to get it to work.&lt;/P&gt;&lt;P&gt;I've tried modifying the expression to be able to get eval but not getting anywhere... all listed below.&lt;/P&gt;&lt;P&gt;I have very similar code I use successfully&amp;nbsp;&lt;/P&gt;&lt;P&gt;STRING LIST $tr = extract($filter(folder('tool'), "type == '${t}' )",'tool')&lt;/P&gt;&lt;P&gt;but doesn't function as an ENTITY LIST.&lt;/P&gt;&lt;P&gt;Any additional help/guidance would be fantastic and greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ENTITY LIST tools = folder('tool') &lt;FONT color="#00FF00"&gt;OK&lt;/FONT&gt;&lt;BR /&gt;STRING LIST Tt_names = values(tools[0].Type)&amp;nbsp;&lt;FONT color="#00FF00"&gt;OK&lt;/FONT&gt;&lt;BR /&gt;STRING LIST Ttypes = apply(tools,'string(Type)')&amp;nbsp;&lt;FONT color="#00FF00"&gt;OK&lt;/FONT&gt;&lt;BR /&gt;INT old = remove_duplicates(Ttypes)&amp;nbsp;&lt;FONT color="#00FF00"&gt;OK&lt;/FONT&gt;&lt;BR /&gt;FOREACH t IN Ttypes {&amp;nbsp;&lt;FONT color="#00FF00"&gt;OK&lt;/FONT&gt;&lt;BR /&gt;ENTITY LIST tools_of_type = extract(filter(tools,'Type==t'),'Name') ORIGINAL PROVIDED CODE&lt;/P&gt;&lt;P&gt;ENTITY LIST tools_of_type = extract(filter(tools,'type==t'),'Name')&lt;/P&gt;&lt;P&gt;ENTITY LIST tools_of_type = extract(filter(tools,'Type == t'),'Name')&lt;/P&gt;&lt;P&gt;ENTITY LIST tools_of_type = extract(filter(tools,'type == t'),'Name')&amp;nbsp;&lt;/P&gt;&lt;P&gt;ENTITY LIST tools_of_type = extract(filter('tools','Type==t'),'Name')&lt;/P&gt;&lt;P&gt;ENTITY LIST tools_of_type = extract(filter('tools','type==t'),'Name')&lt;/P&gt;&lt;P&gt;ENTITY LIST tools_of_type = extract(filter('tools','Type == t'),'Name')&lt;/P&gt;&lt;P&gt;ENTITY LIST tools_of_type = extract(filter('tools','type == t'),'Name')&lt;/P&gt;&lt;P&gt;ENTITY LIST tools_of_type = extract(filter('tools',"type == 't'"),'Name')&lt;BR /&gt;ENTITY LIST tools_of_type = extract(filter(folder('tool'),'Type==t'),'Name') with every variation above&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 15:29:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8930731#M14697</guid>
      <dc:creator>stheroux</dc:creator>
      <dc:date>2019-07-25T15:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8930759#M14698</link>
      <description>&lt;PRE&gt;FOREACH t IN Ttypes {&lt;BR /&gt;  STRING expr = "Type=='"+string(t)+"'"&lt;BR /&gt;  ENTITY LIST tools_of_type = extract(filter(tools,expr),'Name')&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Jul 2019 15:45:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8930759#M14698</guid>
      <dc:creator>urizenYHS3W</dc:creator>
      <dc:date>2019-07-25T15:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8934169#M14699</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4282186"&gt;@urizenYHS3W&lt;/a&gt;&amp;nbsp;for helping me inch my way there. What a learning curve..,&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;STRING expr = "Type == '"+string(t)+"'"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;This Code is returning (STRING) expr = "Type == 'tip_radiused'"&lt;/P&gt;&lt;P&gt;Which I figure is extracted from current (STRING)t in (LIST)Ttypes.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;ENTITY LIST tools_of_type = extract(filter(tools,expr),'Name')&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;This line is returning error "Cannot create entity using:"&lt;/P&gt;&lt;P&gt;I'm confused where this is going.&amp;nbsp; Creating a (LIST) by extracting information by filtering a combination of&amp;nbsp;&lt;/P&gt;&lt;P&gt;both $tools and $expr and assigning a Name?&lt;/P&gt;&lt;P&gt;What should the code be returning as (LIST) = ??? from the extracted/filtered .name&amp;nbsp;&lt;/P&gt;&lt;P&gt;Figure if I know this, it could possibly help me troubleshoot it easier..., no clue&lt;/P&gt;&lt;P&gt;Is it trying to match current $Ttype to tools with that tool.type and add to list? Just incase if so, in $tools, (ENUM) Type = tip_radiused, not "Type &lt;FONT color="#0000FF"&gt;==&lt;/FONT&gt;&amp;nbsp;'tip_radiused'" . Would this be affecting something? If no, any ideas would be fantastic!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ENTITY LIST tools = folder('tool')&lt;BR /&gt;STRING LIST Tt_names = values(tools[0].Type)&lt;BR /&gt;STRING LIST Ttypes = apply(tools,'string(Type)')&lt;BR /&gt;INT old = remove_duplicates(Ttypes)&lt;BR /&gt;FOREACH t IN Ttypes {&lt;BR /&gt;STRING expr = "Type == '"+string(t)+"'"&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;ENTITY LIST tools_of_type = extract(filter(tools,expr),'Name')&lt;/FONT&gt;&lt;BR /&gt;INT type_id = tools_of_type[0].Type&lt;BR /&gt;STRING Type_name = Tl_names[type_id]&lt;BR /&gt;// Create a folder if it doesn't already exist&lt;BR /&gt;STRING Folder_name = "Tool\$Type_name"&lt;BR /&gt;IF NOT folder_exists(fname) {&lt;BR /&gt;CREATE FOLDER Tool $Type_name&lt;BR /&gt;}&lt;BR /&gt;// Move the tools to the folder&lt;BR /&gt;FOREACH tt IN tools_of_type {&lt;BR /&gt;EDIT FOLDER $Folder_name INSERT $tt.Name Last&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jul 2019 14:02:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8934169#M14699</guid>
      <dc:creator>stheroux</dc:creator>
      <dc:date>2019-07-27T14:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8935019#M14700</link>
      <description>&lt;P&gt;Sorry I'm not thinking&lt;/P&gt;&lt;PRE&gt;ENTITY LIST tools_of_type = filter(tools,expr)&lt;/PRE&gt;&lt;P&gt;You just want the tools of the specific type not their names.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jul 2019 20:44:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8935019#M14700</guid>
      <dc:creator>urizenYHS3W</dc:creator>
      <dc:date>2019-07-28T20:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8936860#M14701</link>
      <description>&lt;P&gt;I can see the end of the script now before erring..., thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4282186"&gt;@urizenYHS3W&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;INT type_id = tools_of_type[0].Type&lt;/FONT&gt;&amp;nbsp; This code is returning (INT) type_id = 0, NEXT LINE&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;STRING Type_name = Tt_names[Type_id]&lt;/FONT&gt; Is returning (STRING) Type_name = "End Mill"&lt;/P&gt;&lt;P&gt;As per screenshot below, should it not be returning&amp;nbsp;(STRING) Type_name = "Ball Nosed"&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know if the problem is &lt;FONT color="#0000FF"&gt;type_id = 0&lt;/FONT&gt; or if &lt;FONT color="#0000FF"&gt;Type_name&lt;/FONT&gt; should be looking at something other than &lt;FONT color="#0000FF"&gt;Tt_names&lt;/FONT&gt; since&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Tt_names&lt;/FONT&gt; returns every possible powermill tool even if not in current project. Should I be referencing &lt;FONT color="#0000FF"&gt;Ttypes&lt;/FONT&gt; since that list only has tools found in project?&lt;/P&gt;&lt;P&gt;Otherwise I can soldier on through the macro and it creates the folder with the wrong name due to above problem but errs trying to add tools to the folder. Guessing because there are no "end_mills" in project !? Or possibly problem with last line of code !?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 300px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/662000i60335E36E23A07CB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ENTITY LIST $tools = folder('tool')&lt;BR /&gt;STRING LIST $Tt_names = values($tools[0].Type)&lt;BR /&gt;STRING LIST $Ttypes = apply($tools,'string(Type)')&lt;BR /&gt;INT old = remove_duplicates(Ttypes)&lt;BR /&gt;FOREACH $t IN $Ttypes {&lt;BR /&gt;STRING $expr = "Type == '"+string(t)+"'"&lt;BR /&gt;ENTITY LIST $tools_of_type = filter(tools,expr)&lt;BR /&gt;INT type_id = tools_of_type[0].Type&lt;BR /&gt;STRING Type_name = Tt_names[Type_id]&lt;BR /&gt;STRING Folder_name = "$Type_name"&lt;BR /&gt;IF NOT folder_exists($Folder_name) {&lt;BR /&gt;CREATE FOLDER Tool $Type_name&lt;BR /&gt;}&lt;BR /&gt;FOREACH tt IN tools_of_type {&lt;BR /&gt;EDIT FOLDER $Folder_name INSERT $tt.Name Last&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 17:48:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8936860#M14701</guid>
      <dc:creator>stheroux</dc:creator>
      <dc:date>2019-07-29T17:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8937217#M14702</link>
      <description>&lt;P&gt;Replace &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; font-family: 'Artifakt',Tahoma,Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;EDIT FOLDER $Folder_name INSERT $tt.Name Last&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; font-family: 'Artifakt',Tahoma,Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;with &amp;nbsp;&lt;FONT&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #666666; font-family: 'Artifakt',Tahoma,Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;FONT&gt;STRING Cmd="EDIT FOLDER '"+$Folder_Name+"' INSERT '"+pathname($T)+"' LAST"&lt;BR /&gt;&amp;nbsp;DoCommand $Cmd&lt;BR /&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;FUNCTION MAIN {
   IF size(folder('tool')) == 0 {
      RETURN
   }
   STRING LIST FolderNames=values(folder('tool')[0].Type)
   STRING Cmd=''
   FOREACH T in folder('tool') {
      STRING NewFolder='Tool\'+$FolderNames[int($T.Type)]
      IF NOT folder_exists($NewFolder) {
         $Cmd="CREATE folder 'Tool' '"+$FolderNames[int($T.Type)]+"'"
         DoCommand $Cmd
      }
      IF dirname(pathname($T)) != $NewFolder {
         $Cmd="EDIT FOLDER '"+$NewFolder+"' INSERT '"+pathname($T)+"' LAST"
         DoCommand $Cmd
      }
   }&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jul 2019 21:18:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8937217#M14702</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-29T21:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8937253#M14703</link>
      <description>&lt;P&gt;Thank you for helping&amp;nbsp;@Anonymous&amp;nbsp;.&lt;/P&gt;&lt;P&gt;I don't know if this solves folder naming issue or not as I silll have to address what it wrong with&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;INT type_id = tools_of_type[0].Type&lt;/FONT&gt;&amp;nbsp; This code is returning (INT) type_id = 0, NEXT LINE&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;STRING Type_name = Tt_names[Type_id]&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Is returning (STRING) Type_name = "End Mill"&lt;/P&gt;&lt;P&gt;As per screenshot below, should it not be returning&amp;nbsp;(STRING) Type_name = "Ball Nosed"&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script you attached works perfectly to do the same job and I will definitely hang on to that code but it's light years ahead of my current coding abilities.&amp;nbsp; I'm learning as I go and finally wrapping my head around what&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4282186"&gt;@urizenYHS3W&lt;/a&gt;&amp;nbsp; has been kind enough to school me on which I am finding to be very advanced . I'm aiming to finish the original script if it kills me. If you have a solution for above issue I will gladly try it!!&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 300px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/662000i60335E36E23A07CB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ENTITY LIST $tools = folder('tool')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STRING LIST $Tt_names = values($tools[0].Type)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STRING LIST $Ttypes = apply($tools,'string(Type)')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;INT old = remove_duplicates(Ttypes)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FOREACH $t IN $Ttypes {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STRING $expr = "Type == '"+string(t)+"'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ENTITY LIST $tools_of_type = filter(tools,expr)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;INT type_id = tools_of_type[0].Type&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STRING Type_name = Tt_names[Type_id]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;STRING Folder_name = "$Type_name"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IF NOT folder_exists($Folder_name) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CREATE FOLDER Tool $Type_name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FOREACH tt IN tools_of_type {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT FOLDER $Folder_name INSERT $tt.Name Last&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 21:46:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8937253#M14703</guid>
      <dc:creator>stheroux</dc:creator>
      <dc:date>2019-07-29T21:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8937625#M14704</link>
      <description>&lt;P&gt;My macro in PM 2017 Standard working:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.Before -lang= english" style="width: 235px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/662240iABDE0A080CC98687/image-size/medium?v=v2&amp;amp;px=400" role="button" title="elötte.JPG" alt="1.Before -lang= english" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;1.Before -lang= english&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.After" style="width: 250px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/662241iE019E6F8824119EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Utana.JPG" alt="2.After" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;2.After&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3. change lang hungarian" style="width: 315px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/662242iC0212A90C00F8690/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Utana2.JPG" alt="3. change lang hungarian" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;3. change lang hungarian&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;There is no Hungarian translation to turning tools,&lt;BR /&gt;will remain in English&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;- In&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 05:53:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8937625#M14704</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-30T05:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8938293#M14705</link>
      <description>&lt;P&gt;Yes&amp;nbsp;@Anonymous&amp;nbsp; your macro works perfectly in powermill 2020 as well.&lt;/P&gt;&lt;P&gt;The script you attached works perfectly to do the same job and I will definitely hang on to that code but it's light years ahead of my current coding abilities.&amp;nbsp; I'm learning as I go and finally wrapping my head around what&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4282186" target="_blank"&gt;@urizenYHS3W&lt;/A&gt;&amp;nbsp; has been kind enough to school me on which I am finding to be very advanced . I'm aiming to finish the original script if it kills me. If you have a solution for below issue I will gladly try it!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;INT type_id = tools_of_type[0].Type&lt;/FONT&gt;&amp;nbsp; This code is returning (INT) type_id = 0, NEXT LINE&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;STRING Type_name = Tt_names[Type_id]&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Is returning (STRING) Type_name = "End Mill"&lt;/P&gt;&lt;P&gt;As per screenshot below, should it not be returning&amp;nbsp;(STRING) Type_name = "Ball Nosed"&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know if the problem is&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#0000FF"&gt;type_id = 0&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;or if&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#0000FF"&gt;Type_name&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;should be looking at something other than&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#0000FF"&gt;Tt_names&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;since&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Tt_names&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;returns every possible powermill tool even if not in current project. Should I be referencing&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#0000FF"&gt;Ttypes&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;since that list only has tools found in project?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 300px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/662000i60335E36E23A07CB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ENTIRE MACRO &amp;gt;&amp;gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;ENTITY LIST $tools = folder('tool')&lt;BR /&gt;STRING LIST $Tt_names = values($tools[0].Type)&lt;BR /&gt;STRING LIST $Ttypes = apply($tools,'string(Type)')&lt;BR /&gt;INT old = remove_duplicates(Ttypes)&lt;BR /&gt;FOREACH $t IN $Ttypes {&lt;BR /&gt;STRING $expr = "Type == '"+string(t)+"'"&lt;BR /&gt;ENTITY LIST $tools_of_type = filter(tools,expr)&lt;BR /&gt;INT type_id = tools_of_type[0].Type&lt;BR /&gt;STRING Type_name = Tt_names[Type_id]&lt;BR /&gt;STRING Folder_name = "$Type_name"&lt;BR /&gt;IF NOT folder_exists(Folder_name) {&lt;BR /&gt;CREATE FOLDER Tool $Type_name&lt;BR /&gt;}&lt;BR /&gt;FOREACH tt IN tools_of_type {&lt;BR /&gt;EDIT FOLDER $Folder_name INSERT $tt.Name Last&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 12:23:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8938293#M14705</guid>
      <dc:creator>stheroux</dc:creator>
      <dc:date>2019-07-30T12:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8938800#M14706</link>
      <description>&lt;P&gt;&lt;FONT&gt;&lt;FONT color="#004000" face="arial,sans-serif"&gt;Thank you for your good opinion, but I think the difference between our knowledge is much smaller than you think.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;I tried to keep as much of the original code as possible, this is a working version:&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;ENTITY LIST $tools = folder('tool')
STRING LIST $Tt_names = values($tools[0].Type)
// The apply() FUNCTION not working in PM2017
//&lt;FONT color="#00ff00"&gt;STRING LIST $Ttypes = apply($tools,'string(Type)')&lt;/FONT&gt;
&lt;FONT color="#0000ff"&gt;// Begin apply() replacement
STRING LIST $Ttypes= {}
FOREACH T IN folder('tool') {
   INT I=add_last($Ttypes,string($T.Type))
}
// End apply() replacement for PM2017&lt;/FONT&gt;

INT old = remove_duplicates(Ttypes)

FOREACH $t IN $Ttypes {
   STRING $expr = "Type == '"+ $t +"'"
   ENTITY LIST $tools_of_type = filter(tools,expr)
   INT type_id = int($tools_of_type[0].Type)
   STRING Type_name = $Tt_names[$Type_id]
   STRING Folder_name = $Type_name
   IF NOT folder_exists('Tool\'+Folder_name) {
      CREATE FOLDER Tool $Type_name
   }
   FOREACH tt IN tools_of_type {
      IF dirname(pathname($tt)) != 'Tool\'+Folder_name {
         STRING Cmd='EDIT FOLDER "Tool\'+$Folder_name+'" INSERT "'+pathname($tt)+'" Last'
         DoCommand $Cmd
      }
   }
}&lt;/PRE&gt;&lt;P&gt;&lt;FONT&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #f8f9fa; color: #222222; font-family: arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre-wrap; word-spacing: 0px;"&gt;Of course, you can safely delete the &lt;FONT color="#0000ff"&gt;replacement code&lt;/FONT&gt; by restoring the &lt;FONT color="#00ff00"&gt;original apply ()&lt;/FONT&gt; function&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 14:59:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8938800#M14706</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-30T14:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Needing macro help with proper use and reference of $tool.type ....,</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8938924#M14707</link>
      <description>&lt;P&gt;Made suggested changes. Had missed a change to code&amp;nbsp;INT type_id = int($tools_of_type[0].Type)&lt;/P&gt;&lt;P&gt;Works perfect now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I said was beyond me.... all the $cmd stuff is still new to me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FUNCTION MAIN {&lt;BR /&gt;IF size(folder('tool')) == 0 {&lt;BR /&gt;RETURN&lt;BR /&gt;}&lt;BR /&gt;STRING LIST FolderNames=values(folder('tool')[0].Type)&lt;BR /&gt;STRING Cmd=''&lt;BR /&gt;FOREACH T in folder('tool') {&lt;BR /&gt;STRING NewFolder='Tool\'+$FolderNames[int($T.Type)]&lt;BR /&gt;IF NOT folder_exists($NewFolder) {&lt;BR /&gt;$Cmd="CREATE folder 'Tool' '"+$FolderNames[int($T.Type)]+"'"&lt;BR /&gt;DoCommand $Cmd&lt;BR /&gt;}&lt;BR /&gt;IF dirname(pathname($T)) != $NewFolder {&lt;BR /&gt;$Cmd="EDIT FOLDER '"+$NewFolder+"' INSERT '"+pathname($T)+"' LAST"&lt;BR /&gt;DoCommand $Cmd&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 15:41:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/needing-macro-help-with-proper-use-and-reference-of-tool-type/m-p/8938924#M14707</guid>
      <dc:creator>stheroux</dc:creator>
      <dc:date>2019-07-30T15:41:51Z</dc:date>
    </item>
  </channel>
</rss>

