<?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: Custom Macro for DNC software. in PowerMill Forum</title>
    <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021411#M22622</link>
    <description>&lt;P&gt;now I'm thinking about this more than my work!&lt;/P&gt;&lt;P&gt;make a list also for $MT&amp;nbsp; (i'm assuming MT01 is for alum, MT02 is moldstar and so on...?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;STRING LIST Materials= {"ALUMINUM", "MOLDSTAR", "P20", "420SS", "440SS", "H13", "S7", "D2/DC53"}&lt;/P&gt;&lt;P&gt;STRING LIST MT = {"MT01","MT02","MT03","MT04","MT05","MT06","MT07","MT08"}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then use $MT[$D]&amp;nbsp;&amp;nbsp; where you use the $MT variable. that'll cut your code down even more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just saw your profile picture. that is my favorite Farley skit...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 May 2018 16:14:26 GMT</pubDate>
    <dc:creator>TK.421</dc:creator>
    <dc:date>2018-05-23T16:14:26Z</dc:date>
    <item>
      <title>Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/7832576#M22611</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I am looking for somone that can help me finish a custom macro that was developed for my comany prior to the Autodesk merge.&amp;nbsp; We have a proprietary DNC system and to help streamline the process from posted code to DNC files we devised a macro that generates the "lower half" of the form pertaining to tooling.&amp;nbsp; Which tools to run on what NCPrograms in particular.&amp;nbsp; What I am trying to do now is complete this macro so the entire form is populated solely by information out of&amp;nbsp; Powermill.&amp;nbsp; I understand that this macro will require a BOATLOAD of string information and probably a BOATLOAD of IF/THEN functions and lists within it but maybe I can slowly chip away at it with all of your help.&amp;nbsp; I have attached three files showing the macro we are currently using, a file that is created with the macro (unfinished), and a completed file which is created after we run it through our DNC prep software.&amp;nbsp; I have&amp;nbsp;also attached a photo showing&amp;nbsp;the areas that I "think" these fields can be populated from.&amp;nbsp; The method of gathering these variables is where I stuggle.&amp;nbsp; I know what I am looking for but getting there is half the battle.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Where to.PNG" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/471707iFC8BB87A369404D7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Where to.PNG" alt="Where to.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 21:12:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/7832576#M22611</guid>
      <dc:creator>Eskondedo</dc:creator>
      <dc:date>2018-03-06T21:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/7880922#M22612</link>
      <description>&lt;P&gt;have you gotten anywhere on this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Mar 2018 09:50:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/7880922#M22612</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2018-03-24T09:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/7881304#M22613</link>
      <description>I have not.&lt;BR /&gt;</description>
      <pubDate>Sat, 24 Mar 2018 15:30:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/7881304#M22613</guid>
      <dc:creator>Eskondedo</dc:creator>
      <dc:date>2018-03-24T15:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8020409#M22614</link>
      <description>&lt;P&gt;So I am starting to work on the final peices of this macro now and am running into what is im sure a newjack mistake.&amp;nbsp; I am trying to create a dropdown of selectable machines, and eventually materials, and creating strings from the choices made.&amp;nbsp; The problem is the string doesn't stay defined as the macro progresses beyond the point of defintion.&amp;nbsp; I need to be able to recall the selected choice later in the macro so the string is written at the correct time.&amp;nbsp; How can I keep the string from disappearing?&amp;nbsp; The code in question is defined below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;STRING LIST Options= {"V33", "A51", "A71", "A51/A71"}&lt;BR /&gt;INT c = INPUT CHOICE $Options "Select the output machine"&lt;BR /&gt;IF $C==0 {&lt;BR /&gt;&amp;nbsp;STRING MACHINE = 'V33'&lt;BR /&gt;} ELSEIF $C==1 {&lt;BR /&gt;&amp;nbsp;STRING MACHINE = 'A51'&lt;BR /&gt;} ELSEIF $C==2 {&lt;BR /&gt;&amp;nbsp;STRING MACHINE = 'A71'&lt;BR /&gt;} ELSEIF $C==3 {&lt;BR /&gt;&amp;nbsp;STRING MACHINE = 'A51/A71'&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is for STRING MACHINE to be used laster in the program to be built into a larger string but as soon as the ELSEIF is triggered it disappears when debugging the much larger macro. Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 10:21:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8020409#M22614</guid>
      <dc:creator>Eskondedo</dc:creator>
      <dc:date>2018-05-23T10:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8020490#M22615</link>
      <description>&lt;P&gt;c is lowercase when you define your variable and uppercase when you write your if/else statements. does it work if you make them all the same case?&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 11:10:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8020490#M22615</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2018-05-23T11:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8020493#M22616</link>
      <description>&lt;P&gt;i think also you need to refer to the variable as $Options[$c]&amp;nbsp;&amp;nbsp; $Options is your list, $c is simply a number. $c tells the macro what place to look at in $Options&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 11:13:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8020493#M22616</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2018-05-23T11:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021054#M22617</link>
      <description>&lt;P&gt;Had to do some diggin but figured out where I went wrong.&amp;nbsp; I needed to specify the string prior to the list then use the $ in my IF ELSE statement.&amp;nbsp; I ended up changing the structure though because it was skipping all over the place with the old format.&amp;nbsp; New format shows as follows.&lt;/P&gt;&lt;P&gt;STRING MACHINE = ""&lt;BR /&gt;STRING MATERIAL = ""&lt;BR /&gt;STRING MT = ""&lt;/P&gt;&lt;P&gt;STRING LIST Options= {"V33", "A51", "A71", "A51/A71"}&lt;BR /&gt;INT C = INPUT CHOICE $Options "Select the output machine"&lt;BR /&gt;IF $C==0 {&lt;BR /&gt;&amp;nbsp;$MACHINE = 'V33'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $C==1 {&lt;BR /&gt;&amp;nbsp;$MACHINE = 'A51'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $C==2 {&lt;BR /&gt;&amp;nbsp;$MACHINE = 'A71'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $C==3 {&lt;BR /&gt;&amp;nbsp;$MACHINE = 'A51/A71'&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;STRING LIST Materials= {"ALUMINUM", "MOLDSTAR", "P20", "420SS", "440SS", "H13", "S7", "D2/DC53"}&lt;BR /&gt;INT D = INPUT CHOICE $Materials "Select the material being cut"&lt;BR /&gt;IF $D==0 {&lt;BR /&gt;&amp;nbsp;$MATERIAL = 'ALUM'&lt;BR /&gt;&amp;nbsp;$MT = 'MT01'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $D==1 {&lt;BR /&gt;&amp;nbsp;$MATERIAL = 'MOLDSTAR'&lt;BR /&gt;&amp;nbsp;$MT = 'MT02&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $D==2 {&lt;BR /&gt;&amp;nbsp;$MATERIAL = 'P20'&lt;BR /&gt;&amp;nbsp;$MT = 'MT03'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $D==3 {&lt;BR /&gt;&amp;nbsp;$MATERIAL = '420SS'&lt;BR /&gt;&amp;nbsp;$MT = 'MT04'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $D==4 {&lt;BR /&gt;&amp;nbsp;$MATERIAL = '440SS'&lt;BR /&gt;&amp;nbsp;$MT = 'MT05'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $D==5 {&lt;BR /&gt;&amp;nbsp;$MATERIAL = 'H13'&lt;BR /&gt;&amp;nbsp;$MT = 'MT06'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $D==6 {&lt;BR /&gt;&amp;nbsp;$MATERIAL = 'S7'&lt;BR /&gt;&amp;nbsp;$MT = 'MT07'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $D==7 {&lt;BR /&gt;&amp;nbsp;$MATERIAL = 'D2/DC53'&lt;BR /&gt;&amp;nbsp;$MT = 'MT08'&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now on to the next hurdle, how do I get the macro to continue past these statements?&amp;nbsp; When I run through debug once both conditions have been met the macro resets and theres 300 more lines to run through...&lt;img id="smileymad" class="emoticon emoticon-smileymad" src="https://forums.autodesk.com/i/smilies/16x16_smiley-mad.png" alt="Smiley Mad" title="Smiley Mad" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Close one door, only to open another... thanks again.&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 14:36:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021054#M22617</guid>
      <dc:creator>Eskondedo</dc:creator>
      <dc:date>2018-05-23T14:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021082#M22618</link>
      <description>&lt;P&gt;I'll just clarify this again: I've not read through your entire macro, and I don't fully understand your process or big picture... that said, what if you just use a series of IF statements instead of all the if/else:&lt;/P&gt;&lt;P&gt;IF $d == 0 {&lt;/P&gt;&lt;P&gt;&amp;nbsp; ewrwer&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF $d ==1 {&lt;/P&gt;&lt;P&gt;&amp;nbsp; 34234234&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;another way to try it would be to write it as:&lt;BR /&gt;IF $D == 0 {&lt;/P&gt;&lt;P&gt;&amp;nbsp; sadsadf&lt;/P&gt;&lt;P&gt;} ELSEIF $D == 1{&lt;/P&gt;&lt;P&gt;&amp;nbsp; sdfsdfdf&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in my thinking, once those commands are met, it will skip all the other statements. do the same with your machine assignment code.&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 14:46:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021082#M22618</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2018-05-23T14:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021117#M22619</link>
      <description>&lt;P&gt;i think you can also shorten your code by trying this (i think it'll work better)&lt;/P&gt;&lt;P&gt;STRING LIST Options= {"V33", "A51", "A71", "A51/A71"}&lt;BR /&gt;INT C = INPUT CHOICE $Options "Select the output machine"&lt;/P&gt;&lt;P&gt;STRING MACHINE = ${$Options[$C]}&amp;nbsp;&amp;nbsp; or $Options[$C]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i can never remember the syntax for that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you may not even need that last line. if you want the machine name pasted somewhere, just try using ${$Options[$C]} where you have $MACHINE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;once you have that working, follow suit with your material and what else not&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 14:54:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021117#M22619</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2018-05-23T14:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021138#M22620</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4217582"&gt;@Eskondedo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Had to do some diggin but figured out where I went wrong.&amp;nbsp; I needed to specify the string prior to the list then use the $ in my IF ELSE statement.&amp;nbsp; I ended up changing the structure though because it was skipping all over the place with the old format.&amp;nbsp; New format shows as follows.&lt;/P&gt;&lt;P&gt;STRING MACHINE = ""&lt;BR /&gt;STRING MATERIAL = ""&lt;BR /&gt;STRING MT = ""&lt;/P&gt;&lt;P&gt;STRING LIST Options= {"V33", "A51", "A71", "A51/A71"}&lt;BR /&gt;INT C = INPUT CHOICE $Options "Select the output machine"&lt;BR /&gt;IF $C==0 {&lt;BR /&gt;&amp;nbsp;$MACHINE = 'V33'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $C==1 {&lt;BR /&gt;&amp;nbsp;$MACHINE = 'A51'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $C==2 {&lt;BR /&gt;&amp;nbsp;$MACHINE = 'A71'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $C==3 {&lt;BR /&gt;&amp;nbsp;$MACHINE = 'A51/A71'&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;STRING LIST Materials= {"ALUMINUM", "MOLDSTAR", "P20", "420SS", "440SS", "H13", "S7", "D2/DC53"}&lt;BR /&gt;INT D = INPUT CHOICE $Materials "Select the material being cut"&lt;BR /&gt;IF $D==0 {&lt;BR /&gt;&amp;nbsp;$MATERIAL = 'ALUM'&lt;BR /&gt;&amp;nbsp;$MT = 'MT01'&lt;BR /&gt;} ELSE {&lt;BR /&gt;&amp;nbsp;IF $D==1 {&lt;BR /&gt;&amp;nbsp;$MATERIAL = 'MOLDSTAR'&lt;BR /&gt;&amp;nbsp;$MT = 'MT02&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And theres my error i was missing a ' after 'MT02....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 14:59:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021138#M22620</guid>
      <dc:creator>Eskondedo</dc:creator>
      <dc:date>2018-05-23T14:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021150#M22621</link>
      <description>&lt;P&gt;it's this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;STRING MACHINE = $Options[$C]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just use $Options[$C] anywhere you use $MACHINE instead of defining a new variable. that'll shorten up your code A TON and get rid of all those if statements&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 15:03:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021150#M22621</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2018-05-23T15:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021411#M22622</link>
      <description>&lt;P&gt;now I'm thinking about this more than my work!&lt;/P&gt;&lt;P&gt;make a list also for $MT&amp;nbsp; (i'm assuming MT01 is for alum, MT02 is moldstar and so on...?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;STRING LIST Materials= {"ALUMINUM", "MOLDSTAR", "P20", "420SS", "440SS", "H13", "S7", "D2/DC53"}&lt;/P&gt;&lt;P&gt;STRING LIST MT = {"MT01","MT02","MT03","MT04","MT05","MT06","MT07","MT08"}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then use $MT[$D]&amp;nbsp;&amp;nbsp; where you use the $MT variable. that'll cut your code down even more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just saw your profile picture. that is my favorite Farley skit...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 16:14:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8021411#M22622</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2018-05-23T16:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8023200#M22623</link>
      <description>&lt;P&gt;This has turned into quite the monster but as of now all is working accordingly.&amp;nbsp; Thanks TK.421&amp;nbsp;for the help with streamlining this, its made things so much better for my members.&amp;nbsp; Less user interface and more automation = less chance for error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One additional thing i would like it to do is only run on unwritten NC Programs, as of now it runs on all programs whether they've been written or not, I'd really like to prevent it from running on finalized and written NC programs.&amp;nbsp; I think the way id like it to work is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//CHECKS IF NCPROGRAM IS ALREADY WRITTEN, IF SO SKIP AND CONTINUE TO THE NEXT NCPROGRAM&lt;/P&gt;&lt;P&gt;FOREACH ncP IN Folder ('NCProgram') {&lt;BR /&gt;&amp;nbsp;IF $ncp.status = not_written {&lt;/P&gt;&lt;P&gt;run whole macro...&lt;/P&gt;&lt;P&gt;} ELSE {&lt;/P&gt;&lt;P&gt;and this is where I get stuck, how do I tell it to skip the written and continue on?&amp;nbsp; I can post the entire macro if it makes things easier lord knows its a beast.&amp;nbsp; Thanks again for everything.&lt;/P&gt;</description>
      <pubDate>Thu, 24 May 2018 09:29:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8023200#M22623</guid>
      <dc:creator>Eskondedo</dc:creator>
      <dc:date>2018-05-24T09:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8023306#M22624</link>
      <description>&lt;P&gt;FOREACH ncP IN Folder ('NCProgram') {&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;STRING NCPSTAT = $ncP.status&lt;BR /&gt;&amp;nbsp;IF $NCPSTAT != "written" {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well here it is and is working.&lt;/P&gt;</description>
      <pubDate>Thu, 24 May 2018 10:16:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8023306#M22624</guid>
      <dc:creator>Eskondedo</dc:creator>
      <dc:date>2018-05-24T10:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8023650#M22625</link>
      <description>&lt;P&gt;Awesome! Glad you got it working.&amp;nbsp; the code you wrote should work:&lt;/P&gt;&lt;PRE&gt;FOREACH ncP IN Folder ('NCProgram') {
 IF $ncp.status = not_written {

run whole macro...

} ELSE {&lt;/PRE&gt;&lt;P&gt;with a couple minor tweaks:&lt;/P&gt;&lt;PRE&gt;FOREACH ncP IN Folder ('NCProgram') {
 IF $ncP.status == 'not_written' {

run whole macro...

} ELSE {&lt;/PRE&gt;&lt;P&gt;happy programming&lt;/P&gt;</description>
      <pubDate>Thu, 24 May 2018 12:33:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8023650#M22625</guid>
      <dc:creator>TK.421</dc:creator>
      <dc:date>2018-05-24T12:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Macro for DNC software.</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8027514#M22626</link>
      <description>&lt;P&gt;Ok so heres the whole kitten caboodle, you can comment out the tool Z check.mac but Id like it to cycle through unwritten ncprograms stop once theyre all done.&amp;nbsp; As of now it just continues to cycle like teh loops not closed.&amp;nbsp; also my $XLENGTH &amp;amp;&amp;nbsp;$YLENGTH functions are not working. I watch it run through the debugger and the values in each string are clearly being defined but the if ==, if &amp;gt;, and if &amp;lt; are not working correctly.&amp;nbsp; Any help from this&amp;nbsp;point would be great.&amp;nbsp; I thought I had it all worked out but darned if one of my members proved me wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;//STRING projectloc = project_pathname(0)
//print = $projectloc
STRING PROJECTNAME = project_pathname(1)
		STRING SQNO = SUBSTRING("$PROJECTNAME",0,5)
		STRING PART = SUBSTRING("$PROJECTNAME",6,6)
STRING destination = 'c:\temp\'
STRING filename = 'c:\temp\PLACEHOLDER.TXT' 
STRING extension = '.P3X'
STRING FILESTART = '&amp;lt;?xml version="1.0" encoding="shift-jis"?&amp;gt;'
STRING COMMENT1 = '&amp;lt;!-- NC PROGRAM INFORMATION --&amp;gt;'
STRING ncpinfo1 = '&amp;lt;NCPINFO&amp;gt;'
STRING ncpinfo2 = '&amp;lt;/NCPINFO&amp;gt;'
STRING NCPACKAGEINFO1 = '	' + '&amp;lt;NCPACKAGE_INFO&amp;gt;'
STRING CREATE1 = '	' + '	' + '&amp;lt;CREATE&amp;gt;'
STRING APP = '	' + '	' + '	' + '&amp;lt;APP NAME="POST3D" VERSION="2.170"/&amp;gt;'
STRING CREATE2 = '	' + '	' + '&amp;lt;/CREATE&amp;gt;'
STRING TOOLZ = '	' + '	' + '&amp;lt;TOOLZ VAL="'
STRING PROGRAMMER = $project.Programmer
STRING PROGRAMMERVAL = '	' + '	' + '&amp;lt;PROGRAMMER VAL="'
STRING CAMSOFTWARE = '	' + '	' + '&amp;lt;CAMSOFT VAL="Delcam"/&amp;gt;'
STRING PROCESSSTAMP = '	' + '	' + '&amp;lt;PROCESS_STAMP VAL="'
STRING NCPACKAGEINFO2 = '	' + '&amp;lt;/NCPACKAGE_INFO&amp;gt;'
STRING MOLDINFO = '	' + '&amp;lt;MOLD_INFO&amp;gt;'
STRING SEQNOVAL = '	' + '	' + '&amp;lt;SEQ_NO VAL="'
STRING MOLDINFO2 = '	' + '&amp;lt;/MOLD_INFO&amp;gt;'
STRING WORKINFO = '	' + '&amp;lt;WORK_INFO&amp;gt;'
STRING PARTNOVAL = '	' + '	' + '&amp;lt;PART_NO VAL="'
STRING PARTSTYPE = '	' + '	' + '&amp;lt;WORK_TYPE ID=" 0" NAME=""/&amp;gt;'
STRING MATERIALID = '	' + '	' + '&amp;lt;MATERIAL ID="'
STRING MATERIALID2 = '" NAME="'
STRING WORKINFO2 = '	' + '&amp;lt;/WORK_INFO&amp;gt;'
STRING FACEINFO = '	' + '&amp;lt;FACE_INFO&amp;gt;'
STRING FACEID1 = '	' + '	' + '&amp;lt;FACE_ID VAL="'
STRING ORIGINVAL = '	' + '	' + '&amp;lt;ORIGIN VAL="'
STRING DIRECTIONVAL = '	' + '	' + '&amp;lt;DIRECTION VAL="'
STRING WORKSIZE = '	' + '	' + '&amp;lt;WORK_SIZE'
STRING XEQ = ' X="'
STRING YEQ = ' Y="'
STRING ZEQ = ' Z="'
STRING CLOSESIZE = '"'
STRING FACEINFO2 = '	' + '&amp;lt;/FACE_INFO&amp;gt;'
STRING MACHINEINFO = '	' + '&amp;lt;MACHINE_INFO&amp;gt;'
STRING MACHINEID1 = '	' + '	' + '&amp;lt;MACHINE ID="'
STRING MACHINEID2 = '" NAME="'
STRING MACHINE2 = '	' + '	' + '&amp;lt;MACHINE2 ID="" NAME=""/&amp;gt;'
STRING MACHINEINFO2 = '	' + '&amp;lt;/MACHINE_INFO&amp;gt;'
STRING files1 = '	' + '&amp;lt;FILES&amp;gt;'
STRING files2 = '	' + '&amp;lt;/FILES&amp;gt;'
STRING ncfilepath1 = '	' + '	' + '&amp;lt;NCFILE PATH="'
STRING ncfilepath2 = '"&amp;gt;'
STRING ncfilepath3 = '	' + '	' + '&amp;lt;/NCFILE&amp;gt;'
STRING ncfiletoolname1 = '	' + '	' + '	' + '&amp;lt;TOOL NAME="'
STRING ncfiletoolname2 = '" DIR="'
STRING ncfiletoolname2a = '"/&amp;gt;'
STRING ncfiletoolname3 = '	' + '	' + '	' + '&amp;lt;SORT VAL="0"/&amp;gt;'
STRING ncfiletoolname4 = '	' + '	' + '	' + '&amp;lt;NCD_OFFSET VAL="0"/&amp;gt;'
STRING ncfiletoolname5 = '	' + '	' + '	' + '&amp;lt;PATH_TYPE VAL="0"/&amp;gt;'
STRING testing = 'END NC PROGRAM'
STRING removethis = '{ncprogram}'

//CHECKS IF THERE IS A MATERIAL MODEL WITHIN THE PROJECT

IF NOT entity_exists('model','MATERIAL') {
	MESSAGE ERROR " There is no Material model in the project"
	MACRO ABORT ALL
}

//CHECKS IF NCPROGRAM IS ALREADY WRITTEN, IF SO SKIP AND CONTINUE TO THE NEXT NCPROGRAM

//FOREACH ncP IN Folder ('NCProgram') {
	
	//STRING NCPSTAT = $ncP.status
	//IF $NCPSTAT != "written" {
	


// RUN TOOL Z CHECK MACRO TO ENSURE ALL STARTPOINTS ARE THE SAME FOR EACH FACE
MACRO "G:\Program\03-member\Stephan\Delcam\MACROS\ToolZ Check.mac"

INT i = 0
REAL spZ = ""
STRING MACHINE = ""
STRING MATERIAL = ""
STRING MT = ""
STRING MC = ""

//SPECIFY MACHINE AND MATERIAL

STRING LIST Options= {"V33", "A51", "A71", "A51/A71"} 
INT A = INPUT CHOICE $Options "Select the output machine"
IF $A==0 { 
	$MACHINE = 'V33'
	$MC = 'MC33'
	} ELSE {
		IF $A==1 {
		$MACHINE = 'A51'
		$MC = 'MC51'
		} ELSE {
			IF $A==2 {
			$MACHINE = 'A71'
			$MC = 'MC51'
				} ELSE {
					IF $A==3 {
					$MACHINE = 'A51/A71'
							}
						}
				}
			}
//BUILD FINAL MACHINE STRING INFO FOR P3D		
STRING PROCESSSTAMPCOMPLETE = $PROCESSSTAMP + $MACHINE + $ncfiletoolname2a
STRING MACHINEIDCOMPLETE = $MACHINEID1 + $MC + $MACHINEID2 + $MACHINE + $ncfiletoolname2a
			
			
STRING LIST MATERIALS= {"ALUMINUM", "MOLDSTAR", "P20", "420SS", "440SS", "H13", "S7", "D2/DC53"} 
INT D = INPUT CHOICE $MATERIALS "Select the material being cut"
IF $D==0 { 
	$MATERIAL = 'ALUM'
	$MT = 'MT01'
		} ELSE {
			IF $D==1 {
			$MATERIAL = 'MOLDSTAR'
			$MT = 'MT02'
				} ELSE {
					IF $D==2 {
					$MATERIAL = 'P20'
					$MT = 'MT03'
						} ELSE {
							IF $D==3 {
							$MATERIAL = '420SS'
							$MT = 'MT04'
								} ELSE {
									IF $D==4 {
									$MATERIAL = '440SS'
									$MT = 'MT05'
										} ELSE {
											IF $D==5 {
											$MATERIAL = 'H13'
											$MT = 'MT06'
												} ELSE {
													IF $D==6 {
													$MATERIAL = 'S7'
													$MT = 'MT07'
														} ELSE {
															IF $D==7 {
															$MATERIAL = 'D2/DC53'
															$MT = 'MT08'
																	}
																}
														}
												}
										}
								}
						}
				}

//BUILD FINAL MATERIAL STRING FOR P3D				
STRING MATERIALIDCOMPLETE = $MATERIALID + $MT + $MATERIALID2 + $MATERIAL + $ncfiletoolname2a

// Cycle through the NC programs
FOREACH ncp IN folder('NCProgram') {
	STRING $curncp = 'CURRENT NCPROGRAM IS: ' + ncp.name
	print = ncp.name
		
// FIND TOOL Z FROM FIRST TOOLPATH OF THE NCPROGRAM
	GRAPHICS LOCK
		FOREACH ncP IN Folder ('NCProgram') {
		INT c = 0
		STRING ncName = $ncP.name
		STRING LIST tpNames = extract(entity('ncprogram', ncName).nctoolpath, 'Name')
			ACTIVATE TOOLPATH $tpNames[0]
			$spZ = startpoint.position.Z						
			STRING TOOLZCOMPLETE = $TOOLZ + $spZ + $ncfiletoolname2a

// Collect workplane name to use for face value in P3D		
		STRING WORKPLANE = $entity('workplane','').name
			STRING FACE = SUBSTRING("$WORKPLANE",0,1)
			STRING FACEIDCOMPLETE = $FACEID1 + $FACE + $ncfiletoolname2a

// Complete Project name and number string
	STRING SEQNOVALCOMPLETE = $SEQNOVAL + $SQNO + $ncfiletoolname2a
	STRING PARTNOVALCOMPLETE = $PARTNOVAL + $PART + $ncfiletoolname2a
		
//	FILE WRITE $curncp TO output

		// Moved the filename generator here so seperate files will be made for each ncprogram.
		// A file is open to be written here, and is closed once the macro reaches the last toolpath contained within
		$filename = $destination + project.name +'_-_' + ncp.name + $extension
		FILE OPEN $filename FOR WRITE AS output
		// start writing to the file
		FILE WRITE $FILESTART TO output
		FILE WRITE $COMMENT1 TO output
		FILE WRITE $ncpinfo1 TO output
		FILE WRITE $NCPACKAGEINFO1 TO output
		FILE WRITE $CREATE1 TO output
		FILE WRITE $APP TO output
		FILE WRITE $CREATE2 TO output
		FILE WRITE $TOOLZCOMPLETE TO output
		
// PULL PROGRAMMER NAME FROM PROJECT AND MATCH P3D NAME
	IF position (PROGRAMMER, 'Svoborni') &amp;gt;= 0 {
		STRING FINALPROGRAMMER = replace($PROGRAMMER, "Svoborni", "Stephan")
		STRING PROGRAMMERNAME = '$PROGRAMMERVAL' + '$FINALPROGRAMMER' + '$ncfiletoolname2a'
		FILE WRITE $PROGRAMMERNAME TO output
			} ELSE {
				IF position (PROGRAMMER, 'jfischer') &amp;gt;= 0 {
					STRING FINALPROGRAMMER = replace($PROGRAMMER, "jfischer", "Jeff")
					STRING PROGRAMMERNAME = '$PROGRAMMERVAL' + '$FINALPROGRAMMER' + '$ncfiletoolname2a'
					FILE WRITE $PROGRAMMERNAME TO output
				} ELSE {
					IF position (PROGRAMMER, 'Fkiser') &amp;gt;= 0 {
						STRING FINALPROGRAMMER = replace($PROGRAMMER, "Fkiser", "Kiser")
						STRING PROGRAMMERNAME = '$PROGRAMMERVAL' + '$FINALPROGRAMMER' + '$ncfiletoolname2a'
						FILE WRITE $PROGRAMMERNAME TO output
					} ELSE {
						IF position (PROGRAMMER, 'jhorhutz') &amp;gt;= 0 {
							STRING FINALPROGRAMMER = replace($PROGRAMMER, "jhorhutz", "Jhorhutz")
							STRING PROGRAMMERNAME = '$PROGRAMMERVAL' + '$FINALPROGRAMMER' + '$ncfiletoolname2a'
							FILE WRITE $PROGRAMMERNAME TO output
						} ELSE {
							IF position (PROGRAMMER, 'jzielins') &amp;gt;= 0 {
								STRING FINALPROGRAMMER = replace($PROGRAMMER, "jzielins", "Jared")
								STRING PROGRAMMERNAME = '$PROGRAMMERVAL' + '$FINALPROGRAMMER' + '$ncfiletoolname2a'
								FILE WRITE $PROGRAMMERNAME TO output
							} ELSE {
								IF position (PROGRAMMER, 'cconner') &amp;gt;= 0 {
									STRING FINALPROGRAMMER = replace($PROGRAMMER, "cconner", "Chris")
									STRING PROGRAMMERNAME = '$PROGRAMMERVAL' + '$FINALPROGRAMMER' + '$ncfiletoolname2a'
									FILE WRITE $PROGRAMMERNAME TO output
								} ELSE {
									IF position (PROGRAMMER, 'rwaller') &amp;gt;= 0 {
										STRING FINALPROGRAMMER = replace($PROGRAMMER, "rwaller", "Rodney")
										STRING PROGRAMMERNAME = '$PROGRAMMERVAL' + '$FINALPROGRAMMER' + '$ncfiletoolname2a'
										FILE WRITE $PROGRAMMERNAME TO output
									} ELSE {
										IF position (PROGRAMMER, 'psowden') &amp;gt;= 0 {
											STRING FINALPROGRAMMER = replace($PROGRAMMER, "psowden", "Paul")
											STRING PROGRAMMERNAME = '$PROGRAMMERVAL' + '$FINALPROGRAMMER' + '$ncfiletoolname2a'
											FILE WRITE $PROGRAMMERNAME TO output
										} ELSE {
											IF position (PROGRAMMER, 'vbundy') &amp;gt;= 0 {
												STRING FINALPROGRAMMER = replace($PROGRAMMER, "vbundy", "Vicki")
												STRING PROGRAMMERNAME = '$PROGRAMMERVAL' + '$FINALPROGRAMMER' + '$ncfiletoolname2a'
												FILE WRITE $PROGRAMMERNAME TO output
											} ELSE {
												IF position (PROGRAMMER, 'DoBrown') &amp;gt;= 0 {
													STRING FINALPROGRAMMER = replace($PROGRAMMER, "DoBrown", "Donnie")
													STRING PROGRAMMERNAME = '$PROGRAMMERVAL' + '$FINALPROGRAMMER' + '$ncfiletoolname2a'
													FILE WRITE $PROGRAMMERNAME TO output
												} ELSE {
													IF position (PROGRAMMER, 'khawthor') &amp;gt;= 0 {
														STRING FINALPROGRAMMER = replace($PROGRAMMER, "khawthor", "Kent")
														STRING PROGRAMMERNAME = '$PROGRAMMERVAL' + '$FINALPROGRAMMER' + '$ncfiletoolname2a'
														FILE WRITE $PROGRAMMERNAME TO output
											}																							
										}													
									}
								}
							}																							
						}													
					}
				}
			}
		}
	}		
		FILE WRITE $CAMSOFTWARE TO output
		FILE WRITE $PROCESSSTAMPCOMPLETE TO output
		FILE WRITE $NCPACKAGEINFO2 TO output
		FILE WRITE $MOLDINFO TO output
		FILE WRITE $SEQNOVALCOMPLETE TO output
		FILE WRITE $MOLDINFO2 TO output
		FILE WRITE $WORKINFO TO output
		FILE WRITE $PARTNOVALCOMPLETE TO output
		FILE WRITE $PARTSTYPE TO output
		FILE WRITE $MATERIALIDCOMPLETE TO output
		FILE WRITE $WORKINFO2 TO output
		FILE WRITE $FACEINFO TO output
		FILE WRITE $FACEIDCOMPLETE TO output

		

// COPY AND PASTE NUMBERS FROM FRAME TO FORCE BLOCK TO TOLERANCES SHOWN
	
	DELETE BLOCK
	DRAW BLOCK
		EDIT MODEL ALL DESELECT ALL
		EDIT PAR powermill.Options.Block.UseReferenceModel 1
		EDIT MODEL "MATERIAL" SELECT SURFACE
			EDIT BLOCK TOLERANCE "0.1"
			EDIT BLOCKTYPE BOX
			EDIT BLOCK COORDINATE WORKPLANE
			EDIT BLOCK RESETLIMIT "0.0"
			EDIT BLOCK LIMITTYPE MODEL
			EDIT BLOCK RESET
			
			//INT pause = 30
			//DO {
			//$pause = $pause-1
			//} WHILE $pause &amp;gt; 0
			
				OBJECT faceblock = Block
				$Block = faceblock
				
REAL roundX = round($Block.Limits.XMin,3)
REAL XMIN = abs($roundX)

REAL roundX2 = round($Block.Limits.XMax,3)
REAL XMAX = abs($roundX2)

REAL roundY = round($Block.Limits.YMin,3)
REAL YMIN = abs($roundY)

REAL roundY2 = round($Block.Limits.YMax,3)
REAL YMAX = abs($roundY2)

REAL roundZ = round($Block.Limits.ZMin,3)
REAL ZMIN = abs($roundZ)

REAL roundZ2 = round($Block.Limits.ZMax,3)
REAL ZMAX = abs($roundZ2)

FORM BLOCK

STRING WIDGETXLENGTH = $widget("RoughBlock.LimitFrame.LenX").Value
STRING XLENGTH = SUBSTRING("$WIDGETXLENGTH",0,7)
STRING WIDGETYLENGTH = $widget("RoughBlock.LimitFrame.LenY").Value
STRING YLENGTH = SUBSTRING("$WIDGETYLENGTH",0,7)
STRING WIDGETZLENGTH = $widget("RoughBlock.LimitFrame.LenZ").Value
STRING ZLENGTH = SUBSTRING("$WIDGETZLENGTH",0,7)

//DETERMINE ORIGIN LOCATION BASED ON BLOCK LIMITS IN RELATION TO THE ORIGIN OF THE FACE
	
		IF ($XMAX == $XMIN) AND ($YMAX == $YMIN) {
			STRING CORNER = 'CT'
			STRING ORIGINVALCOMPLETE = $ORIGINVAL + $CORNER + $ncfiletoolname2a
			FILE WRITE $ORIGINVALCOMPLETE TO output
			} ELSE { 
			IF ($XMAX == $XMIN) AND ($YMAX &amp;gt; $YMIN) {	
				STRING CORNER = 'B'
				STRING ORIGINVALCOMPLETE = $ORIGINVAL + $CORNER + $ncfiletoolname2a
				FILE WRITE $ORIGINVALCOMPLETE TO output
				} ELSE {
				IF ($XMAX == $XMIN) AND ($YMAX &amp;lt; $YMIN) {
					STRING CORNER = 'A'
					STRING ORIGINVALCOMPLETE = $ORIGINVAL + $CORNER + $ncfiletoolname2a
					FILE WRITE $ORIGINVALCOMPLETE TO output
					} ELSE { 
					IF ($XMAX &amp;gt; $XMIN) AND ($YMAX &amp;gt; $YMIN) {
						STRING CORNER = 'BL'
						STRING ORIGINVALCOMPLETE = $ORIGINVAL + $CORNER + $ncfiletoolname2a
						FILE WRITE $ORIGINVALCOMPLETE TO output
						} ELSE {
						IF ($XMAX &amp;gt; $XMIN) AND ($YMAX == $YMIN) {
							STRING CORNER = 'L'
							STRING ORIGINVALCOMPLETE = $ORIGINVAL + $CORNER + $ncfiletoolname2a
							FILE WRITE $ORIGINVALCOMPLETE TO output
							} ELSE {
							IF ($XMAX &amp;gt; $XMIN) AND ($YMAX &amp;lt; $YMIN) {
								STRING CORNER = 'AL'
								STRING ORIGINVALCOMPLETE = $ORIGINVAL + $CORNER + $ncfiletoolname2a
								FILE WRITE $ORIGINVALCOMPLETE TO output
								} ELSE {
								IF ($XMAX &amp;lt; $XMIN) AND ($YMAX &amp;gt; $YMIN) {
									STRING CORNER = 'BR'
									STRING ORIGINVALCOMPLETE = $ORIGINVAL + $CORNER + $ncfiletoolname2a
									FILE WRITE $ORIGINVALCOMPLETE TO output
									} ELSE {
									IF ($XMAX &amp;lt; $XMIN) AND ($YMAX == $YMIN) {
										STRING CORNER = 'R'
										STRING ORIGINVALCOMPLETE = $ORIGINVAL + $CORNER + $ncfiletoolname2a
										FILE WRITE $ORIGINVALCOMPLETE TO output
										} ELSE {
										IF ($XMAX &amp;lt; $XMIN) AND ($YMAX &amp;lt; $YMIN) {
											STRING CORNER = 'AR'
											STRING ORIGINVALCOMPLETE = $ORIGINVAL + $CORNER + $ncfiletoolname2a
											FILE WRITE $ORIGINVALCOMPLETE TO output
										}
									}
								}
							}
						}
					}
				}
			}
		}		

// FIND THE DIRECTION BASED OFF THE BLOCK IN RELATIONSHIP TO THE WORKPLANE
	
		IF ($XLENGTH == $YLENGTH) {
			STRING DIRECTION = 'N'
			STRING DIRECTIONVALCOMPLETE = $DIRECTIONVAL + $DIRECTION + $ncfiletoolname2a
			FILE WRITE $DIRECTIONVALCOMPLETE TO output
			} ELSE {
				IF ($XLENGTH &amp;lt; $YLENGTH) {
					STRING DIRECTION = 'T'
					STRING DIRECTIONVALCOMPLETE = $DIRECTIONVAL + $DIRECTION + $ncfiletoolname2a
					FILE WRITE $DIRECTIONVALCOMPLETE TO output
					} ELSE {
						IF ($XLENGTH &amp;gt; $YLENGTH) {
							STRING DIRECTION = 'Y'
							STRING DIRECTIONVALCOMPLETE = $DIRECTIONVAL + $DIRECTION + $ncfiletoolname2a
							FILE WRITE $DIRECTIONVALCOMPLETE TO output
							}
						}
					}

		BLOCK CANCEL
		BLOCK CANCELLED
		
//FETCH X,Y,Z DIMENSIONS OF THE MATERIAL AND POPULATE P3D FORM				
	
		STRING WORKSIZEFINAL = $WORKSIZE + $XEQ + $XLENGTH + $CLOSESIZE + $YEQ + $YLENGTH + $CLOSESIZE + $ZEQ + $ZLENGTH + $ncfiletoolname2a
		FILE WRITE $WORKSIZEFINAL TO output
		FILE WRITE $FACEINFO2 TO output
		FILE WRITE $MACHINEINFO TO output
		FILE WRITE $MACHINEIDCOMPLETE TO output
		FILE WRITE $MACHINE2 TO output
		FILE WRITE $MACHINEINFO2 TO output
		FILE WRITE $files1 TO output
		

// loop over the components in the nc prog
		INT $count = 0
		FOREACH tp IN components(ncp) {
//			print = tp.name
//			STRING $curname = 'CURRENT TOOLPATH IS: ' + tp.name
			INT wholediam = tp.Tool.diameter
			STRING $curtool = ' ' 
			

			// build the string that is the eventual resultant file string where the nc file will end up.
			// Adds the count number starting at 0.  Each toolpath contained under a single NC program increments this value
			// The count resets upon a new NC Program
			STRING $curoutfile = $ncfilepath1 + ncp.filename + $count + '.tap' + $ncfilepath2
			
			// Switch all forward slashes in the output file string to backslashes
			$curoutfile = replace($curoutfile, "/", "\")
			
			// replace the verbatim {ncprogram} with the NC PROGRAM name
			$curoutfile = replace($curoutfile, removethis, ncp.name)
			
			// Collect the tool name and prep the string for output
			// Need to check to see if the number is an integer or a fraction.  Fractions are output verbatim, integers have no trailing 0
			IF (tp.Tool.diameter - $wholediam &amp;gt; 0) {
				$curtool = $ncfiletoolname1 + tp.Tool.Identifier + $ncfiletoolname2 + tp.Tool.diameter + $ncfiletoolname2a
			} ELSE {
				$curtool = $ncfiletoolname1 + tp.Tool.Identifier + $ncfiletoolname2 + $wholediam + $ncfiletoolname2a
			}
			
			// write the blocks that will output this lone NC program and toolpath
			FILE WRITE $curoutfile TO output
			FILE WRITE $curtool TO output
			FILE WRITE $ncfiletoolname3 TO output
			FILE WRITE $ncfiletoolname4 TO output
			FILE WRITE $ncfiletoolname5 TO output
			FILE WRITE $ncfilepath3 TO output
			$count = $count + 1
		}
		
		FILE WRITE $files2 TO output
		FILE WRITE $ncpinfo2 TO output

	//	FILE WRITE $testing TO output and close
	print = $filename
	FILE CLOSE output
	}
	}
	
	//}
	
	//}
	
	
	
	&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 19:44:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/custom-macro-for-dnc-software/m-p/8027514#M22626</guid>
      <dc:creator>Eskondedo</dc:creator>
      <dc:date>2018-05-25T19:44:02Z</dc:date>
    </item>
  </channel>
</rss>

