Skip to content

Commit

Permalink
Garys Hack and SFACT all together in a package
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetcemturan committed Aug 1, 2011
1 parent fa63e85 commit 06a7827
Show file tree
Hide file tree
Showing 831 changed files with 83,429 additions and 6 deletions.
Binary file added P-Face_SFACT.rar
Binary file not shown.
Binary file added P-face.ico
Binary file not shown.
146 changes: 146 additions & 0 deletions SkeinforgeQuickEditDialog.py
@@ -0,0 +1,146 @@
#!/usr/bin/env python

from skeinforge.fabmetheus_utilities import archive
from skeinforge.fabmetheus_utilities import settings
from skeinforge.skeinforge_application.skeinforge_utilities import skeinforge_craft
from skeinforge.skeinforge_application.skeinforge_utilities import skeinforge_profile
import os
import wx

class SkeinforgeQuickEditDialog(wx.Dialog):
'''Shows a consise list of important settings from the active Skeinforge profile.'''
def __init__(self, *args, **kwds):
kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER
wx.Dialog.__init__(self, *args, **kwds)
self.okButton = wx.Button(self, wx.ID_OK, "Save")
self.cancelButton = wx.Button(self, wx.ID_CANCEL, "")
self.Bind(wx.EVT_BUTTON, self.OnExit, self.cancelButton)
self.Bind(wx.EVT_BUTTON, self.OnSave, self.okButton)

"""
The following list determines which settings are shown.
The dictionary key is the plugin name and the value is a list of setting names as found in the corresponding .csv file for that plugin.
NOTE: Skeinforge is tightly integrated with Tkinter and there appears to be a dependency which stops radio-button values from being saved.
Perhaps this can be solved, but at the moment this dialog cannot modify radio button values. One will have to use the main Skeinforge application.
"""
self.moduleSettingsMap = {
'dimension':['Filament Diameter (mm):','Retraction Distance (millimeters):', 'Retraction Distance (millimeters):','Extruder Retraction Speed (mm/s):'],
'carve':['Layer Height = Extrusion Thickness (mm):', 'Extrusion Width (mm):'],
'chamber':['Heated PrintBed Temperature (Celcius):', 'Turn print Bed Heater Off at Shut Down', 'Turn Extruder Heater Off at Shut Down'],
'cool':['Activate Cool.. but use with a fan!', 'Use Cool if layer takes shorter than(seconds):'],
'fill':['Activate Fill:', 'Infill Solidity (ratio):', 'Fully filled Layers (each top and bottom):', 'Extra Shells on Sparse Layer (layers):', 'Extra Shells on Alternating Solid Layer (layers):'],
'multiply':['Number of Columns (integer):', 'Number of Rows (integer):'],
'raft':['First Layer Main Feedrate (mm/s):','First Layer Perimeter Feedrate (mm/s):','First Layer Flow Rate Infill(scaler):','First Layer Flow Rate Perimeter(scaler):',],
'speed':['Main Feed Rate (mm/s):','Main Flow Rate (scaler):','Perimeter Feed Rate (mm/s):','Perimeter Flow Rate (scaler):','Travel Feed Rate (mm/s):']
}

self.scrollbarPanel = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
self.settingsSizer = self.getProfileSettings()
self.scrollbarPanel.SetSizer(self.settingsSizer)

self.__set_properties()
self.__do_layout()
self.Show()

def __set_properties(self):
self.profileName = skeinforge_profile.getProfileName(skeinforge_profile.getCraftTypeName())
self.SetTitle("Skeinforge Quick Edit Profile: " + self.profileName)

# For some reason the dialog size is not consistent between Windows and Linux - this is a hack to get it working
if (os.name == 'nt'):
self.SetMinSize(wx.DLG_SZE(self, (465, 370)))
else:
self.SetSize(wx.DLG_SZE(self, (465, 325)))

self.SetPosition((0, 0))
self.scrollbarPanel.SetScrollRate(10, 10)

def __do_layout(self):
mainSizer = wx.BoxSizer(wx.VERTICAL)
actionsSizer = wx.BoxSizer(wx.HORIZONTAL)
mainSizer.Add(self.scrollbarPanel, 1, wx.EXPAND | wx.ALL, 5)
actionsSizer.Add(self.okButton, 0, 0, 0)
actionsSizer.Add(self.cancelButton, 0, wx.LEFT, 10)
mainSizer.Add(actionsSizer, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
self.SetSizer(mainSizer)
self.Layout()

def getProfileSettings(self):
settingsSizer = wx.GridBagSizer(hgap=2, vgap=1)
settingsRow = 0

for craftName in sorted(self.moduleSettingsMap.keys()):

craftStaticBox = wx.StaticBox(self.scrollbarPanel, -1, craftName.capitalize())
craftStaticBoxSizer = wx.StaticBoxSizer(craftStaticBox, wx.VERTICAL)

# For some reason the dialog size is not consistent between Windows and Linux - this is a hack to get it working
if (os.name == 'nt'):
craftStaticBoxSizer.SetMinSize((320, -1))
else:
craftStaticBoxSizer.SetMinSize((450, -1))
pluginModule = archive.getModuleWithPath(os.path.join(skeinforge_craft.getPluginsDirectoryPath(), craftName))
repo = pluginModule.getNewRepository()

for setting in settings.getReadRepository(repo).preferences:
if setting.name in self.moduleSettingsMap[craftName]:

settingSizer = wx.GridBagSizer(hgap=2, vgap=2)
settingSizer.AddGrowableCol(0)
settingRow = 0
settingLabel = wx.StaticText(self.scrollbarPanel, -1, setting.name)
settingLabel.Wrap(400)
settingSizer.Add(settingLabel, pos=(settingRow, 0))

if (isinstance(setting.value, bool)):
checkbox = wx.CheckBox(self.scrollbarPanel)
checkbox.SetName(craftName + '.' + setting.name)
checkbox.SetValue(setting.value)
settingSizer.Add(checkbox, pos=(settingRow, 1))
settingSizer.AddSpacer((25, -1), pos=(settingRow, 2))
else:
textCtrl = wx.TextCtrl(self.scrollbarPanel, value=str(setting.value), size=(50, -1))
textCtrl.SetName(craftName + '.' + setting.name)
settingSizer.Add(textCtrl, pos=(settingRow, 1))

craftStaticBoxSizer.Add(settingSizer, 1, wx.EXPAND, 0)
settingRow += 1
col = settingsRow % 2
settingsSizer.Add(craftStaticBoxSizer, pos=(settingsRow - col, col))
settingsRow += 1

return settingsSizer

def OnExit(self, e):
self.Destroy()

def OnSave(self, e):
for x in self.scrollbarPanel.GetChildren():
if (isinstance(x, (wx.CheckBox, wx.TextCtrl))):
name = x.GetName().partition('.')
craftName = name[0]
settingName = name[2]
pluginModule = archive.getModuleWithPath(os.path.join(skeinforge_craft.getPluginsDirectoryPath(), craftName))
repo = pluginModule.getNewRepository()
isDirty = False
for setting in settings.getReadRepository(repo).preferences:
if setting.name == settingName:
if setting.value == None or str(x.GetValue()) != str(setting.value):
print('Saving ... ' + settingName + ' = ' + str(x.GetValue()))
setting.value = x.GetValue()
isDirty = True
if isDirty:
settings.saveRepository(repo)
print("Skeinforge settings have been saved.")
self.Destroy()

class SkeinforgeQuickEditApp(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
SkeinforgeQuickEditDialog(None, -1, "")
return 1

if __name__ == "__main__":
skeinforgeQuickEditApp = SkeinforgeQuickEditApp(0)
skeinforgeQuickEditApp.MainLoop()
12 changes: 10 additions & 2 deletions gviz.py
Expand Up @@ -2,7 +2,7 @@

class window(wx.Frame):
def __init__(self,f,size=(600,600),bedsize=(200,200)):
wx.Frame.__init__(self,None,title="Layer view (Use arrow keys to switch layers)",size=(size[0],size[1]))
wx.Frame.__init__(self,None,title="Layer view (Use shift+mousewheel to switch layers)",size=(size[0],size[1]))
self.p=gviz(self,size=size,bedsize=bedsize)
s=time.time()
for i in f:
Expand Down Expand Up @@ -126,6 +126,14 @@ def repaint(self):
dc.SelectObject(self.blitmap)
dc.SetBackground(wx.Brush((250,250,200)))
dc.Clear()
dc.SetPen(wx.Pen(wx.Colour(100,100,100)))
for i in xrange(max(self.bedsize)/10):
dc.DrawLine(self.translate[0],self.translate[1]+i*self.scale[1]*10,self.translate[0]+self.scale[0]*max(self.bedsize),self.translate[1]+i*self.scale[1]*10)
dc.DrawLine(self.translate[0]+i*self.scale[0]*10,self.translate[1],self.translate[0]+i*self.scale[0]*10,self.translate[1]+self.scale[1]*max(self.bedsize))
dc.SetPen(wx.Pen(wx.Colour(0,0,0)))
for i in xrange(max(self.bedsize)/50):
dc.DrawLine(self.translate[0],self.translate[1]+i*self.scale[1]*50,self.translate[0]+self.scale[0]*max(self.bedsize),self.translate[1]+i*self.scale[1]*50)
dc.DrawLine(self.translate[0]+i*self.scale[0]*50,self.translate[1],self.translate[0]+i*self.scale[0]*50,self.translate[1]+self.scale[1]*max(self.bedsize))
if not self.showall:
self.size = self.GetSize()
dc.SetBrush(wx.Brush((43,144,255)))
Expand Down Expand Up @@ -201,7 +209,7 @@ def addgcode(self,gcode="M105",hilight=0):

if __name__ == '__main__':
app = wx.App(False)
#main = window(open("/home/kliment/designs/spinner/gearend_export.gcode"))
#main = window(open("/home/kliment/designs/spinner/arm_export.gcode"))
main = window(open("jam.gcode"))
main.Show()
app.MainLoop()
Expand Down
8 changes: 7 additions & 1 deletion plater.py
@@ -1,3 +1,4 @@
#!/usr/bin/env python
import wx,time,random,threading,os,math
import stltool

Expand Down Expand Up @@ -87,6 +88,11 @@ def right(self,event):
self.models[newname].offsets=[0,0,0]
#print time.time()-t
self.l.Append([stlwrap(self.models[newname],newname)])
i=self.l.GetFirstSelected()
if i != -1:
self.l.Select(i,0)

self.l.Select(self.l.GetItemCount()-1)
self.Refresh()
#print time.time()-t

Expand Down Expand Up @@ -125,7 +131,7 @@ def cr(self):
i=self.l.GetFirstSelected()
if i != -1:
o=self.models[self.l.GetItemText(i)].offsets
self.models[self.l.GetItemText(i)]=self.models[self.l.GetItemText(i)].rotate([0,0,self.i-self.previ])
self.models[self.l.GetItemText(i)]=self.models[self.l.GetItemText(i)].rotate([0,0,5*(self.i-self.previ)])
self.models[self.l.GetItemText(i)].offsets=o
self.previ=self.i
wx.CallAfter(self.Refresh)
Expand Down
13 changes: 10 additions & 3 deletions pronterface.py
Expand Up @@ -4,7 +4,7 @@
except:
print "WX is not installed. This program requires WX to run."
raise
import printcore, os, sys, glob, time, threading, traceback, StringIO, gviz, traceback
import printcore, os, sys, glob, time, threading, traceback, StringIO, gviz, traceback, cStringIO
try:
os.chdir(os.path.split(__file__)[0])
except:
Expand Down Expand Up @@ -48,6 +48,7 @@ def __init__(self, filename=None,size=winsize):
self.filename=filename
os.putenv("UBUNTU_MENUPROXY","0")
wx.Frame.__init__(self,None,title="Printer Interface",size=size);
self.SetIcon(wx.Icon("P-face.ico",wx.BITMAP_TYPE_ICO))
self.panel=wx.Panel(self,-1,size=size)
self.statuscheck=False
self.tempreport=""
Expand Down Expand Up @@ -113,7 +114,7 @@ def startcb(self):
self.starttime=time.time()

def endcb(self):
print "Print took "+str(int(time.time()-self.starttime))+" seconds."
print "Print took "+str(int(time.time()-self.starttime)/60)+" minutes."
wx.CallAfter(self.pausebtn.Hide)
wx.CallAfter(self.printbtn.SetLabel,"Print")

Expand Down Expand Up @@ -260,7 +261,13 @@ def popmenu(self):
m = wx.Menu()
self.Bind(wx.EVT_MENU, self.loadfile, m.Append(-1,"&Open..."," Opens file"))
if sys.platform != 'darwin':
self.Bind(wx.EVT_MENU, lambda x:threading.Thread(target=lambda :self.do_skein("set")).start(), m.Append(-1,"Skeinforge settings"," Adjust skeinforge settings"))
self.Bind(wx.EVT_MENU, lambda x:threading.Thread(target=lambda :self.do_skein("set")).start(), m.Append(-1,"SFACT Settings"," Adjust SFACT settings"))
try:
from SkeinforgeQuickEditDialog import SkeinforgeQuickEditDialog
self.Bind(wx.EVT_MENU, lambda *e:SkeinforgeQuickEditDialog(self), m.Append(-1,"SFACT Quick Settings"," Quickly adjust SFACT settings for active profile"))
except:
pass

self.Bind(wx.EVT_MENU, self.OnExit, m.Append(wx.ID_EXIT,"E&xit"," Closes the Window"))
self.menustrip.Append(m,"&Print")
m = wx.Menu()
Expand Down
4 changes: 4 additions & 0 deletions sfact_profiles/profiles/cutting.csv
@@ -0,0 +1,4 @@
Format is tab separated cutting settings.
_Name Value
WindowPosition 0+400
Profile Selection: end_mill
4 changes: 4 additions & 0 deletions sfact_profiles/profiles/extrusion.csv
@@ -0,0 +1,4 @@
Format is tab separated extrusion settings.
_Name Value
WindowPosition 0+400
Profile Selection: PLA
8 changes: 8 additions & 0 deletions sfact_profiles/profiles/extrusion/1.7mm-0.3 nozzle/bottom.csv
@@ -0,0 +1,8 @@
Format is tab separated bottom settings.
_Name Value
WindowPosition 700+0
Open File for Bottom
Activate Bottom... and dont change anything else here!!! True
Additional Height (ratio): 0.5
Altitude (mm): 0.0
SVG Viewer: webbrowser
15 changes: 15 additions & 0 deletions sfact_profiles/profiles/extrusion/1.7mm-0.3 nozzle/carve.csv
@@ -0,0 +1,15 @@
Format is tab separated carve settings.
_Name Value
WindowPosition 700+0
Open File for Carve
Layer Height = Extrusion Thickness (mm): 0.33
Extrusion Width (mm): 0.5
Print from Layer No:: 0
Print up to Layer No: 912345678
Infill in Direction of Bridge True
Correct Mesh True
Unproven Mesh False
SVG Viewer: webbrowser
Add Layer Template to SVG True
Extra Decimal Places (float): 2.0
Import Coarseness (ratio): 1.0
@@ -0,0 +1,8 @@
Format is tab separated chamber settings.
_Name Value
WindowPosition 700+0
Open File for Chamber
Activate Chamber..if you want below functions to work True
Heated PrintBed Temperature (Celcius): 60.0
Turn print Bed Heater Off at Shut Down True
Turn Extruder Heater Off at Shut Down True
@@ -0,0 +1,6 @@
Format is tab separated clairvoyance settings.
_Name Value
WindowPosition 700+0
Activate Clairvoyance False
Open File to Generate Clairvoyances for
Gcode Program: webbrowser
7 changes: 7 additions & 0 deletions sfact_profiles/profiles/extrusion/1.7mm-0.3 nozzle/clip.csv
@@ -0,0 +1,7 @@
Format is tab separated clip settings.
_Name Value
WindowPosition 700+0
Open File for Clip
Activate Clip..to clip the extrusion that overlaps when printing perimeters True
Clip Over Perimeter Width adjuster (decrease for bigger gap): 1.0
Threshold for connecting inner loops (ratio): 2.5
9 changes: 9 additions & 0 deletions sfact_profiles/profiles/extrusion/1.7mm-0.3 nozzle/comb.csv
@@ -0,0 +1,9 @@
Format is tab separated comb settings.
_Name Value
WindowPosition 700+0
Open File for Comb
Activate Comb if you cant stop the extruder stringing by retraction
it will avoid moving over loops so the strings will be there
but not visible anymore.
Comb bends the extruder travel paths around holes in the slices, to avoid stringing.
so any start up ooze will be inside the shape. True
@@ -0,0 +1,5 @@
Format is tab separated comment settings.
_Name Value
WindowPosition 700+0
Activate Comment False
Open File to Write Comments for
15 changes: 15 additions & 0 deletions sfact_profiles/profiles/extrusion/1.7mm-0.3 nozzle/cool.csv
@@ -0,0 +1,15 @@
Format is tab separated cool settings.
_Name Value
WindowPosition 700+0
Open File for Cool
Activate Cool.. but use with a fan! False
Use Cool if layer takes shorter than(seconds): 10.0
Turn Fan On at Beginning True
Turn Fan Off at Ending True
Execute when Cool starts: cool_start.gmc
Execute when Cool ends: cool_end.gmc
Orbiting around Object False
Slow Down during print True
Maximum Cool (Celcius): 2.0
Bridge Cool (Celcius): 1.0
Minimum Orbital Radius (millimeters): 10.0
15 changes: 15 additions & 0 deletions sfact_profiles/profiles/extrusion/1.7mm-0.3 nozzle/dimension.csv
@@ -0,0 +1,15 @@
Format is tab separated dimension settings.
_Name Value
WindowPosition 700+0
Open File for Dimension
Activate Volumetric Extrusion (Stepper driven Extruders) True
Filament Diameter (mm): 1.75
Filament Packing Density (ratio) lower=more extrusion: 1.0
Retraction Distance (millimeters): 1.0
Restart Extra Distance (millimeters): 0.0
Extruder Retraction Speed (mm/s): 15.0
Force to retract when crossing over spaces True
Minimum Extrusion before Retraction (millimeters): 1.0
Minimum Travelmove after Retraction (millimeters): 1.0
in Absolute units (Sprinter, FiveD a.o.) True
in Relative units (Teacup a.o.) False
20 changes: 20 additions & 0 deletions sfact_profiles/profiles/extrusion/1.7mm-0.3 nozzle/export.csv
@@ -0,0 +1,20 @@
Format is tab separated export settings.
_Name Value
WindowPosition 700+0
Open File for Export
Activate Export True
Add _export to filename (filename_export) True
Also Send Output To:
Do Not Delete Comments False
Delete Crafting Comments False
Delete All Comments True
Do Not Change Output False
gcode_small True
File Extension (gcode): gcode
Name of Replace File: replace.csv
Save Penultimate Gcode False
Archive Used Profile As Zip False
Export Profile Values As CSV File False
Add Profile Name to Filename False
Add Description to Filename False
Add Timestamp to Filename False

0 comments on commit 06a7827

Please sign in to comment.