<?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 create NC code in PowerMill Forum</title>
    <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575098#M24687</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3959841"&gt;@kukelyk&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for you help, but it doesn't match with my expectation. I had a NC program like this:&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="a.jpg" style="width: 242px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/431255iFA99F3F86D447D4B/image-size/large?v=v2&amp;amp;px=999" role="button" title="a.jpg" alt="a.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And when I run my macro above, I will have a file in C drive like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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="b.jpg" style="width: 558px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/431257iEF7A123CC920E532/image-size/large?v=v2&amp;amp;px=999" role="button" title="b.jpg" alt="b.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I have the macro so that when I run it, I can get toolpath time instead of toolpath length like this: ( the time will be copied at the row where i highlighted at the photo above)&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="c.jpg" style="width: 558px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/431267i10780532FC04869C/image-size/large?v=v2&amp;amp;px=999" role="button" title="c.jpg" alt="c.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me if you have any solution. Thank you very much !&lt;/P&gt;</description>
    <pubDate>Mon, 27 Nov 2017 14:26:40 GMT</pubDate>
    <dc:creator>newbie123abc</dc:creator>
    <dc:date>2017-11-27T14:26:40Z</dc:date>
    <item>
      <title>Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7529950#M24673</link>
      <description>&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I usually create NC code for active toolpath by right click on it and then choose command "Create Individual NC Program". Now, I would like to make a macro to do this. This is my macro (active toolpath is 6000):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EXPLORER SELECT Toolpath "Toolpath\6000" NEW&lt;BR /&gt;CREATE NCPROGRAM "6000" EDIT NCPROGRAM "6000" APPEND TOOLPATH "6000" DEACTIVATE NCPROGRAM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to&amp;nbsp;active another toolpath like 6001 and run this macro for creating NC code file with name 6001, could you please fix it for me ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much !&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 09:38:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7529950#M24673</guid>
      <dc:creator>newbie123abc</dc:creator>
      <dc:date>2017-11-09T09:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7530016#M24674</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5108110"&gt;@newbie123abc&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not exactly what you need, but you could alter this one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;EXPLORER SELECT FOLDER "NCProgram" NEW
DEACTIVATE NCProgram
ENTITY LIST $ents = INPUT ENTITY MULTIPLE ncprogram "Select NC programs"
FOREACH $nc IN $ents {
	ACTIVATE NCProgram $nc.Name
	EDIT NCPROGRAM SELECTED FOLDER "P:\bla\bla\"\r
	NCSELECTED APPLY\r
// Put your "rename" / append functionality here
	EDIT NCPROGRAM SELECTED FILEMASK  P:\bla\bla\{ncprogram}.MPF
	NCSELECTED APPLY\r
	EDIT NCPROGRAM SELECTED TAPEOPTIONS "P:\Powermill\Post-pro\YOUR_PP.pmoptz"\r
	NCSELECTED ACCEPT\r
	KEEP NCPROGRAM SELECTED\r
	YES\n
}
DEACTIVATE NCProgram&lt;/PRE&gt;
&lt;P&gt;It should be a good starting base...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Olivier&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 10:09:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7530016#M24674</guid>
      <dc:creator>NanchenO</dc:creator>
      <dc:date>2017-11-09T10:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7530021#M24675</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the build in function for this without macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Select your toolpaths you want to make a nc program off, right click and select "create individual nc programs".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Glenn&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 10:10:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7530021#M24675</guid>
      <dc:creator>GlennM.MCAM</dc:creator>
      <dc:date>2017-11-09T10:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7530029#M24676</link>
      <description>&lt;P&gt;But offcourse,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3962145"&gt;@NanchenO&lt;/a&gt;&amp;nbsp;gives a great solution with much more possibilities&amp;nbsp;&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://forums.autodesk.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 10:13:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7530029#M24676</guid>
      <dc:creator>GlennM.MCAM</dc:creator>
      <dc:date>2017-11-09T10:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7532662#M24677</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3977965"&gt;@GlennM.MCAM&lt;/a&gt;,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3962145"&gt;@NanchenO&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm beginner and I'm trying to learn macro by recording.&amp;nbsp;Could you please help me to make a simple macro just create NC code for any active toolpath instead of right click on active toolpath and choose&amp;nbsp;&lt;SPAN&gt;"Create Individual NC Program".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you very much !&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 01:42:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7532662#M24677</guid>
      <dc:creator>newbie123abc</dc:creator>
      <dc:date>2017-11-10T01:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7532976#M24678</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;CREATE NCPROGRAM ; ACTIVATE NCPROGRAM # EDIT NCPROGRAM ; APPEND TOOLPATH ; DEACTIVATE NCPROGRAM&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Nov 2017 06:54:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7532976#M24678</guid>
      <dc:creator>kukelyk</dc:creator>
      <dc:date>2017-11-10T06:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7533006#M24679</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3959841"&gt;@kukelyk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much, it work good. But the name of NC code file is not match with toolpath. Could you please fix for me ( for detail, please see attached photo)&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 07:06:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7533006#M24679</guid>
      <dc:creator>newbie123abc</dc:creator>
      <dc:date>2017-11-10T07:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7533045#M24680</link>
      <description>&lt;P&gt;IF NOT ENTITY_EXISTS('NCPROGRAM', $toolpath.name) {&lt;BR /&gt; CREATE NCPROGRAM $toolpath.name ACTIVATE NCPROGRAM # EDIT NCPROGRAM ; APPEND TOOLPATH ; DEACTIVATE NCPROGRAM&lt;BR /&gt;} ELSE {&lt;BR /&gt; STRING msg = "Ncprogram '" +$toolpath.name + "' already exists"&lt;BR /&gt; MESSAGE INFO $msg&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 07:22:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7533045#M24680</guid>
      <dc:creator>kukelyk</dc:creator>
      <dc:date>2017-11-10T07:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7533059#M24681</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3959841"&gt;@kukelyk&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Great ! This is a macro I need. Thank you very much !&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 07:27:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7533059#M24681</guid>
      <dc:creator>newbie123abc</dc:creator>
      <dc:date>2017-11-10T07:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7533224#M24682</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3959841"&gt;@kukelyk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I have one more question ? With your macro, I inserted some codes to make code file like picture which was attached. It is right with active toolpath 6000 and is not right with another active toolpath. Could you please fix it so that can run with any active toolpath. Thank you very much !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my macro:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF NOT ENTITY_EXISTS('NCPROGRAM', $toolpath.name) {&lt;BR /&gt;CREATE NCPROGRAM $toolpath.name ACTIVATE NCPROGRAM # EDIT NCPROGRAM ; APPEND TOOLPATH ; DEACTIVATE NCPROGRAM&lt;BR /&gt;} ELSE {&lt;BR /&gt;STRING msg = "Ncprogram '" +$toolpath.name + "' already exists"&lt;BR /&gt;MESSAGE INFO $msg&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;EXPLORER SELECT NCProgram "NCProgram\6000" NEW&lt;BR /&gt;EDIT NCPROGRAM "6000" QUIT FORM NCTOOLPATH&lt;BR /&gt;EDIT NCPROGRAM "6000" FILENAME "C:\Users\AESI-CAM3\Desktop\New project\test\sample\ncprograms\6000.H"&lt;BR /&gt;EDIT NCPROGRAM "6000" NUMBER "6000"&lt;BR /&gt;EDIT NCPROGRAM '6000' ITEM 0 COMPONENT 0 FIXTUREOFFSET "1"&lt;BR /&gt;NCTOOLPATH ACCEPT FORM ACCEPT NCTOOLPATHLIST FORM ACCEPT NCTOOLLIST&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 08:37:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7533224#M24682</guid>
      <dc:creator>newbie123abc</dc:creator>
      <dc:date>2017-11-10T08:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7533566#M24683</link>
      <description>&lt;PRE&gt;IF NOT ENTITY_EXISTS('NCPROGRAM', $toolpath.name) {
	CREATE NCPROGRAM $toolpath.name ACTIVATE NCPROGRAM # EDIT NCPROGRAM ; APPEND TOOLPATH ; 
	STRING ncp_path =  "C:\Users\AESI-CAM3\Desktop\New project\test\sample\ncprograms\"+ $toolpath.name + ".H"
	EDIT NCPROGRAM ; FILENAME $ncp_path
	INT k = INT($toolpath.name) //You should add some comparison, if the toolpath name can be converted into int, or not..
	EDIT NCPROGRAM ; NUMBER $k
	EDIT NCPROGRAM ; ITEM 0 COMPONENT 0 FIXTUREOFFSET "1"
	DEACTIVATE NCPROGRAM
} ELSE {
	STRING msg = "Ncprogram '" +$toolpath.name + "' already exists"
	MESSAGE INFO $msg
}&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Nov 2017 11:05:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7533566#M24683</guid>
      <dc:creator>kukelyk</dc:creator>
      <dc:date>2017-11-10T11:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7535800#M24684</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3959841"&gt;@kukelyk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much. It works very well.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 02:23:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7535800#M24684</guid>
      <dc:creator>newbie123abc</dc:creator>
      <dc:date>2017-11-11T02:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7574377#M24685</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3959841"&gt;@kukelyk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry to bother you again, but could you please help me this issue ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a macro that will export toolpath name, tool name and toolpath length to excel file. This is the macro:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;//
// Macro to export NC data to Excel
//

// Open File
FILE OPEN "c:\temp\NC.csv" FOR WRITE AS "output"
// Cycle through the NC programs
FOREACH ncp IN folder('NCProgram') {
	// Create an empty list
	STRING List names = {}
	// Output NC Program name
	STRING nome = "NC Program:," + ncp.Name
	FILE WRITE $nome TO "output"
	// Output Header for Toolpath data
	STRING header = "Toolpath Name, Tool Name, Toolpath Length"
	FILE WRITE $header TO "output"
	// loop over the components in the nc program
	FOREACH item IN components(ncp) {
		// Check that it is a toolpath
		IF item.RootType == 'nctoolpath' {
			// Use MEMBER to check that we have not seen this name before
			IF NOT member(names, item.Name) {
				// Add name to list
				bool ok = add_last(names, item.Name)
				// Output data for current toolpath
				STRING line = item.Name + "," + item.Toolname.value + "," + string(item.Length.value)
				FILE WRITE $line TO "output"
			} else {

			}
		}
	}	
	// Write an empty line
	STRING empty_line = " "
	FILE WRITE $empty_line TO "output"
}
// Close File	
FILE CLOSE "output"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to get time of toolpath instead of toolpath length ? Here is the value which I want to export to excel file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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="a.jpg" style="width: 428px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/431150i36172C443C65F53F/image-size/large?v=v2&amp;amp;px=999" role="button" title="a.jpg" alt="a.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much !&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 09:51:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7574377#M24685</guid>
      <dc:creator>newbie123abc</dc:creator>
      <dc:date>2017-11-27T09:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7574444#M24686</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;REAL Time = $entity('toolpath',$item).statistics.LeadsandLinks.Times.plunge + $entity('toolpath',$item).statistics.LeadsandLinks.Times.ramp+ $entity('toolpath',$item).statistics.LeadsandLinks.Times.rapid
$Time = $Time + $entity('toolpath',$item).statistics.LeadsandLinks.Times.others + $entity('toolpath',$item).statistics.cuttingmoves.Times.arcs + $entity('toolpath',$item).statistics.cuttingmoves.Times.linear
STRING Timestring =  ''

STRING hours = STRING(INT($Time/60))
IF INT($hours) &amp;lt; 10 {
	$hours = '0' + $hours
}
STRING mins = STRING(INT($Time%60))
IF INT($mins) &amp;lt; 10 {
	$mins = '0' + $mins
}				
STRING secs = STRING(INT((($Time-INT($Time%60))*60)))
IF INT($secs) &amp;lt; 10 {
	$secs = '0' + $secs
}	

$Timestring =  $hours + ":" + $mins + ":" + $secs&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Nov 2017 10:17:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7574444#M24686</guid>
      <dc:creator>kukelyk</dc:creator>
      <dc:date>2017-11-27T10:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575098#M24687</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3959841"&gt;@kukelyk&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for you help, but it doesn't match with my expectation. I had a NC program like this:&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="a.jpg" style="width: 242px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/431255iFA99F3F86D447D4B/image-size/large?v=v2&amp;amp;px=999" role="button" title="a.jpg" alt="a.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And when I run my macro above, I will have a file in C drive like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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="b.jpg" style="width: 558px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/431257iEF7A123CC920E532/image-size/large?v=v2&amp;amp;px=999" role="button" title="b.jpg" alt="b.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I have the macro so that when I run it, I can get toolpath time instead of toolpath length like this: ( the time will be copied at the row where i highlighted at the photo above)&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="c.jpg" style="width: 558px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/431267i10780532FC04869C/image-size/large?v=v2&amp;amp;px=999" role="button" title="c.jpg" alt="c.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me if you have any solution. Thank you very much !&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 14:26:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575098#M24687</guid>
      <dc:creator>newbie123abc</dc:creator>
      <dc:date>2017-11-27T14:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575264#M24688</link>
      <description>&lt;P&gt;&amp;nbsp;Try to continue this:&lt;/P&gt;
&lt;PRE&gt;REAL sumtime = 0
FOREACH ncp IN FOLDER('ncprogram') {
	REAL ncptime = 0
	FOREACH $tp IN COMPONENTS($entity('ncprogram',$ncp)) {
		IF $tp.RootType == 'nctoolpath' {
			REAL Time = 0
			$Time = $entity('toolpath',$tp.name).statistics.LeadsandLinks.Times.plunge + ...
			
			$ncptime = $ncptime + $Time
			$sumtime = $sumtime + $Time
		}			
	}
}&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Nov 2017 14:51:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575264#M24688</guid>
      <dc:creator>kukelyk</dc:creator>
      <dc:date>2017-11-27T14:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575349#M24689</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3959841"&gt;@kukelyk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a beginner so I don't know how to use your macro. Could you please write full macro for me ? I tried to edit my macro like this but it didn't work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//&lt;BR /&gt;// Macro to export NC data to Excel&lt;BR /&gt;//&lt;/P&gt;&lt;P&gt;// Open File&lt;BR /&gt;FILE OPEN "c:\temp\NC.csv" FOR WRITE AS "output"&lt;BR /&gt;// Cycle through the NC programs&lt;BR /&gt;FOREACH ncp IN folder('NCProgram') {&lt;BR /&gt;// Create an empty list&lt;BR /&gt;STRING List names = {}&lt;BR /&gt;// Output NC Program name&lt;BR /&gt;STRING nome = "NC Program:," + ncp.Name&lt;BR /&gt;FILE WRITE $nome TO "output"&lt;BR /&gt;// Output Header for Toolpath data&lt;BR /&gt;STRING header = "Toolpath Name, Tool Name, Toolpath Time"&lt;BR /&gt;FILE WRITE $header TO "output"&lt;BR /&gt;// loop over the components in the nc program&lt;BR /&gt;FOREACH item IN components(ncp) {&lt;BR /&gt;// Check that it is a toolpath&lt;BR /&gt;IF item.RootType == 'nctoolpath' {&lt;BR /&gt;// Use MEMBER to check that we have not seen this name before&lt;BR /&gt;IF NOT member(names, item.Name) {&lt;BR /&gt;// Add name to list&lt;BR /&gt;bool ok = add_last(names, item.Name)&lt;BR /&gt;// Output data for current toolpath&lt;BR /&gt;STRING line = item.Name + "," + item.Toolname.value + "," + string(item.Statistics.Time.value)&lt;BR /&gt;FILE WRITE $line TO "output"&lt;BR /&gt;} else {&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;// Write an empty line&lt;BR /&gt;STRING empty_line = " "&lt;BR /&gt;FILE WRITE $empty_line TO "output"&lt;BR /&gt;}&lt;BR /&gt;// Close File&lt;BR /&gt;FILE CLOSE "output"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I changed my macro at the red cirlce.&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="d.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/431315i2436E4599B51D494/image-size/large?v=v2&amp;amp;px=999" role="button" title="d.jpg" alt="d.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 15:08:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575349#M24689</guid>
      <dc:creator>newbie123abc</dc:creator>
      <dc:date>2017-11-27T15:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575388#M24690</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;//
// Macro to export NC data to Excel
//

// Open File
FILE OPEN "c:\temp\NC.csv" FOR WRITE AS "output"
// Cycle through the NC programs
REAL sumtime = 0
FOREACH ncp IN folder('NCProgram') {
	REAL ncptime = 0
	// Create an empty list
	STRING List names = {}
	// Output NC Program name
	STRING nome = "NC Program:," + ncp.Name
	FILE WRITE $nome TO "output"
	// Output Header for Toolpath data
	STRING header = "Toolpath Name, Tool Name, Toolpath Length"
	FILE WRITE $header TO "output"
	// loop over the components in the nc program
	FOREACH item IN components(ncp) {
		// Check that it is a toolpath
		IF item.RootType == 'nctoolpath' {

			REAL Time = $entity('toolpath',$item).statistics.LeadsandLinks.Times.plunge + $entity('toolpath',$item).statistics.LeadsandLinks.Times.ramp+ $entity('toolpath',$item).statistics.LeadsandLinks.Times.rapid
			$Time = $Time + $entity('toolpath',$item).statistics.LeadsandLinks.Times.others + $entity('toolpath',$item).statistics.cuttingmoves.Times.arcs + $entity('toolpath',$item).statistics.cuttingmoves.Times.linear
			STRING tpTime =  ''

			STRING hours = STRING(INT($Time/60))
			IF INT($hours) &amp;lt; 10 {
				$hours = '0' + $hours
			}
			STRING mins = STRING(INT($Time%60))
			IF INT($mins) &amp;lt; 10 {
				$mins = '0' + $mins
			}				
			STRING secs = STRING(INT((($Time-INT($Time%60))*60)))
			IF INT($secs) &amp;lt; 10 {
				$secs = '0' + $secs
			}	
			$tpTime =  $hours + ":" + $mins + ":" + $secs
			$ncptime = $ncptime + $Time
			$sumtime = $sumtime + $Time
			// Use MEMBER to check that we have not seen this name before
			IF NOT member(names, item.Name) {
				// Add name to list
				bool ok = add_last(names, item.Name)
				// Output data for current toolpath
				STRING line = item.Name + "," + item.Toolname.value + "," + $tpTime
				FILE WRITE $line TO "output"
			}
		}
	}	
	// Write an empty line
	STRING empty_line = " "
	FILE WRITE $empty_line TO "output"
}
// Close File	
FILE CLOSE "output"&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Nov 2017 15:16:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575388#M24690</guid>
      <dc:creator>kukelyk</dc:creator>
      <dc:date>2017-11-27T15:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575437#M24691</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3959841"&gt;@kukelyk&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your full macro. I tried to run it but there is a mistake like this. Could you have any solution to solve ?&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="d.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/431319iF80439A14D577DD8/image-size/large?v=v2&amp;amp;px=999" role="button" title="d.jpg" alt="d.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 15:26:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575437#M24691</guid>
      <dc:creator>newbie123abc</dc:creator>
      <dc:date>2017-11-27T15:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to create NC code</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575484#M24692</link>
      <description>&lt;P&gt;Hope this will work :&lt;/P&gt;
&lt;PRE&gt;//
// Macro to export NC data to Excel
//

// Open File
FILE OPEN "c:\temp\NC.csv" FOR WRITE AS "output"
// Cycle through the NC programs
REAL sumtime = 0
FOREACH ncp IN folder('NCProgram') {
	REAL ncptime = 0
	// Create an empty list
	STRING List names = {}
	// Output NC Program name
	STRING nome = "NC Program:," + ncp.Name
	FILE WRITE $nome TO "output"
	// Output Header for Toolpath data
	STRING header = "Toolpath Name, Tool Name, Toolpath Length"
	FILE WRITE $header TO "output"
	// loop over the components in the nc program
	FOREACH item IN components(ncp) {
		// Check that it is a toolpath
		IF item.RootType == 'nctoolpath' {

			REAL Time = $entity('toolpath',$item.name).statistics.LeadsandLinks.Times.plunge + $entity('toolpath',$item.name).statistics.LeadsandLinks.Times.ramp+ $entity('toolpath',$item.name).statistics.LeadsandLinks.Times.rapid
			$Time = $Time + $entity('toolpath',$item.name).statistics.LeadsandLinks.Times.others + $entity('toolpath',$item.name).statistics.cuttingmoves.Times.arcs + $entity('toolpath',$item.name).statistics.cuttingmoves.Times.linear
			STRING tpTime =  ''

			STRING hours = STRING(INT($Time/60))
			IF INT($hours) &amp;lt; 10 {
				$hours = '0' + $hours
			}
			STRING mins = STRING(INT($Time%60))
			IF INT($mins) &amp;lt; 10 {
				$mins = '0' + $mins
			}				
			STRING secs = STRING(INT((($Time-INT($Time%60))*60)))
			IF INT($secs) &amp;lt; 10 {
				$secs = '0' + $secs
			}	
			$tpTime =  $hours + ":" + $mins + ":" + $secs
			$ncptime = $ncptime + $Time
			$sumtime = $sumtime + $Time
			// Use MEMBER to check that we have not seen this name before
			IF NOT member(names, item.Name) {
				// Add name to list
				bool ok = add_last(names, item.Name)
				// Output data for current toolpath
				STRING line = item.Name + "," + item.Toolname.value + "," + $tpTime
				FILE WRITE $line TO "output"
			}
		}
	}	
	// Write an empty line
	STRING empty_line = " "
	FILE WRITE $empty_line TO "output"
}
// Close File	
FILE CLOSE "output"

&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Nov 2017 15:39:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-create-nc-code/m-p/7575484#M24692</guid>
      <dc:creator>kukelyk</dc:creator>
      <dc:date>2017-11-27T15:39:02Z</dc:date>
    </item>
  </channel>
</rss>

