Convert Radius/Arc's R or L to coordinates I,K
Hello!
I'm using SolidCam to generate code for my machines (lathe) and i use default post processor in SolidCam "Okumall" and it work perfectly for most stuff. But there is problem with radius, arc's etc, post processor gererate it as "L", is there any way to set up this to get that "L" in "I and K" coordinates.
Thank you
Re: Convert Radius/Arc's R or L to coordinates I,K
Re: Convert Radius/Arc's R or L to coordinates I,K
GPP code:
"; $Workfile: OKUMALL.GPP $
;
; $Log: S:/CAD_VCS/GPP/OKUMALL.GPV $
;
; Rev 1.1 22 Nov 1992 11:16:54 Rafi
; CAD50
;
; ---------------------------------------------------------------------
;
; okumal
;-----
;
@init_post
global string tool_diameter_f tool_number_f
global LOGICAL save_machine_plane fl
global integer drilld parm1_usd drill_num
global numeric drill_lower_zz drill_upper_zz drill_clearance_zz ffeed hh bb
global numeric fl1 us99 us us1 flag1 xp zp xp1 zp1
global logical finish_pending
global string spin_f xend_f
global numeric m_feed_flag
; Non GPPL variables
num_user_procs = 0
line_labels = TRUE ; Jump to N...
; GPPL variables
numeric_def_f = '5.3(p)'
integer_def_f = '5.0(p)'
gcode_f = '2.0(p)'
mcode_f = '2.0(p)'
xpos_f = '5.3(*2p)'
xend_f = xpos_f
ypos_f = '5.3(p)'
zpos_f = '5.3(p)'
feed_f = '4.3(p)'
tool_diameter_f = '5.3/1'
blknum_f = '5.0(p)'
tool_number_f = 'z2.0(p)'
blknum_gen = true
blknum_exist = TRUE
blknum = 2
blknum_delta = 2
blknum_max = 3200000
gcode_space = TRUE
spin_f = '5.0(p)'
; trace "all":5
; trace "@rapid_move,@line,@arc":1
endp
;-------------------
@start_of_file
; before tools definition
{nl, ''}
{nb,' (', g_file_name, ')'}
flag1 = 0
endp
;-------------------
@start_program
; after tools definition
endp
;-------------------
@end_program
call @rapid_move
endp
;-------------------
@end_of_file
{nb, 'M02'}
{nl, '%'}
endp
;-------------------
@relative_mode
; gcode = 91
; {nb, 'G'gcode, ' '}
; skipline = FALSE
endp
;-------------------
@absolute_mode
; gcode = 90
; {nb, 'G'gcode, ' '}
; skipline = FALSE
endp
;-------------------
@machine_plane
endp
;-------------------
@call_proc
if prev_command eq '@fourth_axis'
fl = false
else
fl = true
endif
endp
;-------------------
@proc
endp
;-------------------
@end_proc
endp
;----------------
@loop
endp
;----------------
@end_loop
endp
;----------------
@def_tool
endp
;-------------------
@rapid_move
gcode = 0
{nb, ['G'gcode]}
{[' X'xpos] , [' Z'zpos]}
endp
;-------------------
@line
gcode = 1
{nb, ['G'gcode]}
{[' X'xpos], [' Z'zpos]}
if prev_command eq '@turn_proc' then
change(feed) = TRUE
endif
if m_feed_flag eq 1
{' F'feed}
m_feed_flag = 0
else
{[' F'feed]}
endif
if flag1 eq 1
{' M8'}
flag1 = 0
endif
xp = xpos
zp = zpos
endp
;-------------------
@arc
xp1 = abs(xp - xpos)
zp1 = abs(zp - zstart)
if xp1 gt 0.002 or zp1 gt 0.002
{nb}
;-- arc plane --
if arc_direction eq CCW then
gcode = 3
else ; CW
gcode = 2
endif
{['G'gcode]}
{[' X'xpos]}
{[' Z'zstart]}
if arc_size eq 360 then
ycenter = -ycenter
{' I'xcenter_rel, ' J'ycenter_rel}
else
if arc_size >= 180 then
radius = -radius
endif
{' L'radius}
endif
if m_feed_flag eq 1
{' F'feed}
m_feed_flag = 0
else
{[' F'feed]}
endif
endif
xp = xpos
zp = zstart
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
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
if fl
if angle eq 13
if fl1 <> 13
gcode = 13
fl1 = 13
{nb ' G'gcode}
endif
else
if fl1 <> 14
gcode = 14
fl1 = 14
{nb ' G'gcode}
endif
endif
endif
endp
;-------------------
@turn_change_tool
bb=tool_ALFA
xpos = xtool
zpos = ztool
call @rapid_move
{nb , 'G50 S',spin_limit}
{nb ,'T'tool_number tool_number tool_number }
if spin_unit eq 0 ; Mm/Sec
{nb ,'G97 '}
else
{nb ,'G96 '}
endif
skipline = false
xpos = xnext
zpos = znext
gcode = 1
call @rapid_move
tool_direction = CCW
; mcode = geer
{' M42'}
call @start_tool
fl = true
flag1 = 1
endp
;-------------------
@message
{nb, '(', message, ')'}
endp
;-------------------
@turn_drill
xpos = 0
zpos = drill_upper_z+safety
call @rapid_move
gcode = 74
if drill_type eq drilling then
down_step = drill_depth+safety+1
endif
if drill_type eq peck then
endif
if first_cut eq 0
first_cut = down_step
endif
{nb 'G'gcode,' X'xpos ' Z'drill_lower_z ' D'down_step ' L'first_cut ' F'feed }
if delay <> 0
{' E'delay }
endif
endp
;-------------------
@drill_point
endp
;-------------------
@mirror
endp
;-------------------
@end_drill
endp
;-------------------
@halt_program
{' M0'}
endp
;--------------------
@round_comp
; NOP
endp
;--------------------
@start_of_job
message = msg
{nb, '(', message, ')'}
endp
;--------------------
@end_of_job
bb=0
endp
;--------------------
@assign_axis
; TBD
endp
; =======================
; USER DEFINED PROCEDURES
; =======================
;-------------------
@start_tool
if tool_direction eq CW then
mcode = 4
else ; CCW
mcode = 3
endif
{' S'spin:integer_def_f, ' M'mcode}
endp
;-------------------
@stop_tool
{' M5'}
endp
;-------------------
@turning
if work_type eq ROUGH then
gcode = 85
{nb,' M8'}
{nb, 'G'gcode, ' NLP'label}
{' D'(2*down_step) }
if rough_offset_x ne 0 then
{' U'rough_offset_x}
endif
if rough_offset_z ne 0 then
{' W'rough_offset_z}
endif
{' F'feed }
endif
if work_type eq COPY then
gcode = 86
{nb,' M8'}
{nb, 'G'gcode, ' NLP'label}
{' D'(2*down_step) }
if rough_offset_x ne 0 then
{' U'rough_offset_x}
endif
if rough_offset_z ne 0 then
{' W'rough_offset_z}
endif
{' F'feed }
endif
if semi_finish then
gcode = 87
{nb,' M8'}
{nb, 'G'gcode, ' NLP'label}
if semi_offset_x ne 0 then
{' U'semi_offset_x}
endif
if semi_offset_z ne 0 then
{' W'semi_offset_z}
endif
endif
if finish then
gcode = 87
{nb,' M8'}
{nb, 'G'gcode, ' NLP'label}
endif
endp
@turn_proc
{nl, 'NLP'label}
if process_type eq LONG
gcode = 81
else
gcode = 82
endif
{' G'gcode}
endp
@turn_endproc
gcode = 80
{nb, 'G'gcode}
{nb,' M9'}
endp
@end_job_procs
endp
@feed_spin
m_feed_flag = 1
if feed_unit eq 0
us99 = 94
us = us+1
us1 = 0
else
us99 = 95
us1 = us1+1
us = 0
endif
if us eq 1
{nb 'G'us99}
endif
if us1 eq 1
{nb 'G'us99}
endif
if change(spin) then
{nb, 'S'spin}
endif
endp
@thread
local numeric taper_angle
taper_angle = ang(last_pos_z-first_pos_z, last_pos_x-first_pos_x)
if taper_angle < 0 then
taper_angle = taper_angle + 180
endif
if is_line then
if work_type eq multiple then
if process_type eq long then
gcode = 71
else
gcode = 72
endif
hh=depth
{nb,'G0 X'((last_pos_x*2)+depth+depth+depth)}
{nb, 'G'gcode, ' X'first_pos_x:xpos_f, ' Z'last_pos_z, ' B'bb}
{' D'down_step:xpos_f, ' U'last_cut:xpos_f}
{' H'depth:xpos_f, ' L'chmf_leng}
if lead_unit eq pitch_inch
{ ' F25.4 J'lead, ' M'm1, ' M'm2, ' M'm3}
else
{ ' F'lead, ' M'm1, ' M'm2, ' M'm3}
endif
else
if process_type eq long then
gcode = 33
else
gcode = 32
endif
{nb, 'G'gcode, ' X'first_pos_x:xpos_f, ' Z'last_pos_z, ' F'lead}
endif
if taper_angle <> 0 then
{' A'(180+taper_angle)}
endif
endif
endp
@groove
if process_type eq long then
gcode = 73
{nb, 'G'gcode, ' X'first_pos_x:xpos_f, ' Z'last_pos_z, ' K'side_step}
{' D'down_step:xpos_f, ' DA'release_dist:xpos_f}
else
gcode = 74
{nb, 'G'gcode, ' X'first_pos_x:xpos_f, ' Z'last_pos_z, ' I'side_step:xpos_f}
{' D'down_step, ' DA'release_dist}
endif
endp
@turn_opt_parms
endp"
i tried to edit this:
";-- arc plane --
if arc_direction eq CCW then
gcode = 3
else ; CW
gcode = 2
endif
{['G'gcode]}
{[' X'xpos]}
{[' Z'zstart]}
if arc_size eq 360 then
ycenter = -ycenter
{' I'xcenter_rel, ' J'ycenter_rel}
else
if arc_size >= 180 then
radius = -radius
endif
{' L'radius}
endif"
to this:
;-- arc plane --
if arc_direction eq CCW then
gcode = 3
else ; CW
gcode = 2
endif
{['G'gcode]}
{[' X'xpos]}
{[' Z'zstart]}
if arc_size >= 0.1 then
ycenter = -ycenter
{' K'xcenter_rel, ' I'ycenter_rel}
endif"
it was close but machine not accept...
does anyone know solution?