cancel
Showing results for 
Search instead for 
Did you mean: 

generating NC code with subroutines

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Hello everyone,

I would like to ask if anyone knows if it is possible to generate NC code for TNC530 subprograms at the end of the operation?

 

Example NC code:

0 BEGIN PGM SKOLENI-3001 MM
1 BLK FORM 0.1 Z X-500 Y-500 Z-500
2 BLK FORM 0.2 X+500 Y+500 Z+500
3 ;
4 * - SPOT_DRILLING , TOOL : NAVRTAVAK-D6
5 ;
6 TOOL CALL 10 Z S4775 DL+0
7 L X+200.9644 Y+94.324 R0 FMAX M3
8 L Z+60 FMAX
9 M8
10 CYCL DEF 200 VRTANI ~
Q200=+3 ;BEZPECNOSTNI VZDAL. ~
Q201=-3 ;HLOUBKA ~
Q206=+955 ;POSUV NA HLOUBKU ~
Q202=+3 ;HLOUBKA PRISUVU ~
Q210=+0 ;CAS.PRODLEVA NAHORE ~
Q203=+50 ;SOURADNICE POVRCHU ~
Q204=+10 ;2. BEZPEC.VZDALENOST ~
Q211=+0 ;CAS. PRODLEVA DOLE
11 CALL LBL 1
12 M9
13 M5
14 ;
15 * - DRILLING , TOOL : VRTAK-D14
16 ;
17 TOOL CALL 15 Z S2046 DL+0
18 L X+200.9644 Y+94.324 FMAX M8 M3
19 L Z+60 FMAX
20 CYCL DEF 200 VRTANI ~
Q200=+3 ;BEZPECNOSTNI VZDAL. ~
Q201=-36.206 ;HLOUBKA ~
Q206=+409.2 ;POSUV NA HLOUBKU ~
Q202=+36.206 ;HLOUBKA PRISUVU ~
Q210=+0 ;CAS.PRODLEVA NAHORE ~
Q203=+50 ;SOURADNICE POVRCHU ~
Q204=+10 ;2. BEZPEC.VZDALENOST ~
Q211=+0 ;CAS. PRODLEVA DOLE
21 CALL LBL 1
22 L Z+0 R0 FMAX M91
23 M2
24 LBL 1
25 L X+200.9644 Y+94.324 FMAX M99
26 L X+216.7379 Y+130.388 FMAX M99
27 LBL 0
28 END PGM SKOLENI-3001 MM

6 REPLIES

Re: generating NC code with subroutines

Phenom
Phenom

Hi,

 

Ok, so your subroutines are cycle calls with coordinates. (L X.. Y. M99)

 

I suggest save this lines into variable array.

Output it in the end of program.

 

It would be good to create another array with next drill operation

and output it separately in the end to be correct.

 

example:

10 CYCL DEF 200 VRTANI ~
Q200=+3 ;BEZPECNOSTNI VZDAL. ~
Q201=-3 ;HLOUBKA ~
Q206=+955 ;POSUV NA HLOUBKU ~
Q202=+3 ;HLOUBKA PRISUVU ~
Q210=+0 ;CAS.PRODLEVA NAHORE ~
Q203=+50 ;SOURADNICE POVRCHU ~
Q204=+10 ;2. BEZPEC.VZDALENOST ~
Q211=+0 ;CAS. PRODLEVA DOLE
11 CALL LBL 1

 

10 CYCL DEF 200 VRTANI ~
Q200=+3 ;BEZPECNOSTNI VZDAL. ~
Q201=-3 ;HLOUBKA ~
Q206=+955 ;POSUV NA HLOUBKU ~
Q202=+3 ;HLOUBKA PRISUVU ~
Q210=+0 ;CAS.PRODLEVA NAHORE ~
Q203=+50 ;SOURADNICE POVRCHU ~
Q204=+10 ;2. BEZPEC.VZDALENOST ~
Q211=+0 ;CAS. PRODLEVA DOLE
11 CALL LBL 2

 

24 LBL 1
25 L X+200.9644 Y+94.324 FMAX M99
26 L X+216.7379 Y+130.388 FMAX M99
27 LBL 0

 

24 LBL 2
25 L X+200.9644 Y+94.324 FMAX M99
26 L X+216.7379 Y+130.388 FMAX M99

26 L X+216.7379 Y+130.388 FMAX M99

26 L X+216.7379 Y+130.388 FMAX M99
27 LBL 0

 

 

cheers

---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #

Re: generating NC code with subroutines

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Thank you for the information. I've never done this in Postbuilderu. Could you tell me how to write the variable looks like?

Thank you very much

Re: generating NC code with subroutines

Phenom
Phenom
hello,

set your custom variables for this,

example

set "d"at start of program/operation to 0

in cycle event:
set your_variable($d) "put here what you want"
incr d

and in the end of pgm you will have array:
your_variable(1)
your_variable(2)
etc

so output it
---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #

Re: generating NC code with subroutines

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Thank you for the information. Could you send the code in a simple postprocessor?
I am a beginner and do not know how this fasting precisely.


Thank you very much

Re: generating NC code with subroutines

Phenom
Phenom

hi,

 

 

in start of opeartion group put custom command with:

global d

set d 0

----------------

in cycle event put custom command with:

global lbl d

 

set lbl($d) "L X$mom_cycle_rapid_to_pos(0) Y$mom_cycle_rapid_to_pos(1) FMAX M99"

incr d

------

in the end program sequence put custom command with:

 

global lbl

 

if {[info exists lbl]} {

 

   foreach i [lsort -integer [array names lbl ]] {
   MOM_output_literal "$lbl($i) "
            }

 

}

-----------------

 

this is the way but there is more work and testing

Ive never done it before

---------------------------------------------
#♫ PB, 5ax, itnc, nx, vericut ♫ #

Re: generating NC code with subroutines

Esteemed Contributor
Esteemed Contributor

Note posts use the "tcl" language.

If you don't know tcl, I would recommend getting some training (either get a book or do some on-line tutorials)

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


Learn online





Solution Information