Skip to content

Commit

Permalink
plasmac2: add materials to conversational preview
Browse files Browse the repository at this point in the history
  • Loading branch information
phillc54 committed Mar 16, 2024
1 parent 080aaa8 commit c973f5b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
37 changes: 33 additions & 4 deletions configs/sim/axis/plasma/plasmac2/plasmac2.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,10 +683,11 @@ def conv_toggle(state, convSent=False):
unitsPerMm, comp, PREF, getPrefs, putPrefs, open_file_guts, \
wcs_rotation, conv_toggle, color_change, plasmacPopUp)
convFirstRun = False
set_conv_preview()
# set_conv_preview()
if loaded_file:
COPY(loaded_file, preConvFile)
CONV.start(materialFileDict, matIndex, vars.taskfile.get(), s.g5x_index, commands.set_view_z)
set_conv_preview()
keyboard_bindings(False)
vkbData['required'] = True
vkb_show('numpad')
Expand Down Expand Up @@ -726,7 +727,8 @@ def clear_program():
t.configure(state='disabled')

def set_conv_preview():
global convViewOptions
''' configure the preview for conversational '''
global convViewOptions, joint_dro_format_old , dro_format_old
convViewOptions['alpha'] = vars.program_alpha.get()
convViewOptions['dtg'] = vars.show_distance_to_go.get()
convViewOptions['extents'] = vars.show_extents.get()
Expand All @@ -749,10 +751,16 @@ def set_conv_preview():
vars.show_tool.set(False)
o.cone_basesize = .025
o.show_small_origin = False
o.enable_dro = False
o.hide_icons = True
o.set_view_z()
joint_dro_format_old = o.joint_dro_format
o.joint_dro_format = joint_dro_format_new
dro_format_old = o.dro_format
o.dro_format = dro_format_new


def reset_conv_preview():
''' configure the preview for gcode file '''
global convViewOptions
vars.program_alpha.set(convViewOptions['alpha'])
vars.show_distance_to_go.set(convViewOptions['dtg'])
Expand All @@ -765,7 +773,27 @@ def reset_conv_preview():
vars.show_tool.set(convViewOptions['tool'])
o.cone_basesize = convViewOptions['cone']
o.show_small_origin = convViewOptions['origin']
o.enable_dro = True
o.joint_dro_format = joint_dro_format_old
o.dro_format = dro_format_old
o.hide_icons = False

def joint_dro_format_new(s,spd,num_of_joints,limit, homed):
''' replace dro with selected material '''
text = conv_material_text()
return limit, homed, text, text

def dro_format_new(s,spd,dtg,limit,homed,positions,axisdtg,g5x_offset,g92_offset,tlo_offset):
''' replace dro with selected material '''
text = conv_material_text()
return limit, homed, text, text

def conv_material_text():
''' return a list of material parameters to display '''
res = 3 if s.linear_units != 1 else 2
text = f"Cut Speed={materialFileDict[int(CONV.matCombo.get().split(':')[0])]['cut_speed']:.0f}"
text += f" Cut Height={materialFileDict[int(CONV.matCombo.get().split(':')[0])]['cut_height']:.{res}f}"
text += f" Kerf Width={materialFileDict[int(CONV.matCombo.get().split(':')[0])]['kerf_width']:.{res}f}"
return [text]

def hide_default():
rE('grid forget .pane')
Expand Down Expand Up @@ -6131,3 +6159,4 @@ def user_live_update():
# run users custom periodic commands if it exists
if os.path.isfile(upFile):
exec(open(upFile).read())
o.tkRedraw()
4 changes: 4 additions & 0 deletions lib/python/rs274/glcanon.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ def __init__(self, s=None, lp=None, g=None):
self.show_small_origin = True
self.foam_w_height = 1.5
self.foam_z_height = 0
self.hide_icons = False

try:
system_memory_bytes = os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')
Expand Down Expand Up @@ -1211,6 +1212,9 @@ def idx_for_home_or_limit_icon(self,string):
# or limit conditions are displayed using
# allhomedicon and somelimiticon

if self.hide_icons:
return -1 # no icon display

# special case for extra joints after homing:
# allow display of individual joint limit icons
if ( (not self.get_joints_mode())
Expand Down

0 comments on commit c973f5b

Please sign in to comment.