Cancel
Showing results for 
Search instead for 
Did you mean: 

Postprocessor - skip first operation

Creator
Creator

Hi,

 

I am working on a new post for a simple horizontal lathe.  My NX file has several lathe control operations at the beginning, used for program notes, setup info, etc.  I have added code to both Operation Start and Operation End sections, and I'd like that code to skip over the lathe control ops and only output for the toolpath operations.  As it is now, the code works as expected, except for the very first machine control op.  In order to skip the output for that one, I have to specify that op by name.  I'd like to find a way to avoid specifying anything by operation name.  Does anyone have any suggestions on 1) why the post is functioning this way, and 2) how to avoid using the operation name to skip?  Thanks in advance.

 

David

 

Note: I did not include the global variables or settings in this code.  This code is to output a turret home command just prior to the first tool path operation, immediately after all of the machine control ops.  A snippet of NC code is below also.


    if { [ info exists mom_operation_type ] && $mom_operation_type != "Lathe Machine Control" } {
        if { [ info exists mom_operation_name ] && $mom_operation_name != "PROGRAM_NOTES" } {
            if { [ info exists first_operation_flag ] && $first_operation_flag == 1 } {
                MOM_output_literal " "
                MOM_output_literal "(TURRET HOME POSITIONS)"
                MOM_output_literal "G13"
                MOM_output_literal "M157"
                MOM_output_literal "G90"
                MOM_output_literal "G00X$A_turret_X_home_pos. Z$A_turret_Z_home_pos."
                MOM_output_literal "G14"
                MOM_output_literal "M157"
                MOM_output_literal "G90"
                MOM_output_literal "G00X$B_turret_X_home_pos. Z$B_turret_Z_home_pos."

            set first_operation_flag 0
            }
        }
    }

 

N0010 
N0020 ( PROGRAM_NOTES )
N0030 (PROGRAMMER: )
N0040 (ENGINEERING PRINT: )
N0050 (PROCESS SKETCH: )
N0060 

N0230 ( GRAPHICS )
N0240 CLEAR
N0250 DEF WORK
N0260 PS LC,[-60,0],[133,35]
N0270 END
N0280 DRAW
N0290 
N0300 (TURRET HOME POSITIONS)
N0310 G13
N0320 M157
N0330 G90
N0340 G00X30. Z27.
N0350 G14
N0360 M157
N0370 G90
N0380 G00X30. Z27.
N0390 
N0400 ( FACING )
N0410 ( *** TOOL NUMBER: 3 --- OFFSET: 3 *** )
N0420 ( *** 80 DEG. INSERT, 0.0310 RAD. ***  )
N0430 ( *** 425A_TOOL3B1 *** )
N0440 ( LOWER TURRET )
N0450 G14

15 REPLIES

Re: Postprocessor - skip first operation

Legend
Legend

Wouldn't removing the 2nd line achieve what you want? Then if it is a Machine Control, that is the first operation, it would then skip? An issue I see is that it would then always skip the first Machine Control every time. 

 

If you need to add notes, you can right click program group>object>start events, then add as many notes as you want. No matter what operation you post, that is within that group you will get the notes. 

 

 

 

   if { [ info exists mom_operation_type ] && $mom_operation_type != "Lathe Machine Control" } {
 remove>>>>   if { [ info exists mom_operation_name ] && $mom_operation_name != "PROGRAM_NOTES" } {
            if { [ info exists first_operation_flag ] && $first_operation_flag == 1 } {
                MOM_output_literal " "
                MOM_output_literal "(TURRET HOME POSITIONS)"
                MOM_output_literal "G13"
                MOM_output_literal "M157"
                MOM_output_literal "G90"
                MOM_output_literal "G00X$A_turret_X_home_pos. Z$A_turret_Z_home_pos."
                MOM_output_literal "G14"
                MOM_output_literal "M157"
                MOM_output_literal "G90"
                MOM_output_literal "G00X$B_turret_X_home_pos. Z$B_turret_Z_home_pos."

            set first_operation_flag 0
            }
        }
    }

Glenn Balon
Production: NX 12.0.2 MP2 Primarily CAM

Re: Postprocessor - skip first operation

Creator
Creator

Thanks Glen.

 

Removing the second line should be correct, but it doesn't work.  If I remove the second line, the turret home code is output above the PROGRAM_NOTES machine control.  It appears that the post is not recognizing the first operation as a machine control op.  That's what's baffling to me.  As I mentioned in the original post, this same scenario is occuring when I add end_of_op code.  The end_of_op code will output below the first machine control op, but not below the other machine control ops.  The correct code will then also output below the toolpath ops as expected.

 

We require certain information in our program header code, and we found having machine control ops a better method to handle that info, rather than start events.

Re: Postprocessor - skip first operation

Legend
Legend

I have had a similar, but not that exact issue. This info below (from the docs) has helped me trouble shoot in the past. 

 

Maybe custom UDE could be created where you fill out the fields, then attach to main program group. I have been thinking about doing this for some time. 

 

 

When you post process a tool path, the data is output in the following order:

 

Start of program

User-defined events (UDEs) attached to the program

Start of parent group (program, machine tool, geometry, method)

UDEs attached to the parent group

UDEs attached to the geometry with program, machine tool, geometry, method commands

UDEs attached to the method with Start Events

UDEs attached to the cutting tool with Start Events

UDEs attached to the machine tool with Start Events

Start of operation

Tool change (not Load tool)

UDEs attached to the operation with Start Events

Initial move

UDEs attached to the operation with End Events

End of operation

UDEs attached to the geometry with End Events

UDEs attached to the method with End Events

UDEs attached to the cutting tool with End Events

UDEs attached to the machine tool with End Events

End of program

Glenn Balon
Production: NX 12.0.2 MP2 Primarily CAM

Re: Postprocessor - skip first operation

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

1) I'd try outputting the value of mom_operation_type  (MOM_output_text or whatever) to see what NX thinks the operation type is.  Maybe it is something "odd" (Mill control or ???)

2) If you assign the "control" ops to the "None" tool, you probably can output the stuff you want, where you want, as part of the "First tool change" event

3) Create a UDE.  Just remember, the UDE handler in the post does NOT have to output anything - you can have a separate proc/custom command handle the output.  Put the output function where you want...

 

Ken

 

 

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled


Re: Postprocessor - skip first operation

Creator
Creator

Glenn, thanks for the information.

 

Ken, I didn't think about checking the operation type.  Thanks for that suggestion.  When I did, the post returned the op type for PROGRAM_NOTES as Turn Finishing (see snippet below).  The odd thing is when I look at the information for the operation, it says it's a Lathe Machine Control.  Any thoughts on why that would happen?

 

David

 

N0010

N0020 (op type is Turn Finishing)

N0030 ( PROGRAM_NOTES )

N0040 (PROGRAMMER: )

N0050 (ENGINEERING PRINT: )

N0060 (PROCESS SKETCH: )

N0070

N0080 (op type is Lathe Machine Control)

N0090 ( SETUP_INFO )

N0100 (CHUCK JAWSSmiley Happy

N0110 (USE 3.50 JAW SET WITH STOCK STOP 6" FROM FACE)

 

 

***below is from the object information for the operation***

---------- Operation Information ----------

Operation Name PROGRAM_NOTES

Operation Type Lathe Machine Control

Update Status Complete

Last Time Updated 2018/04/18 13:44:00

Re: Postprocessor - skip first operation

Legend
Legend

Try this instead. The * allow a partial string search. 

 

if { [ info exists mom_operation_type ] && ![string match "*Lathe Machine Control*" $mom_operation_type] } {
if { [ info exists mom_operation_name ] && $mom_operation_name != "PROGRAM_NOTES" } {
if { [ info exists first_operation_flag ] && $first_operation_flag == 1 } {

Glenn Balon
Production: NX 12.0.2 MP2 Primarily CAM

Re: Postprocessor - skip first operation

Creator
Creator

I've at least figured out why my code isn't working.  The post is recognizing the first operation type to be the same as the last operation type.  If the last op in the program is a finish turn type, the first op is recognized as a finish turn type.  If the last op is a rough turn type, the first op is recognized as a rough turn type.

 

Does anyone know if this is something my code could be influencing, or does this sound like an issue with postbuilder?  I know there are a lot of variables that affect how the post will function, but has anyone seen or know of a similar situation occuring?

 

For now, I can work around this issue, but I would like to uncover the root cause.  Thanks for the help so far.

 

David

Re: Postprocessor - skip first operation

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Do you call any "shop docs" (.tpl) files at the beginning of your post (e.g. to create tool lists)? (look for MOM_do_template_file).  This is known to screw up mom variables, leaving them at the values of last object (operation or whatever) cycled thru

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled


Re: Postprocessor - skip first operation

Creator
Creator

Yes, I have the shop doc code for creating the tool list (at the beginning).

 

Can some of those files be modified to eliminate this, or do I need to come up with a work around for it?  I have some ideas, but I'd prefer if the programmer did not have to add anything extra just for a work around.

 

Thanks again for all the repsonses and help.

 

David

Learn online





Solution Information