self.lastAddr = -1\r
self.progressCallback = None\r
\r
- def connect(self, port = 'COM17', speed = 115200):\r
+ def connect(self, port = 'COM22', speed = 115200):\r
if self.serial != None:\r
self.close()\r
try:\r
\r
def main():\r
programmer = Stk500v2()\r
- programmer.connect()\r
- programmer.programChip(intelHex.readHex(sys.argv[1]))\r
+ programmer.connect(port = sys.argv[1])\r
+ programmer.programChip(intelHex.readHex(sys.argv[2]))\r
sys.exit(1)\r
\r
if __name__ == '__main__':\r
glDisableClientState(GL_VERTEX_ARRAY)\r
glDisableClientState(GL_NORMAL_ARRAY);\r
\r
+def DrawMeshSteep(mesh, angle):\r
+ cosAngle = math.sin(angle / 180.0 * math.pi)\r
+ glDisable(GL_LIGHTING)\r
+ glDepthFunc(GL_EQUAL)\r
+ for i in xrange(0, int(mesh.vertexCount), 3):\r
+ if mesh.normal[i][2] < -0.999999:\r
+ if mesh.vertexes[i+0][2] > 0.01:\r
+ glColor3f(0.5,0,0)\r
+ glBegin(GL_TRIANGLES)\r
+ glVertex3f(mesh.vertexes[i+0][0], mesh.vertexes[i+0][1], mesh.vertexes[i+0][2])\r
+ glVertex3f(mesh.vertexes[i+1][0], mesh.vertexes[i+1][1], mesh.vertexes[i+1][2])\r
+ glVertex3f(mesh.vertexes[i+2][0], mesh.vertexes[i+2][1], mesh.vertexes[i+2][2])\r
+ glEnd()\r
+ elif mesh.normal[i][2] < -cosAngle:\r
+ glColor3f(-mesh.normal[i][2],0,0)\r
+ glBegin(GL_TRIANGLES)\r
+ glVertex3f(mesh.vertexes[i+0][0], mesh.vertexes[i+0][1], mesh.vertexes[i+0][2])\r
+ glVertex3f(mesh.vertexes[i+1][0], mesh.vertexes[i+1][1], mesh.vertexes[i+1][2])\r
+ glVertex3f(mesh.vertexes[i+2][0], mesh.vertexes[i+2][1], mesh.vertexes[i+2][2])\r
+ glEnd()\r
+ elif mesh.normal[i][2] > 0.999999:\r
+ if mesh.vertexes[i+0][2] > 0.01:\r
+ glColor3f(0.5,0,0)\r
+ glBegin(GL_TRIANGLES)\r
+ glVertex3f(mesh.vertexes[i+0][0], mesh.vertexes[i+0][1], mesh.vertexes[i+0][2])\r
+ glVertex3f(mesh.vertexes[i+2][0], mesh.vertexes[i+2][1], mesh.vertexes[i+2][2])\r
+ glVertex3f(mesh.vertexes[i+1][0], mesh.vertexes[i+1][1], mesh.vertexes[i+1][2])\r
+ glEnd()\r
+ elif mesh.normal[i][2] > cosAngle:\r
+ glColor3f(mesh.normal[i][2],0,0)\r
+ glBegin(GL_TRIANGLES)\r
+ glVertex3f(mesh.vertexes[i+0][0], mesh.vertexes[i+0][1], mesh.vertexes[i+0][2])\r
+ glVertex3f(mesh.vertexes[i+2][0], mesh.vertexes[i+2][1], mesh.vertexes[i+2][2])\r
+ glVertex3f(mesh.vertexes[i+1][0], mesh.vertexes[i+1][1], mesh.vertexes[i+1][2])\r
+ glEnd()\r
+ glDepthFunc(GL_LESS)\r
+\r
def DrawGCodeLayer(layer):\r
filamentRadius = profile.getProfileSettingFloat('filament_diameter') / 2\r
filamentArea = math.pi * filamentRadius * filamentRadius\r
from wx.lib import scrolledpanel
from util import profile
+from util import exporer
class pluginPanel(wx.Panel):
def __init__(self, parent):
self.listbox = wx.ListBox(self, -1, choices=effectStringList)
title = wx.StaticText(self, -1, "Plugins:")
title.SetFont(wx.Font(wx.SystemSettings.GetFont(wx.SYS_ANSI_VAR_FONT).GetPointSize(), wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD))
+ helpButton = wx.Button(self, -1, '?', style=wx.BU_EXACTFIT)
addButton = wx.Button(self, -1, '>', style=wx.BU_EXACTFIT)
+ openPluginLocationButton = wx.Button(self, -1, 'Open plugin location')
sb = wx.StaticBox(self, label="Enabled plugins")
boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
self.pluginEnabledPanel = scrolledpanel.ScrolledPanel(self)
self.pluginEnabledPanel.SetupScrolling(False, True)
sizer.Add(title, (0,0), border=10, flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.TOP)
- sizer.Add(self.listbox, (1,0), span=(2,1), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM)
- sizer.Add(addButton, (1,1), border=5, flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_BOTTOM)
- sizer.Add(boxsizer, (1,2), span=(2,1), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM)
+ sizer.Add(helpButton, (0,1), border=10, flag=wx.ALIGN_RIGHT|wx.RIGHT|wx.TOP)
+ sizer.Add(self.listbox, (1,0), span=(2,2), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT)
+ sizer.Add(addButton, (1,2), border=5, flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_BOTTOM)
+ sizer.Add(boxsizer, (1,3), span=(2,1), border=10, flag=wx.EXPAND|wx.LEFT|wx.RIGHT)
+ sizer.Add(openPluginLocationButton, (3, 0), span=(1,2), border=10, flag=wx.LEFT|wx.BOTTOM)
boxsizer.Add(self.pluginEnabledPanel, 1, flag=wx.EXPAND)
- sizer.AddGrowableCol(2)
+ sizer.AddGrowableCol(3)
sizer.AddGrowableRow(1)
sizer.AddGrowableRow(2)
self.pluginEnabledPanel.SetSizer(sizer)
self.Bind(wx.EVT_BUTTON, self.OnAdd, addButton)
+ self.Bind(wx.EVT_BUTTON, self.OnGeneralHelp, helpButton)
+ self.Bind(wx.EVT_BUTTON, self.OnOpenPluginLocation, openPluginLocationButton)
self.listbox.Bind(wx.EVT_LEFT_DCLICK, self.OnAdd)
self.panelList = []
self.updateProfileToControls()
fname = fname[0].upper() + fname[1:]
fname = fname[:fname.rfind('.')]
webbrowser.open('http://wiki.ultimaker.com/CuraPlugin:_' + fname)
+
+ def OnGeneralHelp(self, e):
+ webbrowser.open('http://wiki.ultimaker.com/Category:CuraPlugin')
+
+ def OnOpenPluginLocation(self, e):
+ exporer.openExporerPath(profile.getPluginBasePaths()[0])
self.toolbar.AddSeparator()\r
\r
self.showBorderButton = toolbarUtil.ToggleButton(self.toolbar, '', 'view-border-on.png', 'view-border-off.png', 'Show model borders', callback=self.OnViewChange)\r
+ self.showSteepOverhang = toolbarUtil.ToggleButton(self.toolbar, '', 'view-border-on.png', 'view-border-off.png', 'Show steep overhang', callback=self.OnViewChange)\r
self.toolbar.AddSeparator()\r
\r
group = []\r
profile.putProfileSetting('model_scale', scale)\r
self.glCanvas.Refresh()\r
\r
- def OnScaleMax(self, e):\r
+ def OnScaleMax(self, e = None, onlyScaleDown = False):\r
if self.objectsMinV == None:\r
return\r
vMin = self.objectsMinV\r
vMax = self.objectsMaxV\r
- scaleX1 = (self.machineSize.x - self.machineCenter.x) / ((vMax[0] - vMin[0]) / 2)\r
- scaleY1 = (self.machineSize.y - self.machineCenter.y) / ((vMax[1] - vMin[1]) / 2)\r
- scaleX2 = (self.machineCenter.x) / ((vMax[0] - vMin[0]) / 2)\r
- scaleY2 = (self.machineCenter.y) / ((vMax[1] - vMin[1]) / 2)\r
+ skirtSize = 3\r
+ if profile.getProfileSettingFloat('skirt_line_count') > 0:\r
+ skirtSize = 3 + profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap')\r
+ scaleX1 = (self.machineSize.x - self.machineCenter.x - skirtSize) / ((vMax[0] - vMin[0]) / 2)\r
+ scaleY1 = (self.machineSize.y - self.machineCenter.y - skirtSize) / ((vMax[1] - vMin[1]) / 2)\r
+ scaleX2 = (self.machineCenter.x - skirtSize) / ((vMax[0] - vMin[0]) / 2)\r
+ scaleY2 = (self.machineCenter.y - skirtSize) / ((vMax[1] - vMin[1]) / 2)\r
scaleZ = self.machineSize.z / (vMax[2] - vMin[2])\r
scale = min(scaleX1, scaleY1, scaleX2, scaleY2, scaleZ)\r
+ if scale > 1.0 and onlyScaleDown:\r
+ return\r
self.scale.SetValue(str(scale))\r
profile.putProfileSetting('model_scale', self.scale.GetValue())\r
self.glCanvas.Refresh()\r
self.loadThread.start()\r
\r
if showWarning:\r
- if profile.getProfileSettingFloat('model_scale') != 1.0 or profile.getProfileSettingFloat('model_rotate_base') != 0 or profile.getProfileSetting('flip_x') != 'False' or profile.getProfileSetting('flip_y') != 'False' or profile.getProfileSetting('flip_z') != 'False' or profile.getProfileSetting('swap_xz') != 'False' or profile.getProfileSetting('swap_yz') != 'False':\r
- self.ShowWarningPopup('Reset scale, rotation and mirror?', self.OnResetAll)\r
+ if profile.getProfileSettingFloat('model_scale') != 1.0 or profile.getProfileSettingFloat('model_rotate_base') != 0 or profile.getProfileSetting('flip_x') != 'False' or profile.getProfileSetting('flip_y') != 'False' or profile.getProfileSetting('flip_z') != 'False' or profile.getProfileSetting('swap_xz') != 'False' or profile.getProfileSetting('swap_yz') != 'False' or len(profile.getPluginConfig()) > 0:\r
+ self.ShowWarningPopup('Reset scale, rotation, mirror and plugins?', self.OnResetAll)\r
\r
def loadReModelFiles(self, filelist):\r
#Only load this again if the filename matches the file we have already loaded (for auto loading GCode after slicing)\r
self.updateModelTransform()\r
scale = profile.getProfileSettingFloat('model_scale')\r
size = (self.objectsMaxV - self.objectsMinV) * scale\r
- if size[0] > self.machineSize.x or size[1] > self.machineSize.y or size[2] > self.machineSize.z:\r
- self.OnScaleMax(None)\r
+ self.OnScaleMax(None, True)\r
self.glCanvas.zoom = numpy.max(size) * 2.5\r
self.errorList = []\r
wx.CallAfter(self.updateToolbar)\r
profile.putProfileSetting('flip_z', 'False')\r
profile.putProfileSetting('swap_xz', 'False')\r
profile.putProfileSetting('swap_yz', 'False')\r
- self.updateProfileToControls()\r
+ profile.setPluginConfig([])\r
+ self.GetParent().updateProfileToControls()\r
\r
def ShowWarningPopup(self, text, callback = None):\r
self.warningPopup.text.SetLabel(text)\r
elif self.mixedViewButton.GetValue():\r
self.glCanvas.viewMode = "Mixed"\r
self.glCanvas.drawBorders = self.showBorderButton.GetValue()\r
+ self.glCanvas.drawSteepOverhang = self.showSteepOverhang.GetValue()\r
self.updateToolbar()\r
self.glCanvas.Refresh()\r
\r
if obj.mesh == None:\r
continue\r
if obj.displayList == None:\r
- obj.displayList = glGenLists(1);\r
+ obj.displayList = glGenLists(1)\r
+ obj.steepDisplayList = glGenLists(1)\r
if obj.dirty:\r
obj.dirty = False\r
glNewList(obj.displayList, GL_COMPILE)\r
opengl.DrawMesh(obj.mesh)\r
glEndList()\r
+ glNewList(obj.steepDisplayList, GL_COMPILE)\r
+ opengl.DrawMeshSteep(obj.mesh, 60)\r
+ glEndList()\r
\r
if self.viewMode == "Mixed":\r
glDisable(GL_BLEND)\r
glScalef(modelScale, modelScale, modelScale)\r
opengl.DrawMeshOutline(obj.mesh)\r
glPopMatrix()\r
+ \r
+ if self.drawSteepOverhang:\r
+ glDisable(GL_LIGHTING)\r
+ glColor3f(1,1,1)\r
+ glPushMatrix()\r
+ modelScale = profile.getProfileSettingFloat('model_scale')\r
+ glScalef(modelScale, modelScale, modelScale)\r
+ glCallList(obj.steepDisplayList)\r
+ glPopMatrix()\r
\r
glPopMatrix() \r
if self.viewMode == "Normal" or self.viewMode == "Transparent" or self.viewMode == "X-Ray":\r
type = self.powerManagement.get_providing_power_source_type()\r
if type == power.POWER_TYPE_AC and self.powerWarningText.IsShown():\r
self.powerWarningText.Hide()\r
+ self.panel.Layout()\r
self.Layout()\r
elif type != power.POWER_TYPE_AC and not self.powerWarningText.IsShown():\r
self.powerWarningText.Show()\r
+ self.panel.Layout()\r
self.Layout()\r
\r
def LoadGCodeFile(self, filename):\r
elif os.path.isfile('/usr/bin/dolphin'):
subprocess.Popen(['/usr/bin/dolphin', os.path.split(filename)[0]])
+def openExporerPath(filename):
+ if sys.platform == 'win32' or sys.platform == 'cygwin':
+ subprocess.Popen(r'explorer "%s"' % (filename))
+ if sys.platform == 'darwin':
+ subprocess.Popen(['open', filename])
+ if sys.platform.startswith('linux'):
+ if os.path.isfile('/usr/bin/nautilus'):
+ subprocess.Popen(['/usr/bin/nautilus', filename])
+ elif os.path.isfile('/usr/bin/dolphin'):
+ subprocess.Popen(['/usr/bin/dolphin', filename])
+
putProfileSetting('plugin_config', pickle.dumps(config))\r
\r
def getPluginBasePaths():\r
- ret = [os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'plugins'))]\r
+ ret = []\r
if platform.system() != "Windows":\r
ret.append(os.path.expanduser('~/.cura/plugins/'))\r
+ ret.append(os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'plugins')))\r
return ret\r
\r
def getPluginList():\r