<?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: Automatic first toolpath activation in PowerMill Forum</title>
    <link>https://forums.autodesk.com/t5/powermill-forum/automatic-first-toolpath-activation/m-p/11509450#M5315</link>
    <description>&lt;P&gt;Hi Petr,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One way you can do it is to simply use (pmstartup.mac) macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another way to do it is to open PowerMill then launch the project through the macro, and then run any commands you want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;FUNCTION Main() {
 
	// Opening the file select dialogue &amp;amp; activating the 1st toolpath
	CALL OpenProject_ActivateFirstToolpath()
	
	// Commands to do
	...
	
	// Commands to do
	...
}

FUNCTION OpenProject_ActivateFirstToolpath() {
 
	// Opening the file select dialogue
	STRING ProjectPath  = ''
	STRING DirectoryName = ''
	$ProjectPath = FILESELECT "Select the (.pmlprj) file in you project"
	$DirectoryName = dirname($ProjectPath)
	PROJECT OPEN PROJSELECTOR $DirectoryName
	
	// Activating 1st toolpath
	STRING LIST MyToolpaths = extract(folder('Toolpath'), 'name')
	If (is_empty(MyToolpaths)) {
	  MESSAGE ERROR "Cannot activate 1st toolpath, Toolpaths folder is empty!"
	  MACRO ABORT
	} ELSE {
	  DEACTIVATE TOOLPATH
	  ACTIVATE TOOLPATH $MyToolpaths[0]
	}
}&lt;/LI-CODE&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;&lt;P&gt;Hope that I understood your question well and that my reply is helpful to you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2022 12:11:42 GMT</pubDate>
    <dc:creator>Y.Mahran</dc:creator>
    <dc:date>2022-10-26T12:11:42Z</dc:date>
    <item>
      <title>Automatic first toolpath activation</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/automatic-first-toolpath-activation/m-p/11478627#M5314</link>
      <description>&lt;P&gt;Hi, i would like to ask if there is any possible solution, that if i open existing powermill project, that i can automatically activate first toolpath without touching anything? Even if i close powermill and relaunch it once again, than open the same project i always want to have first toolpath activated. Because i want to read few parametres from first toolpath and use it to macros. Thank you, Petr.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 20:22:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/automatic-first-toolpath-activation/m-p/11478627#M5314</guid>
      <dc:creator>petanhavran</dc:creator>
      <dc:date>2022-10-12T20:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic first toolpath activation</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/automatic-first-toolpath-activation/m-p/11509450#M5315</link>
      <description>&lt;P&gt;Hi Petr,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One way you can do it is to simply use (pmstartup.mac) macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another way to do it is to open PowerMill then launch the project through the macro, and then run any commands you want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;FUNCTION Main() {
 
	// Opening the file select dialogue &amp;amp; activating the 1st toolpath
	CALL OpenProject_ActivateFirstToolpath()
	
	// Commands to do
	...
	
	// Commands to do
	...
}

FUNCTION OpenProject_ActivateFirstToolpath() {
 
	// Opening the file select dialogue
	STRING ProjectPath  = ''
	STRING DirectoryName = ''
	$ProjectPath = FILESELECT "Select the (.pmlprj) file in you project"
	$DirectoryName = dirname($ProjectPath)
	PROJECT OPEN PROJSELECTOR $DirectoryName
	
	// Activating 1st toolpath
	STRING LIST MyToolpaths = extract(folder('Toolpath'), 'name')
	If (is_empty(MyToolpaths)) {
	  MESSAGE ERROR "Cannot activate 1st toolpath, Toolpaths folder is empty!"
	  MACRO ABORT
	} ELSE {
	  DEACTIVATE TOOLPATH
	  ACTIVATE TOOLPATH $MyToolpaths[0]
	}
}&lt;/LI-CODE&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;&lt;P&gt;Hope that I understood your question well and that my reply is helpful to you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 12:11:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/automatic-first-toolpath-activation/m-p/11509450#M5315</guid>
      <dc:creator>Y.Mahran</dc:creator>
      <dc:date>2022-10-26T12:11:42Z</dc:date>
    </item>
  </channel>
</rss>

