<?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 Betreff: Macro to change tool numbers in NC Program in PowerMill Forum</title>
    <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587795#M2170</link>
    <description>&lt;P&gt;you coud make a .txt file for mapping&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;500|200&lt;/P&gt;&lt;P&gt;400|1&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so number 500 is changed to 200, 400 is changed to 1 and so on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sry i misunderstood you i rewrite the macro&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>Wed, 28 Feb 2024 13:02:11 GMT</pubDate>
    <dc:creator>icse</dc:creator>
    <dc:date>2024-02-28T13:02:11Z</dc:date>
    <item>
      <title>Macro to change tool numbers in NC Program</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12586241#M2165</link>
      <description>&lt;P&gt;Hey all, so I was wondering if there is a way to write a macro to change tool numbers in an NC Program. The reason I ask is because; all of our 3-axis machines allow up to like 500 tools in the offset page whereas our 5-axis machines only allow up to like 200 (Haas). So, when programming and a job starts in 3-axis and ends in 5-axis, when I go to post out a 5-axis program I have to go into the NC program and manually change all the tool numbers, so we don't get an alarm on the machine. I would rather not have multiple tool libraries or multiple entries in the tool library to accommodate for this. Is there a way to write a macro that would change these tool numbers in the NC Program for me when I'm ready to post? I'm aware i would have to build the list in its entirety into the macro but that's fine. I'm just very unsure of how to phrase all the if-then statements (If that's what I would even use)&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 18:42:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12586241#M2165</guid>
      <dc:creator>E-Singer89</dc:creator>
      <dc:date>2024-02-27T18:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to change tool numbers in NC Program</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587017#M2166</link>
      <description>&lt;P&gt;Could you share some picture in detail?&lt;/P&gt;&lt;P&gt;Maybe somebody can help you.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 03:25:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587017#M2166</guid>
      <dc:creator>nguyenthinhvt95</dc:creator>
      <dc:date>2024-02-28T03:25:52Z</dc:date>
    </item>
    <item>
      <title>Betreff: Macro to change tool numbers in NC Program</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587258#M2167</link>
      <description>&lt;P&gt;This macro takes every tool in the project with a number larger than 200 and replaces its number with the first free lowest tool number:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;int $newToolNumb = 0

foreach $t in filter(folder('tool'),'this.Number.Value &amp;gt; 200') {
	$newToolNumb = $newToolNumb + 1
	int list $toolnumbers = extract(folder('tool'), 'Tool.Number.Value')
	
	while member($toolnumbers, $newToolNumb) {
		$newToolNumb = $newToolNumb + 1
	}
	
	EDIT TOOL ${t.Name} NUMBER COMMANDFROMUI ${newToolNumb}
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 28 Feb 2024 07:03:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587258#M2167</guid>
      <dc:creator>icse</dc:creator>
      <dc:date>2024-02-28T07:03:11Z</dc:date>
    </item>
    <item>
      <title>Betreff: Macro to change tool numbers in NC Program</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587746#M2168</link>
      <description>&lt;P&gt;Interesting, thank you. But not quite what I need. We have a set tool list of what tool is assigned to what offset number&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 12:22:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587746#M2168</guid>
      <dc:creator>E-Singer89</dc:creator>
      <dc:date>2024-02-28T12:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to change tool numbers in NC Program</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587792#M2169</link>
      <description>&lt;P&gt;sorry about that.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is an example of a 3-axis program&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3-axis nc prog settings.JPG" style="width: 577px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1331269i1C780F977B2912B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="3-axis nc prog settings.JPG" alt="3-axis nc prog settings.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;5-axis program before settings change&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="5-axis nc prog b4.JPG" style="width: 577px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1331270iFB01216407734669/image-size/large?v=v2&amp;amp;px=999" role="button" title="5-axis nc prog b4.JPG" alt="5-axis nc prog b4.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is where i change my tool numbers in the nc program&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="5-axis nc prog change this.JPG" style="width: 569px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1331271i3A8C515AFCFC10CF/image-size/large?v=v2&amp;amp;px=999" role="button" title="5-axis nc prog change this.JPG" alt="5-axis nc prog change this.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this is what it looks like after the change, the asterisk notes that a change was made.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="5-axis nc prog after.JPG" style="width: 572px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1331272i0198C53430416AE0/image-size/large?v=v2&amp;amp;px=999" role="button" title="5-axis nc prog after.JPG" alt="5-axis nc prog after.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 12:40:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587792#M2169</guid>
      <dc:creator>E-Singer89</dc:creator>
      <dc:date>2024-02-28T12:40:36Z</dc:date>
    </item>
    <item>
      <title>Betreff: Macro to change tool numbers in NC Program</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587795#M2170</link>
      <description>&lt;P&gt;you coud make a .txt file for mapping&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;500|200&lt;/P&gt;&lt;P&gt;400|1&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so number 500 is changed to 200, 400 is changed to 1 and so on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sry i misunderstood you i rewrite the macro&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>Wed, 28 Feb 2024 13:02:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587795#M2170</guid>
      <dc:creator>icse</dc:creator>
      <dc:date>2024-02-28T13:02:11Z</dc:date>
    </item>
    <item>
      <title>Betreff: Macro to change tool numbers in NC Program</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587797#M2171</link>
      <description>&lt;P&gt;this is what i had in mind for sure. Is this going to change the tool numbers in the project though or just in the nc program? see my pictures above&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 12:44:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587797#M2171</guid>
      <dc:creator>E-Singer89</dc:creator>
      <dc:date>2024-02-28T12:44:09Z</dc:date>
    </item>
    <item>
      <title>Betreff: Macro to change tool numbers in NC Program</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587895#M2172</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;string $mappingPath = "C:\YourPath\mapping.txt"

if not file_exists($mappingPath) {
	message info "Can't find mapping file"
	return
}



string list $mapping = {}

FILE OPEN $mappingPath FOR READ AS Input
FILE READ $mapping FROM Input
FILE CLOSE Input

entity list $ncPrograms = input entity multiple ncprogram "Select NcPrograms to change tool numbers"

foreach $ncprogram in $ncPrograms {

	foreach $line in $mapping {
		int $target = tokens($line,'|')[0]
		int $dest = tokens($line,'|')[1]
		
		foreach $tp in filter(components($ncprogram),'this.ToolNumber.FromTool == "' + $target + '"') {
			$tp.ToolNumber.UserDefined = 1
			$tp.ToolNumber.Typed = $dest
			$tp.ToolNumber.Value = $dest
		}
	}	
}&lt;/LI-CODE&gt;&lt;P&gt;but please make a backup of your project first i did not tested it jet...&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 13:24:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587895#M2172</guid>
      <dc:creator>icse</dc:creator>
      <dc:date>2024-02-28T13:24:15Z</dc:date>
    </item>
    <item>
      <title>Betreff: Macro to change tool numbers in NC Program</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587914#M2173</link>
      <description>&lt;P&gt;I will test this on a dummy file. Thank you! ill let you know how it goes&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 13:29:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587914#M2173</guid>
      <dc:creator>E-Singer89</dc:creator>
      <dc:date>2024-02-28T13:29:49Z</dc:date>
    </item>
    <item>
      <title>Betreff: Macro to change tool numbers in NC Program</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587930#M2174</link>
      <description>it works!!!! thank you!!!!</description>
      <pubDate>Wed, 28 Feb 2024 13:37:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macro-to-change-tool-numbers-in-nc-program/m-p/12587930#M2174</guid>
      <dc:creator>E-Singer89</dc:creator>
      <dc:date>2024-02-28T13:37:48Z</dc:date>
    </item>
  </channel>
</rss>

