<?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: Variable feedrate script in PowerMill Forum</title>
    <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12434480#M2725</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fanuc1.PNG" style="width: 944px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1303538i4A461AA728AEDADB/image-size/large?v=v2&amp;amp;px=999" role="button" title="fanuc1.PNG" alt="fanuc1.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Fanuc2.PNG" style="width: 301px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1303539i46EB6CEB2F3A4DDF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Fanuc2.PNG" alt="Fanuc2.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Fanuc3.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1303540iD6B30C6D0FEF8BA2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Fanuc3.PNG" alt="Fanuc3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the "Move Linear" command (as shown in the last picture), I've introduced a script block in the first line. Its sole purpose is to modify the feed rate parameter by the script.&lt;/P&gt;&lt;P&gt;Additionally, in the second line, I've added another line with all its blocks deactivated for output writing. The only intention for these blocks is to display those parameters in the debug viewer located at the bottom.&lt;/P&gt;&lt;P&gt;The last line remains unaltered.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Dec 2023 20:22:09 GMT</pubDate>
    <dc:creator>ondrej.mikulec</dc:creator>
    <dc:date>2023-12-11T20:22:09Z</dc:date>
    <item>
      <title>Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12428981#M2714</link>
      <description>&lt;P&gt;Assume a large hole profile reducing diameter as ź level goes down.&amp;nbsp; At the top movements in xy is large enough to use high feedrate while at the bottom we have to reduce feedrate manually to keep machine run smoothly.&amp;nbsp; Probably someone can help for a post script.&amp;nbsp; At the posting time pm-post will ask for max feed at the top and min feed at the bottom and how many steps for changing feed.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 17:44:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12428981#M2714</guid>
      <dc:creator>hrh46</dc:creator>
      <dc:date>2023-12-08T17:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12429335#M2715</link>
      <description>&lt;P&gt;Are you aware that this can be done in Powermill before postprocessing?&lt;BR /&gt;&lt;STRONG&gt;Selected Toolpath -&amp;gt; Edit -&amp;gt; Update Feed Rate Inside Boudary&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 20:41:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12429335#M2715</guid>
      <dc:creator>ondrej.mikulec</dc:creator>
      <dc:date>2023-12-08T20:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12429855#M2716</link>
      <description>&lt;P&gt;Update feedrate inside Boundary and selected surface does not work in this cases. Best way is gradually decrease feed by z level.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 03:55:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12429855#M2716</guid>
      <dc:creator>hrh46</dc:creator>
      <dc:date>2023-12-09T03:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12430105#M2717</link>
      <description>&lt;P&gt;I tried something out of curiosity to see how it could be done. For proper post modification, I recommend contacting your post-processors provider. There are several settings that must be configured correctly to ensure smooth operation.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;In my script, the maximum feed corresponds to the toolpath cutting feed rate, while the minimum feed represents the plunge feed rate. Therefore, no data filling is required during post-processing.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;function VariableFeed()
{
	var cuttingFeed = GetParam("%p(Cutting Rate)%");
	var plungeFeed = GetParam("%p(Plunge Rate)%");
	var zMax = GetParam("%p(Toolpath Z Max)%");
	var zMin = GetParam("%p(Toolpath Z Min)%");
	var currentZ = GetParam("%p(Z)%");
	var vFeed = plungeFeed + (((currentZ - zMin)*(cuttingFeed - plungeFeed))/(zMax - zMin));
	SetParam("%p(Feed Rate)%",vFeed)
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 10:08:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12430105#M2717</guid>
      <dc:creator>ondrej.mikulec</dc:creator>
      <dc:date>2023-12-09T10:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12430419#M2718</link>
      <description>&lt;P&gt;Thanks for your reply and time.I am away now and will test your script asap. But seems there will be too many Feed in G-code, almost in each line if you have a spiral constant z. If&amp;nbsp; you consider min feed= (max feed)/10&amp;nbsp; and&amp;nbsp;&lt;/P&gt;&lt;P&gt;Z step= (Zmax-Zmin)/10, so we have 10 zone and each zone have a Feed. Hope you understand me. Thanks again.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 16:49:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12430419#M2718</guid>
      <dc:creator>hrh46</dc:creator>
      <dc:date>2023-12-09T16:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12430668#M2719</link>
      <description>&lt;P&gt;In that case I would just make the changes for example by 10.&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;function VariableFeed()
{
	var cuttingFeed = GetParam("%p(Cutting Rate)%");
	var plungeFeed = GetParam("%p(Plunge Rate)%");
	var zMax = GetParam("%p(Toolpath Z Max)%");
	var zMin = GetParam("%p(Toolpath Z Min)%");
	var currentZ = GetParam("%p(Z)%");
	var vFeed = plungeFeed + (((currentZ - zMin)*(cuttingFeed - plungeFeed))/(zMax - zMin));

	vFeed = Math.ceil(vFeed/10.0)*10;

	SetParam("%p(Feed Rate)%",vFeed)
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;But still depends on the specific requirements. If the necessity of dividing it into 10 segments is crucial, then maybe something like the code below. But I would prefer the solution above.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;function VariableFeed()
{
	var zMax = GetParam("%p(Toolpath Z Max)%");
	var zMin = GetParam("%p(Toolpath Z Min)%");
	var currentZ = GetParam("%p(Z)%");
	var vFeed;

	var tenthSgm = (zMax - zMin)/10.0;

	if 		  (currentZ &amp;gt; (9*tenthSgm)) {
		vFeed = GetVFeed(10*tenthSgm, zMax, zMin);

	} else if (currentZ &amp;gt; (8*tenthSgm)) {
		vFeed = GetVFeed(9*tenthSgm, zMax, zMin);

	} else if (currentZ &amp;gt; (7*tenthSgm)) {
		vFeed = GetVFeed(8*tenthSgm, zMax, zMin);

	} else if (currentZ &amp;gt; (6*tenthSgm)) {
		vFeed = GetVFeed(7*tenthSgm, zMax, zMin);

	} else if (currentZ &amp;gt; (5*tenthSgm)) {
		vFeed = GetVFeed(6*tenthSgm, zMax, zMin);

	} else if (currentZ &amp;gt; (4*tenthSgm)) {
		vFeed = GetVFeed(5*tenthSgm, zMax, zMin);

	} else if (currentZ &amp;gt; (3*tenthSgm)) {
		vFeed = GetVFeed(4*tenthSgm, zMax, zMin);

	} else if (currentZ &amp;gt; (2*tenthSgm)) {
		vFeed = GetVFeed(3*tenthSgm, zMax, zMin);

	} else if (currentZ &amp;gt; (1*tenthSgm)) {
		vFeed = GetVFeed(2*tenthSgm, zMax, zMin);

	} else {
		vFeed = GetVFeed(1*tenthSgm, zMax, zMin);

	}

	SetParam("%p(Feed Rate)%",vFeed)
}

function GetVFeed(pseudoZ,zMax,zMin)
{
	var cuttingFeed = GetParam("%p(Cutting Rate)%");
	var plungeFeed = GetParam("%p(Plunge Rate)%");
	
	var vFeed = plungeFeed + (((pseudoZ - zMin)*(cuttingFeed - plungeFeed))/(zMax - zMin));

	return vFeed;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 21:01:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12430668#M2719</guid>
      <dc:creator>ondrej.mikulec</dc:creator>
      <dc:date>2023-12-09T21:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12431600#M2720</link>
      <description>&lt;P&gt;I have created and tested the first code&amp;nbsp; you sent, but didn't work.&amp;nbsp; I don't know the reason. Maybe vFeed is not updated. I will test the next one.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2023 16:05:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12431600#M2720</guid>
      <dc:creator>hrh46</dc:creator>
      <dc:date>2023-12-10T16:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12431781#M2721</link>
      <description>&lt;P&gt;It is only a script code that needs to be explicitly call to do the Feed Rate parameter change. To implement it into the post-processing workflow you need to:&lt;BR /&gt;Create a new User Command that is associated with that script. The only purpose of that command is to change the Feed rate.&lt;BR /&gt;Now you can add that command anywhere in the commands tree. In our case we need to open the Move Linear command.&lt;/P&gt;&lt;P&gt;In the Move Linear command you need to find the correct spot where to insert you User Command that will update the Feed Rate parameter before the whole x y z ... line.&lt;BR /&gt;You need to find the Feed rate parameter in the parameters menu. In the settings Allow Change - Yes.&lt;BR /&gt;Another issue could be that some post-processors doesn't write out the Feed Rate parameter at all. Only using that to for sassing into a NC controller parameter.&amp;nbsp; In that case you need to in the Move Linear command change the x y z ... line by ignore the parametric feed block and add the standard Feed Rate block. Also in that case it is possible that you need to also adjust the Feed rate properties in the properties menu to correctly adjust the write out format.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2023 19:25:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12431781#M2721</guid>
      <dc:creator>ondrej.mikulec</dc:creator>
      <dc:date>2023-12-10T19:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12433567#M2722</link>
      <description>&lt;P&gt;def post_script():&lt;BR /&gt;"""&lt;BR /&gt;This function generates a post script for a CNC program that adjusts the feed rate based on the hole depth.&lt;/P&gt;&lt;P&gt;Args:&lt;BR /&gt;None&lt;/P&gt;&lt;P&gt;Returns:&lt;BR /&gt;str: The post script code.&lt;BR /&gt;"""&lt;/P&gt;&lt;P&gt;# Get user input for parameters&lt;BR /&gt;max_feed = float(input("Enter maximum feed rate at the top: "))&lt;BR /&gt;min_feed = float(input("Enter minimum feed rate at the bottom: "))&lt;BR /&gt;steps = int(input("Enter number of steps for changing feed rate: "))&lt;/P&gt;&lt;P&gt;# Calculate feed rate change per step&lt;BR /&gt;feed_change = (max_feed - min_feed) / steps&lt;/P&gt;&lt;P&gt;# Generate the post script code&lt;BR /&gt;post_script_code = f"""&lt;BR /&gt;(POST SCRIPT)&lt;BR /&gt;; Adjust feed rate based on hole depth&lt;BR /&gt;G04 P1000&lt;BR /&gt;G43 H1 Z0&lt;BR /&gt;G01 F{max_feed:.2f} Z-10&lt;BR /&gt;"""&lt;/P&gt;&lt;P&gt;for i in range(1, steps):&lt;BR /&gt;depth = -10 * i&lt;BR /&gt;feed_rate = max_feed - i * feed_change&lt;BR /&gt;post_script_code += f"""&lt;BR /&gt;G01 F{feed_rate:.2f} Z{depth:.2f}&lt;BR /&gt;"""&lt;/P&gt;&lt;P&gt;post_script_code += f"""&lt;BR /&gt;G01 F{min_feed:.2f} Z-20&lt;BR /&gt;G49&lt;BR /&gt;G04 P1000&lt;BR /&gt;(END POST SCRIPT)&lt;BR /&gt;"""&lt;/P&gt;&lt;P&gt;return post_script_code&lt;/P&gt;&lt;P&gt;# Print the post script code&lt;BR /&gt;print(post_script())&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This script is shorter than the previous one and achieves the same functionality. It uses f-strings for cleaner formatting and eliminates unnecessary comments.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 16:20:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12433567#M2722</guid>
      <dc:creator>seosebt11</dc:creator>
      <dc:date>2023-12-11T16:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12433679#M2723</link>
      <description>&lt;P&gt;Thanks for your reply.&amp;nbsp; You explained the issue very well. But I'm not as good as you in post modification.&amp;nbsp; It's very kind of you if you can modify a generic fanuc for me. I know you may be busy and my request is not correct. Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 17:00:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12433679#M2723</guid>
      <dc:creator>hrh46</dc:creator>
      <dc:date>2023-12-11T17:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12434190#M2724</link>
      <description>&lt;P&gt;Did you write the script by VB ?&lt;/P&gt;&lt;P&gt;I am not familiar with VB or Java. many thanks for your help, but if possible inert it in a generic fanuc post. I'm not expert as you in post manipulation.&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 17:40:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12434190#M2724</guid>
      <dc:creator>hrh46</dc:creator>
      <dc:date>2023-12-11T17:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12434480#M2725</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fanuc1.PNG" style="width: 944px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1303538i4A461AA728AEDADB/image-size/large?v=v2&amp;amp;px=999" role="button" title="fanuc1.PNG" alt="fanuc1.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Fanuc2.PNG" style="width: 301px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1303539i46EB6CEB2F3A4DDF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Fanuc2.PNG" alt="Fanuc2.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Fanuc3.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1303540iD6B30C6D0FEF8BA2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Fanuc3.PNG" alt="Fanuc3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the "Move Linear" command (as shown in the last picture), I've introduced a script block in the first line. Its sole purpose is to modify the feed rate parameter by the script.&lt;/P&gt;&lt;P&gt;Additionally, in the second line, I've added another line with all its blocks deactivated for output writing. The only intention for these blocks is to display those parameters in the debug viewer located at the bottom.&lt;/P&gt;&lt;P&gt;The last line remains unaltered.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 20:22:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12434480#M2725</guid>
      <dc:creator>ondrej.mikulec</dc:creator>
      <dc:date>2023-12-11T20:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Variable feedrate script</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12436504#M2726</link>
      <description>&lt;P&gt;Excellent,&amp;nbsp; many thanks.&lt;span class="lia-unicode-emoji" title=":ok_hand:"&gt;👌&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 16:01:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/variable-feedrate-script/m-p/12436504#M2726</guid>
      <dc:creator>hrh46</dc:creator>
      <dc:date>2023-12-12T16:01:40Z</dc:date>
    </item>
  </channel>
</rss>

