Scan thru file and get all the Work offsets and Angles

Scan thru file and get all the Work offsets and Angles

DarthBane55
Advisor Advisor
293 Views
3 Replies
Message 1 of 4

Scan thru file and get all the Work offsets and Angles

DarthBane55
Advisor
Advisor

Hi, is it possible to scan thru the program before getting to "onsection"...  or somehow, be able to output all the angles and work offsets used in the program at the beginning of the g-code?

I need this not for simply showing the angles used, but I have some other goal with this, but I need this data.  Right now I am stuck, because I think the angles and work offsets used throughout a program are discovered as the post progresses thru "onsection", therefore, it seems that it is not possible to discover these to be output at the beginning of the g-code.

I hope I explain this clearly...

Ideally, I would want to have each work offset with its corresponding angle on 1 line, but I think I can manage to format this how I need it.  If at least someone can guide me for scanning thru the program ahead of time to discover all the angles and work offsets, it would be awesome!

Thanks!

Accepted solutions (1)
294 Views
3 Replies
Replies (3)
Message 2 of 4

AchimN
Community Manager
Community Manager
Accepted solution

Without knowing which post processor you are using, something similar to this should work for you:

  for (var i = 0; i < getNumberOfSections(); ++i) {
    var section = getSection(i);
    var sectionName = section.getParameter("operation-comment", "");
    var sectionWCS = section.wcs;
    var _abc = "";
    if (machineConfiguration.isMultiAxisConfiguration()) {
      var sectionABC = getWorkPlaneMachineABC(section.workPlane, false);
      _abc += conditional(machineConfiguration.isMachineCoordinate(0), "A" + abcFormat.format(sectionABC.x));
      _abc += conditional(machineConfiguration.isMachineCoordinate(1), "B" + abcFormat.format(sectionABC.y));
      _abc += conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(sectionABC.z));
    }
    writeComment(sectionWCS + SP + _abc + SP + sectionName);
  }

 

 



Achim.N
Principal Technology Consultant
Message 3 of 4

DarthBane55
Advisor
Advisor

@AchimN 

I am using a post that has been severely modified over the years, but it's Fanuc based.

I will give this a shot, see what I can do with it, thank you very much for your help!  I will report back when I try.

0 Likes
Message 4 of 4

DarthBane55
Advisor
Advisor

Reporting back, it works like a charm!  I just have to remove the duplicate entries and reformat to what I need, but I can handle that.  Thank you so much, a real help!