Merge pull request #374 from mlampert/tracker-2770
Path: Assign Contour label on restore fixes 2770
This commit is contained in:
commit
c678144272
|
@ -133,7 +133,7 @@ std::string Command::toGCode (void) const
|
||||||
str << Name;
|
str << Name;
|
||||||
for(std::map<std::string,double>::const_iterator i = Parameters.begin(); i != Parameters.end(); ++i) {
|
for(std::map<std::string,double>::const_iterator i = Parameters.begin(); i != Parameters.end(); ++i) {
|
||||||
std::string k = i->first;
|
std::string k = i->first;
|
||||||
std::string v = boost::lexical_cast<std::string>(i->second);
|
std::string v = std::to_string(i->second);
|
||||||
str << " " << k << v;
|
str << " " << k << v;
|
||||||
}
|
}
|
||||||
return str.str();
|
return str.str();
|
||||||
|
|
|
@ -120,9 +120,15 @@ class ObjectContour:
|
||||||
def __setstate__(self, state):
|
def __setstate__(self, state):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def setLabel(self, obj):
|
||||||
|
if not obj.UserLabel:
|
||||||
|
obj.Label = obj.Name + " :" + obj.ToolDescription
|
||||||
|
else:
|
||||||
|
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
|
||||||
|
|
||||||
def onChanged(self, obj, prop):
|
def onChanged(self, obj, prop):
|
||||||
if prop == "UserLabel":
|
if prop == "UserLabel":
|
||||||
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
|
self.setLabel(obj)
|
||||||
|
|
||||||
def setDepths(proxy, obj):
|
def setDepths(proxy, obj):
|
||||||
parentJob = PathUtils.findParentJob(obj)
|
parentJob = PathUtils.findParentJob(obj)
|
||||||
|
@ -231,10 +237,7 @@ class ObjectContour:
|
||||||
obj.ToolNumber = toolLoad.ToolNumber
|
obj.ToolNumber = toolLoad.ToolNumber
|
||||||
obj.ToolDescription = toolLoad.Name
|
obj.ToolDescription = toolLoad.Name
|
||||||
|
|
||||||
if obj.UserLabel == "":
|
self.setLabel(obj)
|
||||||
obj.Label = obj.Name + " :" + obj.ToolDescription
|
|
||||||
else:
|
|
||||||
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
|
|
||||||
|
|
||||||
output += "(" + obj.Label + ")"
|
output += "(" + obj.Label + ")"
|
||||||
if not obj.UseComp:
|
if not obj.UseComp:
|
||||||
|
|
|
@ -58,7 +58,6 @@ class LoadTool():
|
||||||
obj.setEditorMode('Placement', mode)
|
obj.setEditorMode('Placement', mode)
|
||||||
|
|
||||||
def execute(self, obj):
|
def execute(self, obj):
|
||||||
|
|
||||||
tool = PathUtils.getTool(obj, obj.ToolNumber)
|
tool = PathUtils.getTool(obj, obj.ToolNumber)
|
||||||
if tool is not None:
|
if tool is not None:
|
||||||
obj.Label = obj.Name + ": " + tool.Name
|
obj.Label = obj.Name + ": " + tool.Name
|
||||||
|
@ -86,14 +85,12 @@ class LoadTool():
|
||||||
obj.ViewObject.Visibility = True
|
obj.ViewObject.Visibility = True
|
||||||
|
|
||||||
def onChanged(self, obj, prop):
|
def onChanged(self, obj, prop):
|
||||||
mode = 2
|
if prop == "ToolNumber" and not 'Restore' in obj.State:
|
||||||
obj.setEditorMode('Placement', mode)
|
job = PathUtils.findParentJob(obj)
|
||||||
# if prop == "ToolNumber":
|
if job is not None:
|
||||||
job = PathUtils.findParentJob(obj)
|
for g in job.Group:
|
||||||
if job is not None:
|
if not(isinstance(g.Proxy, PathScripts.PathLoadTool.LoadTool)):
|
||||||
for g in job.Group:
|
g.touch()
|
||||||
if not(isinstance(g.Proxy, PathScripts.PathLoadTool.LoadTool)):
|
|
||||||
g.touch()
|
|
||||||
|
|
||||||
|
|
||||||
class _ViewProviderLoadTool:
|
class _ViewProviderLoadTool:
|
||||||
|
|
|
@ -34,9 +34,10 @@ parameters, like e.g. suppress the units in the header and at every hop.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# reload in python console:
|
# reload in python console:
|
||||||
# import maho_post
|
# import generic_post
|
||||||
# reload(maho_post)
|
# reload(generic_post)
|
||||||
|
|
||||||
|
''' example post for Maho M 600E mill'''
|
||||||
import FreeCAD
|
import FreeCAD
|
||||||
import time
|
import time
|
||||||
import Path, PathScripts
|
import Path, PathScripts
|
||||||
|
@ -195,7 +196,11 @@ def mkHeader(selection):
|
||||||
now = time.strftime("%Y-%m-%d %H:%M")
|
now = time.strftime("%Y-%m-%d %H:%M")
|
||||||
originfile = FreeCAD.ActiveDocument.FileName
|
originfile = FreeCAD.ActiveDocument.FileName
|
||||||
headerNoNumber = "%PM\n" # this line gets no linenumber
|
headerNoNumber = "%PM\n" # this line gets no linenumber
|
||||||
headerNoNumber += "N9XXX (" + selection[0].Description + ", " + now + ")\n" # this line gets no linenumber, it is already a specially numbered
|
if hasattr(selection[0],"Description"):
|
||||||
|
description = selection[0].Description
|
||||||
|
else:
|
||||||
|
description = ""
|
||||||
|
headerNoNumber += "N9XXX (" + description + ", " + now + ")\n" # this line gets no linenumber, it is already a specially numbered
|
||||||
header = ""
|
header = ""
|
||||||
# header += "(Output Time:" + str(now) + ")\n"
|
# header += "(Output Time:" + str(now) + ")\n"
|
||||||
header += "(" + originfile + ")\n"
|
header += "(" + originfile + ")\n"
|
||||||
|
@ -304,11 +309,12 @@ def export(selection,filename,argstring):
|
||||||
|
|
||||||
gobjects = []
|
gobjects = []
|
||||||
for g in selection[0].Group:
|
for g in selection[0].Group:
|
||||||
gobjects.append(g)
|
if g.Name <>'Machine': #filtering out gcode home position from Machine object
|
||||||
|
gobjects.append(g)
|
||||||
|
|
||||||
for obj in gobjects:
|
for obj in gobjects:
|
||||||
if hasattr(obj,'GComment'):
|
if hasattr(obj,'Comment'):
|
||||||
gcode += linenumberify('(' + obj.GComment + ')')
|
gcode += linenumberify('(' + obj.Comment + ')')
|
||||||
for c in obj.Path.Commands:
|
for c in obj.Path.Commands:
|
||||||
outstring = []
|
outstring = []
|
||||||
command = c.Name
|
command = c.Name
|
||||||
|
|
Loading…
Reference in New Issue
Block a user