Перейти к публикации

Затруднение со стандартным Постпроцессором Fanuc 0i-TC


МегаЯр

Рекомендованные сообщения

Доброго времени суток, уважаемые участники форума!

Пробежался по форуму, очень сложно найти то, что нужно в виду большого массива информации.

Прошу о помощи знающих людей.

Обработка токарно-фрезерная.

Стандартный пост Fanuc 0i-TC при генерировании кода фрезерных операций не выдает перемещение по оси "Z". ни при обработке простых контуров, ни при входе по спирали.

А так же, собственно, не включает приводной инструмент. Если вкл. инструмента можно решить вручную, то прописывать координату "Z" в каждом кадре - это...... это печально :sad:

Изменено пользователем МегаЯр
Ссылка на сообщение
Поделиться на других сайтах


Нужно видеть пост.

Сегодня же приложу пост к сообщению. Буду очень признателен!
Ссылка на сообщение
Поделиться на других сайтах

таков стандартный пост:

; $Workfile: fan_0tc.gpp $

;

; $Log: S:/CAD_VCSW/GPP/FAN_0TC.GPV $

;

; Rev 1.0 17 Jul 1995 10:20:36 SOFI

; dev

;

; Rev 1.1 01 Oct 1993 10:59:54 DAVID

;

; ---------------------------------------------------------------------

;

; FANUC

;-----

;

@init_post

global numeric first_feed

global string tool_diameter_f tool_number_f spin_f xend_f

global numeric drill_lower_zz drill_upper_zz drill_clearance_zz ffeed q ss

global numeric save_spin_unit save_x save_z save_tool ch_tool G112 first_line

global logical spin_dir_us spin_dir_us1 mak_grv ben2 mill_tool

global numeric xold yold zold cold first_107

; Non GPPL variables

num_user_procs = 15

line_labels = TRUE ; Jump to N...

; GPPL variables

numeric_def_f = '5.3'

integer_def_f = '5.0(p)'

gcode_f = '2.0(p)'

mcode_f = '2.0(p)'

xpos_f = '5.3(*2)'

xend_f = xpos_f

ypos_f = '5.3'

zpos_f = '5.3'

feed_f = '4.3(p)'

tool_diameter_f = '5.3/1'

blknum_f = '5.0(p)'

tool_number_f = 'z2.0(n)'

blknum_gen = TRUE

blknum_exist = FALSE

blknum = 10

blknum_delta = 10

blknum_max = 32000

gcode_space = TRUE

spin_f = '5.0(n)'

;trace "all":5

;trace"@change_tool":5

;trace "@home_number":5

endp

;-------------------

@start_of_file

; before tools definition

{'%'}

{nl, ':'program_number, ' (', g_file_name, ')'}

; {nb, '/G28 U0 W0'}

; {nb, '(UNTERPROGRAMME...O'first_proc_number, ' .. O'last_proc_number, ')'}

endp

;-------------------

@start_program

; after tools definition

; ss = 3800

; {nb , 'G50 S'ss:'5.0(p)' }

; {nb,'M8'}

endp

;-------------------

@end_program

xpos=xtool

zpos=ztool

if !mill_tool

if save_spin_unit <> rpm

gcode = 97

{nb ' G'gcode}

endif

call @rapid_move

endif

; if mill_tool

; {nb ,'M15'}

; {nb ,'M23'}

; {nb ,'G28 U0.0 V0.0'}

; endif

{nb, 'M30'}

endp

;-------------------

@end_of_file

{nl, '%'}

endp

;-------------------

@relative_mode

endp

;-------------------

@absolute_mode

endp

;-------------------

@machine_plane

if machine_plane eq XY

gcode = 17

endif

if machine_plane eq YZ

gcode = 18

endif

if machine_plane eq ZX

gcode = 19

endif

if machine_plane eq 4

gcode = 19

endif

; {nb, 'G'gcode}

endp

;-------------------

@call_proc

{nb, 'M98 P'label}

{[' ('message, ')']}

endp

;-------------------

@proc

blknum = 10

{nl, ':'label}

endp

;-------------------

@end_proc

; {nb, 'M99'}

endp

;----------------

@loop

endp

;----------------

@end_loop

endp

;----------------

@def_tool

endp

;-------------------

@rapid_move

gcode = 0

{nb, ['G'gcode]}

{[' X'xpos] , [' Z'zpos]}

save_x = xpos

save_z = zpos

endp

@move_4x

if prev_command eq '@line_4x'

if g107 eq 1

{nb ,'G107 C0.0'}

endif

endif

gcode = 0

if ch_tool eq 1

{nb,['G'gcode], ' M19' [' Z'zpos ] }

{nb,['G'gcode], [' Z'zpos ] }

endif

if G112 eq 1 and ch_tool eq 0 and change(zpos)

if job_type ne 'drill'

{nb, 'G113'}

endif

{nb,['G'gcode] [' X'xpos] [' Z'zpos ]} ; [' C'cpos] }

if job_type ne 'drill'

{nb,'G0 X'xtool ' Z'ztool, ' M18'}

endif

else

{nb,['G'gcode] [' X'xpos] [' Z'zpos ]}; ['******* C'cpos] }

xold = xpos

cold = cpos

endif

if job_type eq 'drill'

{[' C'cpos]}

endif

first_feed = 0

endp

;-------------------

@line

gcode = 1

{nb, ['G'gcode]}

if ben2 and work_type eq ROUGH

if process_type eq LONG then

{' X'xpos}

else

{' Z'zpos}

endif

ben2 = false

else

{[' X'xpos], [' Z'zpos]}

endif

if prev_command eq '@turn_proc' then

change(feed) = TRUE

endif

{[' F'feed]}

endp

;----------------------------

@line_4x

gcode = 1

; if ch_tool eq 1

if job_machine_type eq milling and change(zpos)

if g107 ne 1

{nb ,'M37'}

endif

endif

if use_feed eq 0

{nb,['G'gcode] [' X'xpos] [' Z'zpos ] [' C'cpos], [' F'feed]}

else

{nb,['G'gcode] [' X'xpos] [' Z'zpos ] [' C'cpos]}

if first_feed eq 0 or first_feed eq 1

first_feed = first_feed + 1

{[' F'feed]}

endif

endif

; if ch_tool eq 1

if job_machine_type eq milling and change(zpos)

if g107 ne 1

{nb ,'M38'}

endif

if job_type ne 'drill'

if g107 ne 1

{nb ,'G112'}

endif

endif

endif

ch_tool = 0

; endif

if g107 eq 1

if first_107 eq 0

first_107 = 1

{nb,'G1 G18 W0 H0'}

{nb,'G107 C'(radial_diameter/2)}

endif

endif

endp

;-------------------

@arc

if arc_direction eq CCW then

gcode = 3

else ; CW

gcode = 2

endif

{nb, ['G'gcode] ' X'xend ' Z'zend}

{' I'xcenter_rel, ' J'ycenter_rel}

; if arc_size >= 180 then

; radius = -radius

; endif

{[' F'feed]}

endp

;-------------------

@compensation

if side eq COMP_LEFT then

gcode = 41

endif

if side eq COMP_RIGHT then

gcode = 42

endif

if side eq COMP_OFF then

gcode = 40

endif

{nb 'G'gcode ' ' }

if side <> COMP_OFF then

skipline = false

endif

endp

;-------------------

@delay

gcode = 4

{nb 'G'gcode, ' P'delay_period:integer_def_f}

endp

;-------------------

@change_ref_point

endp

;-------------------

@home_number

endp

;-------------------

@rotate

endp

;-------------------

@fourth_axis

endp

;-------------------

@change_tool

local numeric xx rr

if !first_tool

xpos = xtool

zpos = ztool

call @rapid_move

endif

blknum_exist = true

{nb, 'T'tool_number tool_number}

blknum_exist = FALSE

{nb ,'G97'}

skipline = false

call @start_tool_mill

{nb ,'M49'}

{nb, 'G0 X'xtool, ' Z'znext, ' M19'}

{nb ,'G28 C0.'}

; skipline = false

xpos = xnext

ypos = ynext

zpos = znext

cpos = cpos

gcode = 1

; skipline = false

mill_tool = true

ch_tool = 1

G112 = 1

endp

@turn_change_tool

if !first_tool

if save_spin_unit <> rpm

gcode = 97

{nb ' G'gcode}

endif

xpos = xtool

zpos = ztool

call @rapid_move

endif

if mill_tool

{nb ,'M15'}

{nb ,'M23'}

endif

{nb ,'M01'}

{nb ,'T'tool_number'00 '}

if spin_unit eq rpm

{nb ,'G97 '}

else

{nb ,'G96 '}

endif

skipline = false

xpos = xnext

zpos = znext

gcode = 1

call @rapid_move

tool_direction = CCW

skipline = false

call @start_tool

{' T'tool_number tool_number}

save_spin_unit = spin_unit

save_tool = tool_number

spin_dir_us = false

spin_dir_us1 = true

endp

;-------------------

@message

{nb, '(', message, ')'}

endp

@drill

if drill_type eq drilling then

gcode = 81

endif

if drill_type eq peck then

gcode = 83

endif

if drill_type eq tapping then

gcode = 84

endif

{'G'gcode, ' Z'drill_lower_z, ' R'drill_upper_z}

if drill_type eq peck then

{' Q'down_step}

endif

{' F'feed}

endp

;-------------------

@drill4x_pnt

{nb, ' ', [' X'xpos], [' Z'zpos] , [' C'cpos]}

endp

;-------------------

@turn_drill

local string for for1 for2 for3

local numeric save_feed xx

for1 = '2/2.0(P)'

for2 = '2/2.0(P*10)'

for3 = '5.0(P*1000)'

gcode = 74

if drill_type eq drilling then

r = 0

q = abs(drill_lower_z + r)

endif

if drill_type eq peck then

r = r

q = (down_step)

endif

if drill_type <> tapping

{nb 'G'gcode, ' R'r }

{nb 'G'gcode, ' Z'drill_lower_z ' Q'q:for3}

{' F'feed }

else

gcode = 32

save_feed =feed

xx = 100-p_feed

feed = feed*xx/100

{ nb 'G'gcode ' Z'drill_lower_z}

{' F'feed }

;tbd.. check for a maximum of 10 mm mistake (BIG MISTAKE)

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

feed = save_feed

{nb 'M5'}

{nb 'G'gcode ' Z'drill_upper_z ' S'(spin*1.3):integer_def_f ' M4'}

{' F'feed }

endif

endp

;-------------------

@mirror

endp

;-------------------

@end_drill

endp

;-------------------

@halt_program

{' M0'}

endp

;--------------------

@round_comp

; NOP

endp

;--------------------

@start_of_job

; if job_machine_type eq milling

; {nb ,'G112'}

; endif

endp

;--------------------

@end_of_job

if g107 eq 1

{nb ,'M18'}

endif

if job_machine_type eq milling

; {nb ,'G113 M50'}

if job_type eq 'drill'

{nb ,'M18'}

endif

{nb ,'M50'}

{nb ,'M75'}

endif

endp

;--------------------

@assign_axis

; TBD

endp

; =======================

; USER DEFINED PROCEDURES

; =======================

@call_simple_proc

active(message) = FALSE

active(parm1) = FALSE

active(parm2) = FALSE

active(parm3) = FALSE

proc_count = 1

call @call_proc

endp

;-------------------

@start_tool_mill

if tool_direction eq CW then

mcode = 74

else ; CCW

mcode = 73

endif

{nb,' S'spin:integer_def_f, ' M'mcode}

endp

@start_tool

local numeric save_spin

save_spin = spin

if tool_direction eq CW then

mcode = 4

else ; CCW

mcode = 3

endif

if spin_unit eq rpm

if spin > ss

spin = ss

endif

endif

{nb,' S'spin:integer_def_f, ' M'mcode}

endp

;-------------------

@stop_tool

{nb ' M75'}

endp

;-------------------

@turning

local numeric ww uu rr aa bb

local logical ben1

if semi_finish then

rough_offset_x = semi_offset_x

rough_offset_z = semi_offset_z

work_type = rough

if process_type eq long

if turning_mode <> internal

uu = save_x - first_pos_x

else

uu = first_pos_x - save_x

endif

down_step = (uu+10)

else

ww = save_z - first_pos_z

down_step = (ww+10)

endif

ben1 = true

endif

if work_type eq ROUGH then

if process_type eq LONG then

gcode = 71

{nb, 'G'gcode}

{' U'down_step, ' R'(down_step/2) }

{nb, 'G'gcode ' P'start_line ' Q'end_line}

{' U'rough_offset_x ' W'rough_offset_z}

else

gcode = 72

{nb, 'G'gcode }

{' W'down_step, ' R'(down_step/2) }

{nb 'G'gcode ' P'start_line ' Q'end_line}

{' U'rough_offset_x ' W'rough_offset_z}

endif

if feed_unit eq css

{' F'feed }

else

{' F'feed:'5.0(p)' }

endif

ben2 = true

endif

if work_type eq COPY then

ww = save_z - first_pos_z

uu = save_x - first_pos_x

aa = (uu - rough_offset_x)

bb = (ww - rough_offset_z)

rr = sqrt(aa * aa + bb * bb)

gcode = 73

if ben1 eq false

num_down_steps = rr / down_step + 1

else

num_down_steps = 1

endif

{nb, 'G'gcode,' U'uu, ' W'ww, ' R'num_down_steps}

{nb, 'G'gcode ' P'start_line ' Q'end_line }

{' U'rough_offset_x ' W'rough_offset_z}

if feed_unit eq css

{' F'feed }

else

{' F'feed:'5.0(p)' }

endif

endif

if semi_finish then

gcode = 150

endif

if finish then

gcode = 151

endif

endp

@turn_proc

endp

@turn_endproc

endp

@end_job_procs

; {nb, 'M99'}

endp

@m_feed_spin

first_line = 1

; call @start_tool

endp

@feed_spin

{nb}

if feed_unit eq RPM

feed_f = '5.0(p)'

{'G98'}

else ; CSS

{'G99'}

feed_f = '4.3(p)'

endif

if spin_unit eq rpm ; Mm/Sec

gcode = 97

{' G'gcode}

else

gcode = 96

{' G'gcode}

endif

if change(spin) then

{' S'spin}

endif

endp

@thread

local string for for1 for2 for3

local numeric taper_angle

for = '3.3(n*1000)'

for1 = '2/2.0(P)'

for2 = '2/2.0(P*10)'

for3 = '5.0(P*1000)'

taper_angle = (first_pos_x-last_pos_x)

if last_pos_x <> first_pos_x

if turning_mode <> internal

xpos = (last_pos_x + depth + safety )

else

xpos = (last_pos_x - depth - safety )

endif

gcode = 0

{nb,'G'gcode ' X'xpos }

endif

if lead_unit <> mm

lead = (25.4/lead)

endif

if spin_dir1 eq 1

tool_direction = cw

if spin_dir_us eq false

call @stop_tool

call @start_tool

endif

spin_dir_us = true

else

tool_direction = ccw

if spin_dir_us1 eq false

call @stop_tool

call @start_tool

spin_dir_us = false

endif

spin_dir_us1 = true

endif

if work_type eq multiple

gcode = 76

;tool_nose_engle = 0 60 29 55 30

{nb, 'G'gcode, ' P'no_last_cut:for1, phase:for2 ,T_angle:for1 ' Q'min_down_step:for' R'last_cut:for}

{nb 'G'gcode ' X'last_pos_x:xpos_f ' Z'last_pos_z }

if taper_angle <> 0

{' R'taper_angle}

endif

{' P'depth:for3 ' Q'down_step:for ' F'lead}

else

gcode = 92

{nb ' G'gcode ' X'last_pos_x:xpos_f ' Z'last_pos_z}

if taper_angle <> 0

{' R'taper_angle}

endif

{' F'lead}

endif

endp

@groove

local string for for1 for2 for3

local numeric d1 d2

for1 = '2/2.0(P)'

for2 = '2/2.0(P*10)'

for3 = '5.0(P*1000)'

d1 = abs(side_step)

d2 = abs(down_step)

if process_type eq face

gcode = 74

{nb 'G'gcode, ' R'release_dist }

{nb 'G'gcode,' X'last_pos_x:xpos_f ' Z'last_pos_z ' P'd1 :for3 ' Q'd2 :for3 }

else

gcode = 75

{nb 'G'gcode, ' R'release_dist }

{nb 'G'gcode,' X'last_pos_x:xpos_f ' Z'last_pos_z ' P'd2:for3 ' Q'd1:for3}

endif

{' F'feed }

endp

@turn_opt_parms

endp

@rotary_info

if rot_axis_type eq axis4_radial

machine_plane = YZ

endif

endp

@init_cpos

; gcode = 0

; {nb,'G'gcode ' C'prev_cpos}

; gcode = 50

; {nb,'G'gcode ' C'best_cpos}

endp

@drill_point

endp

@chng_tool_cnext

endp

@move4x_dir

endp

@line4x_dir

endp

@move4x_polar

endp

@line4x_polar

endp

@arc4x_polar

endp

@move4x_cartesian

endp

@line4x_cartesian

if first_line eq 1

{nb,'G1 X'xold, ' C'cpos, ' F'feed}

first_line = 0

endif

gcode = 1

{nb, ['G'gcode]}

; if ben2 and work_type eq ROUGH

; if process_type eq LONG then

; {' X'xpos}

; else

; {' Z'zpos}

; endif

; ben2 = false

; else

{[' X'xpos], [' C'cpos]}

; endif

; if prev_command eq '@turn_proc' then

; change(feed) = TRUE

; endif

{[' F'feed]}

endp

@arc4x_cartesian

if arc_direction eq CCW then

gcode = 3

else ; CW

gcode = 2

endif

{nb, ['G'gcode] [' X'xpos] [' C'cpos]}

; if arc_size >= 180 then

; radius = -radius

; endif

if xcenter_rel ne 0

{' I'xcenter_rel}

endif

if ycenter_rel ne 0

{' J'ycenter_rel}

endif

{[' F'feed]}

endp

@drill4x_polar

endp

@drill4x_cartesian

endp

@call_prms

endp

@tool_path_info

endp

@loop_matrix_info

endp

Я прям чувствую, что-то тут кастрировано, но что никак не вычислю.. конечно сложно делитанту...

Изменено пользователем МегаЯр
Ссылка на сообщение
Поделиться на других сайтах
  • 2 недели спустя...

В постпроцессоре процедуры вывода перемещений (line, arc, move) общие для фрезерных и токарных операций. То есть там надо менять вывод в зависимости от типа перехода. Вот пример из мануала:

@line

gcode = 1

{nb,[‘G’gcode]}

if job_machine_type eq milling

{[‘ X’xpos:coord_f], [‘ Y’ypos],[‘ Z’zpos], [‘ F’feed]}

else ; turning

{[‘ X’xpos], [‘ Z’zpos], [‘ F’feed]}

endif

endp

;-------------------

А этот пост, на мой взгляд, весьма мудрено-специализированный, его придется долго курить. Первое что придумалось - в процедуре @line - условный оператор как-то не так срабатывает и не достигается условие при котором выводится Z. Я считаю, что пост заточен под четырехосевую фрезерную обработку, под которой в Solidcam имеется в виду не что иное как обычный "Wrapping", то есть намотка геометрии на цилиндр, с заменой линейной координаты на угловую.

Тогда не хватает процедуры

@line_4x ; FAN_0TC

gcode = 1

{nb, ['G'gcode],[' X'xpos],[' Z'zpos ],[' C'cpos],[' F'feed]} ; - заметьте, тут нет координаты Y - ее заменяет ось С.

endp

Но я могу ошибаться, страсть как не люблю вот эту вот @line_4x.

Ссылка на сообщение
Поделиться на других сайтах

Присоединяйтесь к обсуждению

Вы можете опубликовать сообщение сейчас, а зарегистрироваться позже. Если у вас есть аккаунт, войдите в него для написания от своего имени.
Примечание: вашему сообщению потребуется утверждение модератора, прежде чем оно станет доступным.

Гость
Ответить в тему...

×   Вставлено в виде отформатированного текста.   Вставить в виде обычного текста

  Разрешено не более 75 эмодзи.

×   Ваша ссылка была автоматически встроена.   Отобразить как ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.

  • Сейчас на странице   0 пользователей

    Нет пользователей, просматривающих эту страницу.




×
×
  • Создать...