cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

FIL - capture the first GOTO; extract the Z and put the Z first movement

dtrabattoni
7-Bedrock

FIL - capture the first GOTO; extract the Z and put the Z first movement

Hello, I would like to catch the first GOTO in CL file and output Z first (only for the first goto).

In the CL I have:

SPINDL / RPM, 7957.753876,  CLW
RAPID
GOTO / 835.8168781015, 779.7292319751, 30.0000000000

In the post-processed file I get (yes G1 because I forced not tot have G0):

G1X835.817Y779.729Z30F9999

But I would like to have 2 different lines like below (I would like to have F1000 for example):

G1Z30F1000

G1X835.817Y779.729Z30F9999 (I can repeat the same line like it is)

Thanks for your help.

 

1 ACCEPTED SOLUTION

Accepted Solutions

When you are using the POSTF function to extract values from a goto, the coordinates of the position are obtained as:

 

XPOS = POSTF ( 7, 6 )  $$ X position

YPOS = POSTF ( 7, 7 )  $$ Y position

ZPOS = POSTF ( 7, 8 )  $$ Z position

 

The "position" you are specifying for this is what the GPOST program thinks of as its position, which is after it has read the CL file and put the data in its own command structure. It's weird at first but kind of makes more sense as you do more of this stuff.

View solution in original post

11 REPLIES 11
BenLoosli
23-Emerald II
(To:dtrabattoni)

How does the controller handle that first G1 line?

Most controls will move the XY first then Z if approaching the part. On a retract, they execute the Z move first then the XY to clear the part.

 

If you know the Z30 will clear the part, use a start point that is at Z30, then move the table to your XY location.

 

Thanks for your reply.

I can't decide previoulsy that Z30 or Z500 is OK for ALL my pieces, because that depends on where I have my origin.

In some case my Z_zero is on a flat plane which is let's say 50mm below the highest top of the piece; therefore Z30 not enough.

And if I put a very high Z that could put machine in error...

 

BenLoosli
23-Emerald II
(To:dtrabattoni)

Does Creo machining have a start point option?

Program the start point in relation to your part in its fixturing then have the code got from home to the start point then into the XYZ location for the first cut.

 

If you can use a RAPID feed rate, then the control will do the proper initial move to avoid the part.

 

Perhaps I don't understand what you're doing, and you haven't really specified what type of sequence you are using. For most of the paths I use, I do what I *think* you're trying to do via the following:

(1) Set the "CLEAR_DIST" to a large enough value. This distance is how high above the first toolpath point I want the machine to stop moving in RAPID mode and finish the downward motion in normal motion mode.

(2) Optionally, set a "PLUNGE_FEED" value, which is the machine speed that will be used exclusively to finish the downward motion to that first toolpath point. If you don't specify this value (or leave it as "0" or zero), the default is to use your specified "CUT_FEED".

As long as I am careful about setting the CLEAR_DIST, I never have any unpleasant surprises when the machine moves into the first toolpath position.

Thank you everybody. Probably I was not clear enough. My concern is only about the very first movement. All the rest is fine. I'd like to catch the Z value from the very first GOTO.

Write a new line with ZxxxF1000 in top of the part program (for example after the comments).

"Only" this.

 

Hello again, I try to be clearer. I "almost" got what I want but I think one line is wrong and/or missing in my FIL programming.

 

I catch the 1st GOTO in the CL file.

I want to extract the Z value (which is in 3rd position) and it is " 30 ".

And then I want to display in a new line in the post.

 

Below my FIL. The line ZPOS=POSTF(7,3) colud be wrong (or something is missing before) because I don't get the expected Z number value.

 

CL FILE

 

SPINDL / RPM, 14500.000000,  CLW
RAPID
GOTO / -317.1302147874, 12.2510352126, 30.0000000000
RAPID
GOTO / -317.1302147874, 12.2510352126, 5.5000000000

 

my FIL:

 

CIMFIL/ON,5,5 $$CATCH THE GOTO POINTS
DMY=POSTF(20)  $$SAVE THE CURRENT CL RECORD
ZPOS=POSTF(7,3) $$CATCH THE Z VALUE
INSERT/'Z',ZPOS,'F1000','$'  $$CREATE NEW LINE WITH Z_position F1000
DMY=POSTF(21) $$RELOAD THE SAVED CL RECORD
DMY=POSTF(13) $$EXECUTE THE CURRENT CL RECORD
DMY=POSTF(26,5,5,0) $$TURN OFF THIS CIMFIL/ON,5,5 ROUTINE
CIMFIL/OFF

 

Here is what I get in the post-processed file.

S14500M3
Z 5F1000
G1X-317.13Y12.251Z30F9999

 

I get the value "5" which is not the Z value in the GOTO.

When you are using the POSTF function to extract values from a goto, the coordinates of the position are obtained as:

 

XPOS = POSTF ( 7, 6 )  $$ X position

YPOS = POSTF ( 7, 7 )  $$ Y position

ZPOS = POSTF ( 7, 8 )  $$ Z position

 

The "position" you are specifying for this is what the GPOST program thinks of as its position, which is after it has read the CL file and put the data in its own command structure. It's weird at first but kind of makes more sense as you do more of this stuff.

From the stuff I have documenting this it says:

All FIL motion statements, such as GOTO and GODLTA generate Type 5000 records.

So the words of the command are as follows:

 

ICLWRD(1) = CL record number

ICLWRD(2) = 5000

ICLWRD(3) = 3 for FROM, 5 for GOTO, GO, etc. and 6 for continuation record type

ICLWRD(4) = unused

ICLWRD(5) = unused

CLWRD(6) = x-coordinate of 1st CL point

CLWRD(7) = y-coordinate of 1st CL point

CLWRD(8) = z-coordinate of 1st CL point

 

So you can see why you were getting "5" as a value, since that code is telling you it read a "GOTO" statement.

 

The ICLWRD means the value is an integer, while the CLWRD means the value is a real number.

T-H-A-N-K    Y-O-U   soooo much Ken !

That's it ! It works perfectly (apart the unwanted blank space between Z and the ZPOS.🤔..but I think I can survive with it😀)

 

I write here the working macro (may help someone else as I've been helped here):

 

CIMFIL/ON,5,5 $$CATCH THE GOTO POINTS
DMY=POSTF(20)  $$SAVE THE CURRENT CL RECORD
ZPOS=POSTF(7,8) $$READ THE Z POSITION FROM THE GOTO CL RECORD
INSERT/'Z',ZPOS,'F1000','$'  $$CREATE NEW LINE WITH Z_position F1000
DMY=POSTF(21) $$RELOAD THE SAVED CL RECORD
DMY=POSTF(13) $$EXECUTE THE CURRENT CL RECORD
DMY=POSTF(26,5,5,0) $$TURN OFF THIS CIMFIL/ON,5,5 ROUTINE
CIMFIL/OFF

If you're getting a space between Z and the value, you might want to use text commands to build the coordinate before outputting it to your file. Something like:

 

ZNOSPC = TEXT/ CONVF, ZPOS, 6, 0, 0, 3

ZNOSPC = TEXT/ 'Z', ZNOSPC

 

Then you use ZNOSPC instead of " 'Z', ZPOS" in your INSERT command.

You will probably want to look into the syntax of the CONVF line, it's kind of weird how they do this stuff.

Thank you again !

However I found the command OMIT which is easy to use and cancels blamh space !

 

Top Tags