Adding stock size as a comment in the post processor

Adding stock size as a comment in the post processor

Anonymous
Not applicable
1,737 Views
4 Replies
Message 1 of 5

Adding stock size as a comment in the post processor

Anonymous
Not applicable

Hey Everyone,

 

I would like to have the sock size as a comment in the post processor.  I know the post processor i use, HAAS generic for my mini mill outputs the tools and their size so i was curious if it could do the stock size as well.

 

For an extra challenge could it also output the programs datum location?  🙂

 

Thanks in advance.

 

Rob T.

0 Likes
Accepted solutions (1)
1,738 Views
4 Replies
Replies (4)
Message 2 of 5

HughesTooling
Consultant
Consultant

The heidenhain post has this for stock and you could look through the setup-sheet.cps posts for info on datums.

 

  { // stock - workpiece
    var workpiece = getWorkpiece();
    var delta = Vector.diff(workpiece.upper, workpiece.lower);
    if (delta.isNonZero()) {
      writeBlock("BLK FORM 0.1 Z X" + xyzFormat.format(workpiece.lower.x) + " Y" + xyzFormat.format(workpiece.lower.y) + " Z" + xyzFormat.format(workpiece.lower.z));
      writeBlock("BLK FORM 0.2 X" + xyzFormat.format(workpiece.upper.x) + " Y" + xyzFormat.format(workpiece.upper.y) + " Z" + xyzFormat.format(workpiece.upper.z));
    }
  }

 

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Message 3 of 5

Anonymous
Not applicable

Ok i am getting there.  I entered this

 

writeln("");
//stock size
{ // stock - workpiece
writeComment ("Stock size test");
var workpiece = getWorkpiece();
var delta = Vector.diff(workpiece.upper, workpiece.lower);
if (delta.isNonZero()) {
writeComment("Stock Size X" + xyzFormat.format(workpiece.lower.x) + " Y" + xyzFormat.format(workpiece.lower.y) + " Z" + xyzFormat.format(workpiece.lower.z));
writeComment("Stock Size X" + xyzFormat.format(workpiece.upper.x) + " Y" + xyzFormat.format(workpiece.upper.y) + " Z" + xyzFormat.format(workpiece.upper.z));
}
writeComment ("End of Stock size test");
}
//end of stock size

writeln("");

I have this as an output

 

(Stock size test)
(Stock Size X-3.1875 Y-1. Z-1.)
(Stock Size X3.1875 Y1. Z0.)
(End of Stock size test)

 

 

The datum is the top middle of the stock which is 6.375" x 2" x 1".  The coding you gave me seems to send back the lower back left corner and the upper front right corner of the stock.  Is there some way to get absolute values back so i can add them up to give me the total stock?

 

Rob 🙂

0 Likes
Message 4 of 5

HughesTooling
Consultant
Consultant
Accepted solution

This seems to work.

  { // stock - workpiece
    var workpiece = getWorkpiece();
    var delta = Vector.diff(workpiece.upper, workpiece.lower);
    if (delta.isNonZero()) {
		var xWorkPiece = Math.abs(workpiece.upper.x-workpiece.lower.x);
		var yWorkPiece = Math.abs(workpiece.upper.y-workpiece.lower.y);
		var zWorkPiece = Math.abs(workpiece.upper.z-workpiece.lower.z);

		writeComment("Stock Size X" + xyzFormat.format(xWorkPiece ) + " Y" + xyzFormat.format(yWorkPiece) + " Z" + xyzFormat.format(zWorkPiece));

    }
  }

Mark

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Message 5 of 5

Anonymous
Not applicable

Mark that is awesome.  thank you so Much for taking the time.  It is really appreciated.

 

Here is what it looked like when i was done.

 

%
O01362 (Spacer plate op 2)
(Using high feed G1 F500. instead of G0.)

(Stock Size X6.75 Y1. Z2.)  <--- Here it is!  Perfect.  Just before the tool list.

(T1 D=0.125 CR=0. TAPER=59deg - ZMIN=1.375 - center drill)
(T3 D=0.3125 CR=0. TAPER=118deg - ZMIN=-0.1439 - drill)

 

Thank-you Mark 🙂

 

Rob Townsend