Cancel
Showing results for 
Search instead for 
Did you mean: 

Re: How to insert existing gcode into a UDE or have the Post insert text from an external file?

Valued Contributor
Valued Contributor
Marek,
That is awesome Thanks! And it works perfectly!
Thank You

Re: How to insert existing gcode into a UDE or have the Post insert text from an external file?

Legend
Legend

Rather interesting ideas,

but your solution No.1 is the most correct.

Any external G-codes should be stored in the NC memory as subprograms, and the only function of postprocessor is to call them with proper arguments.

Re: How to insert existing gcode into a UDE or have the Post insert text from an external file?

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I agree. It would help to keep things simple.

So even if you will update your toolpaths in other software, all you need to do is to postprocess it from there. No need to going back to NX and to modify main NC program

 

Marek Pawlus, NCmatic

Development: C#, Tcl/Tk, CSE

Re: How to insert existing gcode into a UDE or have the Post insert text from an external file?

Valued Contributor
Valued Contributor
FROBI and Marek,
I use subprograms in certain cases but in this case I would prefer to have these small sections of manually created gcode post into the program to reduce possible issues that could occur if someone forgets to load the subprogram and then tries to run the program at night lights out , also my boss would rather not use the subprogram approach except when absolutely necessary. I may still in a few days create a UDE to tell the post to import this code from an external file but I need to do some research thru some of my old post from many years ago to try to see if I have ever done this before. Off the top of my head I do not remember having any of the post I have built read data from an external file but I am sure it can be done.
Thanks

Re: How to insert existing gcode into a UDE or have the Post insert text from an external file?

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

The UDE appoach may work the best.

You will have to use "regular" tcl code to open & read the other file.

 

Does the other file have block numbers ("N1234") at the beginning of each/any lines?

Are these numbers critical (GOTO or whatever logic?)

 

Once you get each line, use MOM_output_literal - which will add block/sequence numbers ("N1234")* to each line, or MOM_output_text (which won't) as appropriate. 

* = depending on use of  the "Sequence Number" UDE & how the post is set up

 

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: How to insert existing gcode into a UDE or have the Post insert text from an external file?

Valued Contributor
Valued Contributor
Ken,
All of my post have block numbers turned off since the shop uses a special block number at the start of each tool for reference (this is built into my post) so block numbers will have no effect. Thanks for the note on the tcl code as I could not remember it being in NX tcl, but there is a lot I don't remember!
Thanks

Re: How to insert existing gcode into a UDE or have the Post insert text from an external file?

PLM World Member Phenom PLM World Member Phenom
PLM World Member Phenom

Here is the grip source.

I do not have access to compile this.  perhaps some kind soul could compile and share the .grx file

 

$$
$$
$$ this program is for creating and
$$ the sole purpose of this is to add
$$ in INSERT/ Statememts
$$
$$ Author  John Joyce
$$
$$
STRING/INLIN(132),INFIL(132),OPNAM(32)
&MODULE=&MACH
$$
$$ CREATE NEW OPERATION
$$
OPER/NEW,'mill_planar','MILL_CONTROL'
&MCEMOD = &APPEND
$$
$$ GET TEXT INPUT
$$
GTX:
TEXT/'Enter path and name of file',INFIL,RESP
JUMP/GTX:,DON:,DON:,,WRT:,RESP
$$
WRT:
FETCH/TXT,2,INFIL,IFERR,ERR1:
RESET/2
MKIT:
READ/2,IFEND,DON:,INLIN
MCTEXT/'INSERT/ '+INLIN
JUMP/MKIT:
DON:
OPER/SAVE
STP:
HALT
$$
ERR1:
MESSG/'NO FILE FOUND'
JUMP/STP:

John Joyce, Manufacturing Engineer,
Senior Aerospace

NX 11.0.2.7 Vericut 8.0.3 - Statements and opinions are mine alone and do not reflect
the opinion of my employer or any other member of the human race

Re: How to insert existing gcode into a UDE or have the Post insert text from an external file?

I was going to suggest operation notes, but I see @Marek_Pawlus beat me to it. If you take this apporach, and you are importing text files to populate the notes, you can further automate it with a couple programs I wrote. One will export notes to a text file, the other will import them. The nice thing is that you can pick 100 operations, run the second program, pick the text file, and you are done. There is a demo movie in the file. 

Mark Rief
Retired Siemens

Re: How to insert existing gcode into a UDE or have the Post insert text from an external file?

If you take the UDE approach, don't forget that you can copy from another operation. In machine control, Start and End of path events, there are "Copy From ..." buttons that many users don't even notice. 

Mark Rief
Retired Siemens

Re: How to insert existing gcode into a UDE or have the Post insert text from an external file?

Creator
Creator

When I run this routine I get a "no such element in array" message.  Any ideas?

 

 

global mom_operation_notes mom_sys_control_in mom_sys_control_out

set ci mom_sys_control_in
set co mom_sys_control_out

MOM_set_seq_off
if {[info exists mom_operation_notes]} {
for {set i 0} {[info exists mom_operation_notes]} {incr i 1} {
MOM_output_literal "$co $mom_operation_notes($i) $ci"
}
}
MOM_set_seq_off

 

 

Learn online





Solution Information