<?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: Only post 4th axis when needed in HSM Post Processor Forum</title>
    <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7473699#M17325</link>
    <description>&lt;P&gt;Wouldn't it also be zero though?&lt;/P&gt;</description>
    <pubDate>Thu, 19 Oct 2017 10:38:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-10-19T10:38:42Z</dc:date>
    <item>
      <title>Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7473584#M17323</link>
      <description>&lt;P&gt;Hi all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have got my post (for a litz 3+1 VMC)working pretty well now, but there is one remaining issue.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I changed the post to only output A axis moves if that toolpath requires it, as the 4th axis is only used occasionally, and locking and unlocking the 4th axis takes a fair bit of time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is that if the 4th axis is moved by the first toolpath and the second toolpath uses the default 4th axis position - 0 deg, then this is not posted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ie: 1st toolpath&amp;nbsp;machines part at 90deg, post rotates A from current position to 90.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2nd&amp;nbsp;toolpath&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;machines part at 0deg, no A move is posted.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It seems like the safest way to address this is for the post to output a A axis move for every toolpath *IF* there are any A axis moves in the program?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can someone please help me get this working?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;i believe the following code controls what is posted:&amp;nbsp; &amp;nbsp; &amp;nbsp; Entire post attached also.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;  if (abc.isNonZero()) {
    onCommand(COMMAND_UNLOCK_MULTI_AXIS);
  
    if (useMultiAxisFeatures) {
      if (abc.isNonZero()) {
        writeBlock(gFormat.format(68.2), "X" + xyzFormat.format(0), "Y" + xyzFormat.format(0), "Z" + xyzFormat.format(0), "I" + abcFormat.format(abc.x), "J" + abcFormat.format(abc.y), "K" + abcFormat.format(abc.z)); // set frame
        writeBlock(gFormat.format(53.1)); // turn machine
      } else {
        writeBlock(gFormat.format(69)); // cancel frame
      }
    } else {
      gMotionModal.reset();
      writeBlock(
        gMotionModal.format(0),
        conditional(machineConfiguration.isMachineCoordinate(0), "A" + abcFormat.format(abc.x)),
        conditional(machineConfiguration.isMachineCoordinate(1), "B" + abcFormat.format(abc.y)),
        conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(abc.z))
      );
    }
    
    onCommand(COMMAND_LOCK_MULTI_AXIS);
  
    currentWorkPlaneABC = abc;
  }&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Thankyou&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 09:35:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7473584#M17323</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-19T09:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7473665#M17324</link>
      <description>&lt;P&gt;Also check if the currentWorkplane is nonzero.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 10:16:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7473665#M17324</guid>
      <dc:creator>Laurens-3DTechDraw</dc:creator>
      <dc:date>2017-10-19T10:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7473699#M17325</link>
      <description>&lt;P&gt;Wouldn't it also be zero though?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 10:38:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7473699#M17325</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-19T10:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7473863#M17326</link>
      <description>&lt;P&gt;I cant see any way to make this work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;currentWorkplaneABC is "abc" if that section sets the 4th axis to a non zero number and "undefined" otherwise?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;i cant see how you mean for me to use this, i need something that is global for the whole program, not per section if that makes sense?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 11:57:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7473863#M17326</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-19T11:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7474254#M17327</link>
      <description>&lt;P&gt;My point was that you could check a variable that was set in the previous section and if that is not 0 OR the current ABC is not zero you should give the A-axis value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You see this code? It checks if the current abc.x&amp;nbsp; is the same as currentWorkPlaneABC.x which was set the last time the setWorkPlane&amp;nbsp;function was executeed.&lt;/P&gt;
&lt;PRE&gt;  if (!((currentWorkPlaneABC == undefined) ||
        abcFormat.areDifferent(abc.x, currentWorkPlaneABC.x) ||
        abcFormat.areDifferent(abc.y, currentWorkPlaneABC.y) ||
        abcFormat.areDifferent(abc.z, currentWorkPlaneABC.z))) {

    return; // no change
  } &lt;/PRE&gt;
&lt;P&gt;So you can check if&amp;nbsp;abc.isNonZero()&amp;nbsp;or if currentWorkPLaneABC.isNonZero(), than you give out the workplane. Else no need.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 13:41:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7474254#M17327</guid>
      <dc:creator>Laurens-3DTechDraw</dc:creator>
      <dc:date>2017-10-19T13:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7481198#M17328</link>
      <description>&lt;P&gt;Ok, so i have it working to a point:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this is along the lines of what you suggested... Im in a fair way over my head here.&lt;BR /&gt;&lt;BR /&gt;However, this only posts A0's for toolpaths that are posted after the 4th axis is moved the first time. Its heading in the right direction, but i really need something that will post AO's for all toolpaths in any program where there is a A axis move.&lt;BR /&gt;&lt;BR /&gt;as it is a crash would occur on a second part if the last toolpath was say A180 and the first toolpath is A0, as the A0 is not present on the first toolpath.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;var forthAxisUsed = 0;

function setWorkPlane(abc) {&lt;BR /&gt; if (!forceMultiAxisIndexing &amp;amp;&amp;amp; is3D() &amp;amp;&amp;amp; !machineConfiguration.isMultiAxisConfiguration()) {&lt;BR /&gt; return; // ignore&lt;BR /&gt; }&lt;BR /&gt; if (!((currentWorkPlaneABC == undefined) ||&lt;BR /&gt; abcFormat.areDifferent(abc.x, currentWorkPlaneABC.x) ||&lt;BR /&gt; abcFormat.areDifferent(abc.y, currentWorkPlaneABC.y) ||&lt;BR /&gt; abcFormat.areDifferent(abc.z, currentWorkPlaneABC.z))) {&lt;BR /&gt; return; // no change&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; if ((abc.isNonZero()) ||&lt;BR /&gt; (forthAxisUsed &amp;gt; 0)) {&lt;BR /&gt; onCommand(COMMAND_UNLOCK_MULTI_AXIS);&lt;BR /&gt; &lt;BR /&gt; if (useMultiAxisFeatures) {&lt;BR /&gt; if (abc.isNonZero()) {&lt;BR /&gt; writeBlock(gFormat.format(68.2), "X" + xyzFormat.format(0), "Y" + xyzFormat.format(0), "Z" + xyzFormat.format(0), "I" + abcFormat.format(abc.x), "J" + abcFormat.format(abc.y), "K" + abcFormat.format(abc.z)); // set frame&lt;BR /&gt; writeBlock(gFormat.format(53.1)); // turn machine&lt;BR /&gt; } else {&lt;BR /&gt; writeBlock(gFormat.format(69)); // cancel frame&lt;BR /&gt; }&lt;BR /&gt; } else {&lt;BR /&gt; gMotionModal.reset();&lt;BR /&gt; writeBlock(&lt;BR /&gt; gMotionModal.format(0),&lt;BR /&gt; conditional(machineConfiguration.isMachineCoordinate(0), "A" + abcFormat.format(abc.x)),&lt;BR /&gt; conditional(machineConfiguration.isMachineCoordinate(1), "B" + abcFormat.format(abc.y)),&lt;BR /&gt; conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(abc.z))&lt;BR /&gt; );&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; onCommand(COMMAND_LOCK_MULTI_AXIS);&lt;BR /&gt; &lt;BR /&gt; forthAxisUsed++;&lt;BR /&gt; &lt;BR /&gt; currentWorkPlaneABC = abc;&lt;BR /&gt; }&lt;BR /&gt;}&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Oct 2017 07:21:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7481198#M17328</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-22T07:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7481348#M17329</link>
      <description>&lt;P&gt;In that case you will need a totally different approach than you took.&lt;/P&gt;
&lt;P&gt;You will need to do something like is being done for the tool list.&lt;/P&gt;
&lt;P&gt;Check through all the sections to see if one of those has an abc.isNonZero() =&amp;nbsp; true.&lt;/P&gt;
&lt;P&gt;So something like this:&lt;/P&gt;
&lt;PRE&gt;if(isFirstSection()){
 var numberOfSections = getNumberOfSections();
      for (var i = 0; i &amp;lt; numberOfSections; ++i) {
      var section = getSection(i);
      var 4Axis = section.abc.isNonZero();
     if(4Axis == true){
break;
}
}
}&lt;/PRE&gt;
&lt;P&gt;This is not tested, just a general direction.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2017 10:46:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7481348#M17329</guid>
      <dc:creator>Laurens-3DTechDraw</dc:creator>
      <dc:date>2017-10-22T10:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7482939#M17330</link>
      <description>&lt;P&gt;Thanks for your help so far mate, but im really not making any progress here&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;  if(true){
 var numberOfSections = getNumberOfSections();
      for (var i = 0; i &amp;lt; numberOfSections; ++i) 
      var section = getSection(i);
      var fourthAxisUsed = (section.abc.x);
     if(fourthAxisUsed &amp;gt; 0){&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the best i have managed, and i always get the error "TypeError: section.abc is undefined"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no idea how to define it or if that is even possible.&amp;nbsp; I dont even understand what the output of (section.abc.x) actrually is...&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;It almost seems like things like section.**** or whatever are things that must be refered to freom the output of the CAM, but i dont understand where they come from, or where to find a list of them... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;    var tools = getToolTable();
    if (tools.getNumberOfTools() &amp;gt; 0) {
      for (var i = 0; i &amp;lt; tools.getNumberOfTools(); ++i) {&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;getNumberOfTools...... so we are getting the number of tools, easy enough... but where did "NumberOfTools" come from? its not anywhere else in the post, and its not in the dump log either, so where does it come from, and how are we supposed to know to use it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 09:24:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7482939#M17330</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-23T09:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7483290#M17331</link>
      <description>&lt;P&gt;&lt;SPAN&gt;abc = getWorkPlaneMachineABC(section.workPlane);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Probably need this line too.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 11:57:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7483290#M17331</guid>
      <dc:creator>Laurens-3DTechDraw</dc:creator>
      <dc:date>2017-10-23T11:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7483399#M17332</link>
      <description>&lt;P&gt;I'll try to make time to check this myself.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 12:29:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7483399#M17332</guid>
      <dc:creator>Laurens-3DTechDraw</dc:creator>
      <dc:date>2017-10-23T12:29:33Z</dc:date>
    </item>
    <item>
      <title>Ynt: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7489289#M17333</link>
      <description>&lt;P&gt;Yes, General Post Processor to fix a mistake&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 08:26:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7489289#M17333</guid>
      <dc:creator>uygar</dc:creator>
      <dc:date>2017-10-25T08:26:42Z</dc:date>
    </item>
    <item>
      <title>Ynt: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7489397#M17334</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;Yes, General Post Processor to fix a mistake&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4916862"&gt;@uygar&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;What do you mean here?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 09:03:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7489397#M17334</guid>
      <dc:creator>Laurens-3DTechDraw</dc:creator>
      <dc:date>2017-10-25T09:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7489407#M17335</link>
      <description>I'm doing an online JavaScript course, and downloaded the help file you linked.... Working on it.... Still over my head though.</description>
      <pubDate>Wed, 25 Oct 2017 09:09:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7489407#M17335</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-25T09:09:49Z</dc:date>
    </item>
    <item>
      <title>Ynt: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7489456#M17336</link>
      <description>&lt;P&gt;(2B-PROFIL1)&lt;/P&gt;&lt;P&gt;1.A0&lt;/P&gt;&lt;P&gt;2.A-51.429&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;7A51.429&lt;/P&gt;&lt;P&gt;(2B-PROFIL3)&lt;/P&gt;&lt;P&gt;1. A0 no rotate to continue from the last&amp;nbsp;(2B-PROFIL1) 7.A51.429&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;add nc. code&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 09:29:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7489456#M17336</guid>
      <dc:creator>uygar</dc:creator>
      <dc:date>2017-10-25T09:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7492872#M17337</link>
      <description>&lt;P&gt;Ok, it seems like i am getting really close, but i&amp;nbsp;am getting either always a A move posted, or never an A move posted...&lt;/P&gt;&lt;P&gt;Seems like it might be a simple fix from here, but i just cant figure it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;function setWorkPlane(abc) {
  if (!forceMultiAxisIndexing &amp;amp;&amp;amp; is3D() &amp;amp;&amp;amp; !machineConfiguration.isMultiAxisConfiguration()) {
    return; // ignore
  }
  if (!((currentWorkPlaneABC == undefined) ||
        abcFormat.areDifferent(abc.x, currentWorkPlaneABC.x) ||
        abcFormat.areDifferent(abc.y, currentWorkPlaneABC.y) ||
        abcFormat.areDifferent(abc.z, currentWorkPlaneABC.z))) {
    return; // no change
  }
  var numberOfSections = getNumberOfSections();

  for (var i = 0; i &amp;lt; numberOfSections; ++i) {
  var sectionB = getSection(i);
  abcUsed = getWorkPlaneMachineABC(sectionB.workPlane);
  var fourthAxisUsed = abcUsed.isNonZero();
	  
	  
  if(fourthAxisUsed!=true){   
    onCommand(COMMAND_UNLOCK_MULTI_AXIS);
  
    if (useMultiAxisFeatures) {
      if (abc.isNonZero()) {
        writeBlock(gFormat.format(68.2), "X" + xyzFormat.format(0), "Y" + xyzFormat.format(0), "Z" + xyzFormat.format(0), "I" + abcFormat.format(abc.x), "J" + abcFormat.format(abc.y), "K" + abcFormat.format(abc.z)); // set frame
        writeBlock(gFormat.format(53.1)); // turn machine
      } else {
        writeBlock(gFormat.format(69)); // cancel frame
      }
    } else {
      gMotionModal.reset();
      writeBlock(
        gMotionModal.format(0),
        conditional(machineConfiguration.isMachineCoordinate(0), "A" + abcFormat.format(abc.x)),
        conditional(machineConfiguration.isMachineCoordinate(1), "B" + abcFormat.format(abc.y)),
        conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(abc.z))
      );
    }
    
    onCommand(COMMAND_LOCK_MULTI_AXIS);
	currentWorkPlaneABC = abc;
	break;
    }
  }
}&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Oct 2017 09:42:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7492872#M17337</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-26T09:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7492989#M17338</link>
      <description>&lt;P&gt;Seems like you only should do the check once.&lt;/P&gt;
&lt;P&gt;In the beginning:&lt;/P&gt;
&lt;PRE&gt;function setWorkPlane(abc) {
  if (!forceMultiAxisIndexing &amp;amp;&amp;amp; is3D() &amp;amp;&amp;amp; !machineConfiguration.isMultiAxisConfiguration()) {
    return; // ignore
  }
  if (!((currentWorkPlaneABC == undefined) ||
        abcFormat.areDifferent(abc.x, currentWorkPlaneABC.x) ||
        abcFormat.areDifferent(abc.y, currentWorkPlaneABC.y) ||
        abcFormat.areDifferent(abc.z, currentWorkPlaneABC.z))) {
    return; // no change
  }
  var numberOfSections = getNumberOfSections();

if(isFirstSection()){
  for (var i = 0; i &amp;lt; numberOfSections; ++i) {
  var sectionB = getSection(i);
  abcUsed = getWorkPlaneMachineABC(sectionB.workPlane);
  var fourthAxisUsed = abcUsed.isNonZero();
}	  
	  
  if(fourthAxisUsed!=true){   
    onCommand(COMMAND_UNLOCK_MULTI_AXIS);
  
    if (useMultiAxisFeatures) {
      if (abc.isNonZero()) {
        writeBlock(gFormat.format(68.2), "X" + xyzFormat.format(0), "Y" + xyzFormat.format(0), "Z" + xyzFormat.format(0), "I" + abcFormat.format(abc.x), "J" + abcFormat.format(abc.y), "K" + abcFormat.format(abc.z)); // set frame
        writeBlock(gFormat.format(53.1)); // turn machine
      } else {
        writeBlock(gFormat.format(69)); // cancel frame
      }
    } else {
      gMotionModal.reset();
      writeBlock(
        gMotionModal.format(0),
        conditional(machineConfiguration.isMachineCoordinate(0), "A" + abcFormat.format(abc.x)),
        conditional(machineConfiguration.isMachineCoordinate(1), "B" + abcFormat.format(abc.y)),
        conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(abc.z))
      );
    }
    
    onCommand(COMMAND_LOCK_MULTI_AXIS);
	currentWorkPlaneABC = abc;
	break;
    }
  }
}&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Oct 2017 10:29:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7492989#M17338</guid>
      <dc:creator>Laurens-3DTechDraw</dc:creator>
      <dc:date>2017-10-26T10:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7493125#M17339</link>
      <description>&lt;P&gt;Now it only posts A moves for the first toolpath, and still posts A0 if there are no A moves in the program... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 11:28:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7493125#M17339</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-26T11:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7493169#M17340</link>
      <description>&lt;P&gt;So didn't look to well.&lt;/P&gt;
&lt;P&gt;The problem is you didn't break out the moment it finds a 4-axis move.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So something like this?&lt;/P&gt;
&lt;PRE&gt;function setWorkPlane(abc) {
  if (!forceMultiAxisIndexing &amp;amp;&amp;amp; is3D() &amp;amp;&amp;amp; !machineConfiguration.isMultiAxisConfiguration()) {
    return; // ignore
  }
  if (!((currentWorkPlaneABC == undefined) ||
        abcFormat.areDifferent(abc.x, currentWorkPlaneABC.x) ||
        abcFormat.areDifferent(abc.y, currentWorkPlaneABC.y) ||
        abcFormat.areDifferent(abc.z, currentWorkPlaneABC.z))) {
    return; // no change
  }
  var numberOfSections = getNumberOfSections();

if(isFirstSection()){
  for (var i = 0; i &amp;lt; numberOfSections; ++i) {
  var sectionB = getSection(i);
  abcUsed = getWorkPlaneMachineABC(sectionB.workPlane);
  var fourthAxisUsed = abcUsed.isNonZero();
 if(fourthAxisUsed){
break;
}
}	  
	  
  if(fourthAxisUsed){   
    onCommand(COMMAND_UNLOCK_MULTI_AXIS);
  
    if (useMultiAxisFeatures) {
      if (abc.isNonZero()) {
        writeBlock(gFormat.format(68.2), "X" + xyzFormat.format(0), "Y" + xyzFormat.format(0), "Z" + xyzFormat.format(0), "I" + abcFormat.format(abc.x), "J" + abcFormat.format(abc.y), "K" + abcFormat.format(abc.z)); // set frame
        writeBlock(gFormat.format(53.1)); // turn machine
      } else {
        writeBlock(gFormat.format(69)); // cancel frame
      }
    } else {
      gMotionModal.reset();
      writeBlock(
        gMotionModal.format(0),
        conditional(machineConfiguration.isMachineCoordinate(0), "A" + abcFormat.format(abc.x)),
        conditional(machineConfiguration.isMachineCoordinate(1), "B" + abcFormat.format(abc.y)),
        conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(abc.z))
      );
    }
    
    onCommand(COMMAND_LOCK_MULTI_AXIS);
	currentWorkPlaneABC = abc;
	break;
    }
  }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 11:44:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7493169#M17340</guid>
      <dc:creator>Laurens-3DTechDraw</dc:creator>
      <dc:date>2017-10-26T11:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7498854#M17341</link>
      <description>&lt;P&gt;finally got it!!!&lt;BR /&gt;&lt;BR /&gt;you were pretty much there with the post i accepted with a solution still not sure what exactly is going on, but it works!&lt;/P&gt;&lt;P&gt;using abc as the variable name was causing issues i think, i have just changed it to j, since i have no idea what it actually does.&lt;BR /&gt;&lt;BR /&gt;Here is the final code for anyone interested:&lt;/P&gt;&lt;PRE&gt;function setWorkPlane(abc) {
  if (!forceMultiAxisIndexing &amp;amp;&amp;amp; is3D() &amp;amp;&amp;amp; !machineConfiguration.isMultiAxisConfiguration()) {
    return; // ignore
  }
  if (!((currentWorkPlaneABC == undefined) ||
        abcFormat.areDifferent(abc.x, currentWorkPlaneABC.x) ||
        abcFormat.areDifferent(abc.y, currentWorkPlaneABC.y) ||
        abcFormat.areDifferent(abc.z, currentWorkPlaneABC.z))) {
    return; // no change
  }

  
  if(isFirstSection()){
    var numberOfSections = getNumberOfSections();
    for (var i = 0; i &amp;lt; numberOfSections; ++i) {
      var section = getSection(i);
	  j = getWorkPlaneMachineABC(section.workPlane);
      var fourthUsed = j.isNonZero();
      if(fourthUsed == true){
		fourthAxisUsedGlobal++;  
        break;
      }
    }
  }
  
  if(fourthAxisUsedGlobal&amp;gt;0){   
    onCommand(COMMAND_UNLOCK_MULTI_AXIS);
  
    if (useMultiAxisFeatures) {
      if (abc.isNonZero()) {
        writeBlock(gFormat.format(68.2), "X" + xyzFormat.format(0), "Y" + xyzFormat.format(0), "Z" + xyzFormat.format(0), "I" + abcFormat.format(abc.x), "J" + abcFormat.format(abc.y), "K" + abcFormat.format(abc.z)); // set frame
        writeBlock(gFormat.format(53.1)); // turn machine
      } else {
        writeBlock(gFormat.format(69)); // cancel frame
      }
    } else {
      gMotionModal.reset();
      writeBlock(
        gMotionModal.format(0),
        conditional(machineConfiguration.isMachineCoordinate(0), "A" + abcFormat.format(abc.x)),
        conditional(machineConfiguration.isMachineCoordinate(1), "B" + abcFormat.format(abc.y)),
        conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(abc.z))
      );
    }
    
    onCommand(COMMAND_LOCK_MULTI_AXIS);
	currentWorkPlaneABC = abc;
    }
}&lt;/PRE&gt;&lt;P&gt;Thanks very much for your help Laurens, i couldn't have done it without you.&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Oct 2017 12:31:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/7498854#M17341</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-28T12:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Only post 4th axis when needed</title>
      <link>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/13011276#M17342</link>
      <description>&lt;P&gt;Good morning, I'm referring to this post, but the same thing can be done with the generic Fanuc post, I tried but after the changes the post stops working.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 10:07:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/hsm-post-processor-forum/only-post-4th-axis-when-needed/m-p/13011276#M17342</guid>
      <dc:creator>guido_antoniol</dc:creator>
      <dc:date>2024-09-10T10:07:03Z</dc:date>
    </item>
  </channel>
</rss>

