<?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 to Export Selected Tools as Template Objects in PowerMill Forum</title>
    <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947048#M1437</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3960527"&gt;@iamcdn79&lt;/a&gt;&amp;nbsp;Same error.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2024 14:08:40 GMT</pubDate>
    <dc:creator>evo80</dc:creator>
    <dc:date>2024-08-08T14:08:40Z</dc:date>
    <item>
      <title>Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946790#M1429</link>
      <description>&lt;P class="lia-align-left"&gt;Good Day,&lt;/P&gt;&lt;P class="lia-align-left"&gt;I'm trying to create this macro to export selected tools as *.ptf files to a location and drop them into folders based on their tool type, but It's not working for me, any ideas where I'm going wrong.&lt;/P&gt;&lt;P class="lia-align-left"&gt;Thanks Jon K&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK

IF $length(project_pathname(0)) == 0 {
	MESSAGE WARN 'Save project first.'
	MACRO ABORT ALL
}
IF $SIZE(folder('tool')) == 0 {
	MESSAGE WARN 'No tools in project.'
	MACRO ABORT ALL
}
PROJECT SAVE

STRING $pmlprj_content = ""

FOREACH $tl IN explorer_selected_entities() {
	IF $tl.type == 'tip_radiused'  {
STRING $template_path = "C:\Powermill\Template Objects\Tools\Tip Radiused"
}ELSE IF $tl.type == 'routing' {
STRING $template_path = "C:\Powermill\Template Objects\Tools\Routing"


    STRING $tool_name = "x" + $tl.ID + ".pmlent"
	STRING $tool_name_new = $tl.Name + ".ptf"
	STRING $tool_full = project_pathname(0) + "\" + $tool_name
	STRING $dest_path_full = $template_path + "\" + $tool_name_new
	COPY FILE $tool_full $dest_path_full
}
	}

DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 12:25:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946790#M1429</guid>
      <dc:creator>evo80</dc:creator>
      <dc:date>2024-08-08T12:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946817#M1430</link>
      <description>&lt;P&gt;Does this work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK

IF $length(project_pathname(0)) == 0 {
    MESSAGE WARN 'Save project first.'
    MACRO ABORT ALL
}
IF $SIZE(folder('tool')) == 0 {
    MESSAGE WARN 'No tools in project.'
    MACRO ABORT ALL
}
PROJECT SAVE

STRING $pmlprj_content = ""

FOREACH $tl IN explorer_selected_entities() {
    IF $tl.type == 'tip_radiused' {
        STRING $template_path = "C:\\Powermill\\Template Objects\\Tools\\Tip Radiused"
    } ELSE IF $tl.type == 'routing' {
        STRING $template_path = "C:\\Powermill\\Template Objects\\Tools\\Routing"
    }

    STRING $tool_name = "x" + $tl.ID + ".pmlent"
    STRING $tool_name_new = $tl.Name + ".ptf"
    STRING $tool_full = project_pathname(0) + "\\" + $tool_name
    STRING $dest_path_full = $template_path + "\\" + $tool_name_new
    COPY FILE $tool_full $dest_path_full
}

DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 12:40:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946817#M1430</guid>
      <dc:creator>iamcdn79</dc:creator>
      <dc:date>2024-08-08T12:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946863#M1431</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3960527"&gt;@iamcdn79&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Didn't work.&lt;/P&gt;&lt;P&gt;Here's the macro error I'm getting...&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Macro Error:

File: C:\dcam\config\pmill2/Export-Selected-Tools.mac
Line: 20

}ELSE IF $tl.type == 'routing' {



Unexpected tokens found&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 08 Aug 2024 12:56:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946863#M1431</guid>
      <dc:creator>evo80</dc:creator>
      <dc:date>2024-08-08T12:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946908#M1432</link>
      <description>&lt;P&gt;Change to&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt; } ELSEIF $tl.type == 'routing' {&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 08 Aug 2024 13:11:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946908#M1432</guid>
      <dc:creator>iamcdn79</dc:creator>
      <dc:date>2024-08-08T13:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946932#M1433</link>
      <description>&lt;P&gt;Hmmm,&lt;/P&gt;&lt;P&gt;Same Error&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 13:18:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946932#M1433</guid>
      <dc:creator>evo80</dc:creator>
      <dc:date>2024-08-08T13:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946952#M1434</link>
      <description>&lt;P&gt;I can't test it atm but somethimes checking enums in powermill in a loop/if statement does not work correctly try to create a string variable first and check those.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;try this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK

IF $length(project_pathname(0)) == 0 {
    MESSAGE WARN 'Save project first.'
    MACRO ABORT ALL
}
IF $SIZE(folder('tool')) == 0 {
    MESSAGE WARN 'No tools in project.'
    MACRO ABORT ALL
}
PROJECT SAVE

STRING $pmlprj_content = ""

FOREACH $tl IN filter(explorer_selected_entities(),'this.RootType == "tool"') {
	string $e = $tl.type
	
    IF $e == 'tip_radiused' {
        STRING $template_path = "C:\\Powermill\\Template Objects\\Tools\\Tip Radiused"
    } ELSE IF $e == 'routing' {
        STRING $template_path = "C:\\Powermill\\Template Objects\\Tools\\Routing"
    }

    STRING $tool_name = "x" + $tl.ID + ".pmlent"
    STRING $tool_name_new = $tl.Name + ".ptf"
    STRING $tool_full = project_pathname(0) + "\\" + $tool_name
    STRING $dest_path_full = $template_path + "\\" + $tool_name_new
    COPY FILE $tool_full $dest_path_full
}

DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;also added a filter to the explorer selected enties so it does only work with tools&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 13:31:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946952#M1434</guid>
      <dc:creator>icse</dc:creator>
      <dc:date>2024-08-08T13:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946986#M1435</link>
      <description>&lt;P&gt;Thanks for your help guys!&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14304290"&gt;@icse&lt;/a&gt;&amp;nbsp;, still getting that same macro error at&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Macro Error:

File: C:\dcam\config\pmill2/Export-Selected-Tools.mac
Line: 22

    } ELSE IF $e == 'routing' {



Unexpected tokens found&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 08 Aug 2024 13:45:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12946986#M1435</guid>
      <dc:creator>evo80</dc:creator>
      <dc:date>2024-08-08T13:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947021#M1436</link>
      <description>&lt;P&gt;Close, reopen the project and rerun the macro&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 13:57:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947021#M1436</guid>
      <dc:creator>iamcdn79</dc:creator>
      <dc:date>2024-08-08T13:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947048#M1437</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3960527"&gt;@iamcdn79&lt;/a&gt;&amp;nbsp;Same error.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 14:08:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947048#M1437</guid>
      <dc:creator>evo80</dc:creator>
      <dc:date>2024-08-08T14:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947350#M1438</link>
      <description>&lt;P&gt;I think you need to write the else if together.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Elseif&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 16:06:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947350#M1438</guid>
      <dc:creator>icse</dc:creator>
      <dc:date>2024-08-08T16:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947522#M1439</link>
      <description>&lt;P&gt;Ok, I fiddled around with the code a bit, so when I select routing tools and run the macro it puts them into the correct folder, however when I select tip radiused tools it fails to populate the correct folder.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;DIALOGS MESSAGE OFF
DIALOGS ERROR OFF
GRAPHICS LOCK

IF $length(project_pathname(0)) == 0 {
    MESSAGE WARN 'Save project first.'
    MACRO ABORT ALL
}
IF $SIZE(folder('tool')) == 0 {
    MESSAGE WARN 'No tools in project.'
    MACRO ABORT ALL
}
PROJECT SAVE

STRING $pmlprj_content = ""

FOREACH $tl IN filter(explorer_selected_entities(),'this.RootType == "tool"') {
	string $e = $tl.type
	
    IF $e == 'tip_radiused' {
        STRING $template_path = "C:\Powermill\Template Objects\Tools\Tip Radiused"
    } ELSEIF $e == 'routing' {
        STRING $template_path = "C:\Powermill\Template Objects\Tools\Routing"
    

    STRING $tool_name = "x" + $tl.ID + ".pmlent"
    STRING $tool_name_new = $tl.Name + ".ptf"
    STRING $tool_full = project_pathname(0) + "\" + $tool_name
    STRING $dest_path_full = $template_path + "\" + $tool_name_new
    COPY FILE $tool_full $dest_path_full
}
}

DIALOGS MESSAGE ON
DIALOGS ERROR ON
GRAPHICS UNLOCK&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 17:14:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947522#M1439</guid>
      <dc:creator>evo80</dc:creator>
      <dc:date>2024-08-08T17:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947824#M1440</link>
      <description>&lt;P&gt;I looked it up in the debugger found some bugs, the $template_path variable is declared in the if statement and gets lost if the if block is closed also some {} where wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I updated the macro so it works with every tool type out of the box:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;if length(project_pathname(0)) == 0 OR project_modified() == 1 {
	bool $save = 0
	$save = query 'Save?'
	if $save {
		project save
	} else {
		return
	}
}


foreach $t in filter(explorer_selected_entities(),'this.RootType == "tool"') {

	string $template_path = 'C:/Powermill/Template Objects/Tools/' + $t.type
	
	STRING $tool_name = "x" + $t.ID + ".pmlent"
	STRING $tool_name_new = $t.Name + ".ptf"
	STRING $tool_full = project_pathname(0) + "/" + $tool_name
	STRING $dest_path_full = $template_path + "/" + $tool_name_new
	
	if not dir_exists($template_path) {
		mkdir ${template_path}
	}
	COPY FILE ${tool_full} ${dest_path_full}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may have to change the / to \ in the path variable.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 19:49:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947824#M1440</guid>
      <dc:creator>icse</dc:creator>
      <dc:date>2024-08-08T19:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to Export Selected Tools as Template Objects</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947851#M1441</link>
      <description>&lt;P&gt;Thanks so much, I've been wanting to migrate away from using the tool database and this has tidied up that decision.&lt;/P&gt;&lt;P&gt;Best Regards Jon K&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 20:02:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-export-selected-tools-as-template-objects/m-p/12947851#M1441</guid>
      <dc:creator>evo80</dc:creator>
      <dc:date>2024-08-08T20:02:02Z</dc:date>
    </item>
  </channel>
</rss>

