Another attempt at getting pocket output to consistently include feedrate
This commit is contained in:
parent
bbb7c83d44
commit
e790963a45
|
@ -26,9 +26,9 @@ import FreeCAD
|
|||
import Path
|
||||
from PySide import QtCore, QtGui
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import PathLoadTool
|
||||
import Draft
|
||||
|
||||
|
||||
FreeCADGui = None
|
||||
|
@ -83,6 +83,8 @@ class ObjectPathJob:
|
|||
obj.addProperty("App::PropertyDistance", "Y_Min", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Minimum distance in X the machine can travel"))
|
||||
obj.addProperty("App::PropertyDistance", "Z_Min", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Minimum distance in X the machine can travel"))
|
||||
|
||||
obj.addProperty("App::PropertyLink", "Base", "Base", "The base object for all operations")
|
||||
|
||||
obj.Proxy = self
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
|
@ -236,6 +238,11 @@ class TaskPanel:
|
|||
self.form.cboPostProcessor.addItem(post)
|
||||
self.updating = False
|
||||
|
||||
self.form.cboBaseObject.addItem("")
|
||||
for o in FreeCAD.ActiveDocument.Objects:
|
||||
if hasattr(o, "Shape"):
|
||||
self.form.cboBaseObject.addItem(o.Name)
|
||||
|
||||
|
||||
def accept(self):
|
||||
self.getFields()
|
||||
|
@ -266,6 +273,12 @@ class TaskPanel:
|
|||
newlist.append(olditem)
|
||||
self.obj.Group = newlist
|
||||
|
||||
objName = self.form.cboBaseObject.currentText()
|
||||
selObj = FreeCAD.ActiveDocument.getObject(objName)
|
||||
if self.form.chkCreateClone.isChecked():
|
||||
selObj = Draft.clone(selObj)
|
||||
self.obj.Base = selObj
|
||||
|
||||
|
||||
self.obj.Proxy.execute(self.obj)
|
||||
|
||||
|
@ -282,6 +295,10 @@ class TaskPanel:
|
|||
for child in self.obj.Group:
|
||||
self.form.PathsList.addItem(child.Name)
|
||||
|
||||
if self.obj.Base is not None:
|
||||
index = self.form.cboBaseObject.findText(self.obj.Base.Name, QtCore.Qt.MatchFixedString)
|
||||
if index >= 0:
|
||||
self.form.cboBaseObject.setCurrentIndex(index)
|
||||
|
||||
|
||||
def open(self):
|
||||
|
@ -303,6 +320,7 @@ class TaskPanel:
|
|||
self.form.leLabel.editingFinished.connect(self.getFields)
|
||||
self.form.btnSelectFile.clicked.connect(self.setFile)
|
||||
self.form.PathsList.indexesMoved.connect(self.getFields)
|
||||
self.form.cboBaseObject.currentIndexChanged.connect(self.getFields)
|
||||
|
||||
self.setFields()
|
||||
|
||||
|
|
|
@ -197,7 +197,6 @@ class ObjectPocket:
|
|||
PathAreaUtils.flush_nc()
|
||||
PathAreaUtils.output('mem')
|
||||
PathAreaUtils.feedrate_hv(self.horizFeed, self.vertFeed)
|
||||
|
||||
if obj.UseStartPoint:
|
||||
start_point = (obj.StartPoint.x, obj.StartPoint.y)
|
||||
|
||||
|
@ -216,7 +215,6 @@ class ObjectPocket:
|
|||
zig_unidirectional,
|
||||
start_point,
|
||||
cut_mode)
|
||||
|
||||
return PathAreaUtils.retrieve_gcode()
|
||||
|
||||
def buildpathocc(self, obj, shape):
|
||||
|
@ -237,9 +235,7 @@ class ObjectPocket:
|
|||
offsets = []
|
||||
nextradius = self.radius + extraoffset
|
||||
result = DraftGeomUtils.pocket2d(shape, nextradius)
|
||||
print "did we get something: " + str(result)
|
||||
while result:
|
||||
print "Adding " + str(len(result)) + " wires"
|
||||
offsets.extend(result)
|
||||
nextradius += (self.radius * 2) * (float(obj.StepOver)/100)
|
||||
result = DraftGeomUtils.pocket2d(shape, nextradius)
|
||||
|
@ -328,7 +324,7 @@ class ObjectPocket:
|
|||
first = False
|
||||
# then move slow down to our starting point for our profile
|
||||
last = edge.Vertexes[0].Point
|
||||
output += "G1 X" + fmt(last.x) + " Y" + fmt(last.y) + " Z" + fmt(vpos) + "\n"
|
||||
output += "G1 X" + fmt(last.x) + " Y" + fmt(last.y) + " Z" + fmt(vpos) + " F" + fmt(self.vertFeed) + "\n"
|
||||
if DraftGeomUtils.geomType(edge) == "Circle":
|
||||
point = edge.Vertexes[-1].Point
|
||||
if point == last: # edges can come flipped
|
||||
|
@ -342,14 +338,14 @@ class ObjectPocket:
|
|||
else:
|
||||
output += "G3"
|
||||
output += " X" + fmt(point.x) + " Y" + fmt(point.y) + " Z" + fmt(vpos)
|
||||
output += " I" + fmt(relcenter.x) + " J" + fmt(relcenter.y) + " K" + fmt(relcenter.z)
|
||||
output += " I" + fmt(relcenter.x) + " J" + fmt(relcenter.y) + " K" + fmt(relcenter.z) + " F" + fmt(self.horizFeed)
|
||||
output += "\n"
|
||||
last = point
|
||||
else:
|
||||
point = edge.Vertexes[-1].Point
|
||||
if point == last: # edges can come flipped
|
||||
point = edge.Vertexes[0].Point
|
||||
output += "G1 X" + fmt(point.x) + " Y" + fmt(point.y) + " Z" + fmt(vpos) + "\n"
|
||||
output += "G1 X" + fmt(point.x) + " Y" + fmt(point.y) + " Z" + fmt(vpos) + " F" + fmt(self.horizFeed) + "\n"
|
||||
last = point
|
||||
|
||||
# move back up
|
||||
|
@ -387,18 +383,14 @@ class ObjectPocket:
|
|||
if obj.Base:
|
||||
for b in obj.Base:
|
||||
for sub in b[1]:
|
||||
print "object base: " + str(b)
|
||||
import Part
|
||||
import PathScripts.PathKurveUtils
|
||||
if "Face" in sub:
|
||||
print "inside"
|
||||
shape = getattr(b[0].Shape, sub)
|
||||
wire = shape.OuterWire
|
||||
edges = wire.Edges
|
||||
else:
|
||||
print "in else"
|
||||
edges = [getattr(b[0].Shape, sub) for sub in b[1]]
|
||||
print "myedges: " + str(edges)
|
||||
wire = Part.Wire(edges)
|
||||
shape = None
|
||||
|
||||
|
@ -490,7 +482,11 @@ class CommandPathPocket:
|
|||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("PathPocket", "Creates a Path Pocket object from a face or faces")}
|
||||
|
||||
def IsActive(self):
|
||||
return FreeCAD.ActiveDocument is not None
|
||||
if FreeCAD.ActiveDocument is not None:
|
||||
for o in FreeCAD.ActiveDocument.Objects:
|
||||
if o.Name[:3] == "Job":
|
||||
return True
|
||||
return False
|
||||
|
||||
def Activated(self):
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class Creator(nc.Creator):
|
|||
self.a = 0
|
||||
self.b = 0
|
||||
self.c = 0
|
||||
self.f = Address('F', fmt = Format(number_of_decimal_places = 2))
|
||||
self.f = Address('F', fmt = Format(number_of_decimal_places = 2), modal = False)
|
||||
self.fh = None
|
||||
self.fv = None
|
||||
self.fhv = False
|
||||
|
|
Loading…
Reference in New Issue
Block a user