Yasnac Turning post and I'm stuck...

Yasnac Turning post and I'm stuck...

LibertyMachine
Mentor Mentor
1,014 Views
11 Replies
Message 1 of 12

Yasnac Turning post and I'm stuck...

LibertyMachine
Mentor
Mentor

So, I've hacked up a Fanuc turning post for someone to use on a very old lathe with a Yasnac control (it's got the bubble memory where it reads one line at a time) I feel quite satisfied with how far I got it from where it started. However, there are a couple of things I'm stuck on and I can't quite figure out what it is I need to change

Current code:

 

%
N1 G50 X0 Z0
N2 X0 Z0 T100  (delete this line)
N3 T100
N4 M08
N6 G00 S500 M03
N7 G00 X-29250 Z2219 T101
...(CUTTING DATA REMOVED FOR BREVITY)
N20 Z2219
N21 X0 Z0 T200  (this is the wrong T#. It should be T100)
N22 M01
N23 T200
N25 G00 S500 M03
N26 G00 X-21620 Z2219 T202
...
N58 Z2219
N59 X0 Z0 T300  (again, wrong T#)
N60 M01
N61 T300
N63 G00 S500 M03
N64 G00 X0 Z500 T303
...
N69 Z500
N70 M09
N71 X0 Z0 T300 M05
N72 T800
N73 M02
%

Desired code:

 

 

%
N1 T100 M08 (notice how the G50 is on the next line, and M08 is on this one)
N2 G50 X0 Z0  (no X0 Z0 Txxx call needed right off in the program)
N3 G00 S500 M03
N4 G00 X-29250 Z2219 T101
...
N20 Z2219
N21 X0 Z0 T100
N22 M01
N23 T200 M08   (M08 would really be nice to have called out every time)
N24 G50 X0 Z0  (this G50 X0 Y0 needs to be after every tool call)
N25 G00 S500 M03
N26 G00 X-21620 Z2219 T202
...
N58 Z2219
N59 X0 Z0 T200
N60 M01
N61 T300 M08
N62 G50 X0 Z0   (see the G50 again?)
N63 G00 S500 M03
N64 G00 X0 Z500 T303
...
N69 Z500
N70 M09
N71 X0 Z0 T300 M05
N72 T800
N73 M02
%

Basically, at the beginning of every tool, it needs to call up the tool, but no offset. It's offset will be called up on it's first move to the part.

 

At the end of every tool, there will be a X0 Z0 T100 (or whatever the CURRENT tool is, T200, T300 etc) to cancel the offset and send the tool home.

Also at the beginning of every tool, a G50 X0 Z0 is needed. The machine does not have a G54. Your WCS is established via the G50

 

Again, this is a hacked up Fanuc post. I'm happy with what else I was able to do to it, but I'm scratching my head on these last few bits. Anyone have any advice to give, or hints about which section of the code I could look to change?


Seth Madore
Owner, Liberty Machine, Inc.
Good. Fast. Cheap. Pick two.
0 Likes
1,015 Views
11 Replies
Replies (11)
Message 2 of 12

bob.schultz
Alumni
Alumni

Here is a modified post that should give you the desired results.  Let me know if this matches what you are looking for or if you have any questions on the modifications.



Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 3 of 12

LibertyMachine
Mentor
Mentor

That's awesome, thank you. I will pour over it this morning and see if I can understand what you ended up doing to make it come out proper. I really want to learn this stuff. Everytime I feel I made progress some other little thing pops up and reminds me how little I actually know about post edits


Seth Madore
Owner, Liberty Machine, Inc.
Good. Fast. Cheap. Pick two.
0 Likes
Message 4 of 12

LibertyMachine
Mentor
Mentor

@bob.schultz Thank you so much. The code matches up perfectly to what I was looking for. Still waiting to hear back on drilling cycles, but that's a discussion for another thread I think. (cliffnotes: might only be able to use long hand)

 

Where you inserted this code:

if (!isFirstSection()) {
      writeBlock("X" + xFormat.format(0), "Z" + zFormat.format(0), "T" + toolFormat.format(getPreviousSection().getTool().number * 100)) ;
    }

That's exactly what I thought it would need (the "!isFirstSection" and  "getPreviousSection" bit) but I had absolutely no idea on the formatting. Nor do I know where to find that information. I downloaded the help file that Laurens-3D shared some time ago, but that info wasn't readily discovered in that material. So, how do you guys do it? Years spent working in this language simply leads to greater ease of use? I understand that, but where does one start?

 

I mean, I can move a bit of code around and see the results immediately. "Oh look, the M08 is on this line line, cool!" or "Now the G54 is over here" (or gone in this case) Stuff like that makes complete sense. But when it comes to adding code, how does one determine what is needed and whatnot?


Seth Madore
Owner, Liberty Machine, Inc.
Good. Fast. Cheap. Pick two.
0 Likes
Message 5 of 12

bob.schultz
Alumni
Alumni

@LibertyMachine I'm glad the code worked for you.  As far as the learning process goes, the best method I have found is to examine existing code in the various posts you have access to.  For example, the isFirstSection() and getPreviousSection() functions are referenced many times in this post.  The most obvious section of code is when the post determines if a tool change has to occur.

 

  var insertToolCall = forceToolAndRetract || isFirstSection() ||
    currentSection.getForceToolChange &&   
    currentSection.getForceToolChange() ||
    (tool.number != getPreviousSection().getTool().number);

This logic is quite similar to what you required and is fairly simple to find.

 

Another avenue, of which you are already familiar with, is to search this Forum.  There are a lot of experienced users who have helped with quite a variety of problems/requests.  I use the Forum quite a bit when researching requests.  As you noted there is also documentation, how-to videos, and tips available to you for learning how to modify posts, these are usually generic in content (as they have to be) and do not cover all aspects of the post, but are a good starting point.



Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 6 of 12

LibertyMachine
Mentor
Mentor

One last thing, if I may. I've figured out how to modify the post to output drilling cycles longhand.

I've also found how to output drilling cycles with feed per rev 

However, I am having a little difficulty bringing the two together. I can get feed per rev if I keep the canned cycle, or I can get the long hand if I keep the feed per minute. Not finding a way to do both. I'm sure it exists, but it eludes me.


Seth Madore
Owner, Liberty Machine, Inc.
Good. Fast. Cheap. Pick two.
0 Likes
Message 7 of 12

bob.schultz
Alumni
Alumni

From looking at the code I am assuming that the feed rate always has to be output in FPR mode.  You can use the following additions to the getFeed function to ensure that the feed rate is always output in FPR even if it was specified in FPM (this includes expanded cycles).

 

function getFeed(f) {
  if (activeMovements) {
    var feedContext = activeMovements[movement];
    if (feedContext != undefined) {
      if (!feedFormat.areDifferent(feedContext.feed, f)) {
        if (feedContext.id == currentFeedId) {
          return ""; // nothing has changed
        }
        forceFeed();
        currentFeedId = feedContext.id;
        return "F#" + (firstFeedParameter + feedContext.id);
      }
    }
    currentFeedId = undefined; // force Q feed next time
  }
  var feed = f;
  if (currentSection.feedMode != FEED_PER_REVOLUTION) {
    if (tool.spindleRPM == 0) {
      error(localize("Spindle RPM cannot be 0"));
    } else {
      feed = f / tool.spindleRPM;
    }
  }
  return feedOutput.format(feed); // use feed value
}


Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 8 of 12

Laurens-3DTechDraw
Mentor
Mentor

@bob.schultz wrote:

From looking at the code I am assuming that the feed rate always has to be output in FPR mode.  You can use the following additions to the getFeed function to ensure that the feed rate is always output in FPR even if it was specified in FPM (this includes expanded cycles).

 

function getFeed(f) {
  if (activeMovements) {
    var feedContext = activeMovements[movement];
    if (feedContext != undefined) {
      if (!feedFormat.areDifferent(feedContext.feed, f)) {
        if (feedContext.id == currentFeedId) {
          return ""; // nothing has changed
        }
        forceFeed();
        currentFeedId = feedContext.id;
        return "F#" + (firstFeedParameter + feedContext.id);
      }
    }
    currentFeedId = undefined; // force Q feed next time
  }
  var feed = f;
  if (currentSection.feedMode != FEED_PER_REVOLUTION) {
    if (tool.spindleRPM == 0) {
      error(localize("Spindle RPM cannot be 0"));
    } else {
      feed = f / tool.spindleRPM;
    }
  }
  return feedOutput.format(feed); // use feed value
}

Do we not forget to set the machine to FPR mode in this case?

(I have not fully read his post processor so not sure if needed but just something to consider)

Laurens Wijnschenk
3DTechDraw

AutoDesk CAM user & Post editor.
René for Legend.


0 Likes
Message 9 of 12

LibertyMachine
Mentor
Mentor

@Laurens-3DTechDraw I would agree that it would be preferred to have the machine in FPR mode. However, in this case, I'm not certain that's an option. The machine and control date back to the late 70's (I was in diapers at that point, there's an image for you) and all the sample programs I've got make no mention of G95/G96. I'd like to find an actual manual for the control, but I've not spent a large amount of time looking, tbh

 

@bob.schultz thank you, I will try that code out and post back and let you know if I have any issues


Seth Madore
Owner, Liberty Machine, Inc.
Good. Fast. Cheap. Pick two.
0 Likes
Message 10 of 12

Laurens-3DTechDraw
Mentor
Mentor

@Anonymous wrote:

@Laurens-3DTechDraw I would agree that it would be preferred to have the machine in FPR mode. However, in this case, I'm not certain that's an option. The machine and control date back to the late 70's (I was in diapers at that point, there's an image for you) and all the sample programs I've got make no mention of G95/G96. I'd like to find an actual manual for the control, but I've not spent a large amount of time looking, tbh

 

@bob.schultz thank you, I will try that code out and post back and let you know if I have any issues


It could be G94 and G95 if it's using the B or C format G-Code System

Laurens Wijnschenk
3DTechDraw

AutoDesk CAM user & Post editor.
René for Legend.


0 Likes
Message 11 of 12

bob.schultz
Alumni
Alumni

@Laurens-3DTechDraw In this post, the codes to enable FPM mode are commented out, which is why I assumed that the controller always requires FPR feed rates.  Of course it is always easy to add the proper codes for FPM/FPR modes if they are required.  I believe the A,B,C G-code format options are left over from the Fanuc post used as a seed for this post and will not be used.  This option will probably be removed.



Bob Schultz
Sr. Post Processor Developer

Message 12 of 12

LibertyMachine
Mentor
Mentor

@bob.schultz hit the nail on the head. I used a generic Fanuc turning post as the seed for the Yasnac. I thought about using the Tormach or Haas, but I didn't know if I was going to run into any anomalies during the process. The A, B, C option will be either removed or commented out (I prefer commenting out, myself)


Seth Madore
Owner, Liberty Machine, Inc.
Good. Fast. Cheap. Pick two.
0 Likes