remove old/deprecated rest machining code
This commit is contained in:
@@ -497,37 +497,6 @@ void Area::add(const TopoDS_Shape& shape, short op) {
|
||||
myShapes.emplace_back(op, shape);
|
||||
}
|
||||
|
||||
std::shared_ptr<Area> Area::getClearedArea(double tipDiameter, double diameter) {
|
||||
build();
|
||||
#define AREA_MY(_param) myParams.PARAM_FNAME(_param)
|
||||
PARAM_ENUM_CONVERT(AREA_MY, PARAM_FNAME, PARAM_ENUM_EXCEPT, AREA_PARAMS_OFFSET_CONF);
|
||||
PARAM_ENUM_CONVERT(AREA_MY, PARAM_FNAME, PARAM_ENUM_EXCEPT, AREA_PARAMS_CLIPPER_FILL);
|
||||
(void)SubjectFill;
|
||||
(void)ClipFill;
|
||||
|
||||
// Do not fit arcs after these offsets; it introduces unnecessary approximation error, and all off
|
||||
// those arcs will be converted back to segments again for clipper differencing in getRestArea anyway
|
||||
CAreaConfig conf(myParams, /*no_fit_arcs*/ true);
|
||||
|
||||
const double roundPrecision = myParams.Accuracy;
|
||||
const double buffer = 2 * roundPrecision;
|
||||
|
||||
// A = myArea
|
||||
// prevCenters = offset(A, -rTip)
|
||||
const double rTip = tipDiameter / 2.;
|
||||
CArea prevCenter(*myArea);
|
||||
prevCenter.OffsetWithClipper(-rTip, JoinType, EndType, myParams.MiterLimit, roundPrecision);
|
||||
|
||||
// prevCleared = offset(prevCenter, r).
|
||||
CArea prevCleared(prevCenter);
|
||||
prevCleared.OffsetWithClipper(diameter / 2. + buffer, JoinType, EndType, myParams.MiterLimit, roundPrecision);
|
||||
|
||||
std::shared_ptr<Area> clearedArea = make_shared<Area>(*this);
|
||||
clearedArea->myArea.reset(new CArea(prevCleared));
|
||||
|
||||
return clearedArea;
|
||||
}
|
||||
|
||||
class ClearedAreaSegmentVisitor : public PathSegmentVisitor
|
||||
{
|
||||
private:
|
||||
@@ -715,6 +684,7 @@ std::shared_ptr<Area> Area::getClearedAreaFromPath(const Toolpath *path, double
|
||||
|
||||
std::shared_ptr<Area> Area::getRestArea(std::vector<std::shared_ptr<Area>> clearedAreas, double diameter) {
|
||||
build();
|
||||
#define AREA_MY(_param) myParams.PARAM_FNAME(_param)
|
||||
PARAM_ENUM_CONVERT(AREA_MY, PARAM_FNAME, PARAM_ENUM_EXCEPT, AREA_PARAMS_OFFSET_CONF);
|
||||
PARAM_ENUM_CONVERT(AREA_MY, PARAM_FNAME, PARAM_ENUM_EXCEPT, AREA_PARAMS_CLIPPER_FILL);
|
||||
|
||||
|
||||
@@ -242,7 +242,6 @@ public:
|
||||
const std::vector<double>& heights = std::vector<double>(),
|
||||
const TopoDS_Shape& plane = TopoDS_Shape());
|
||||
|
||||
std::shared_ptr<Area> getClearedArea(double tipDiameter, double diameter);
|
||||
std::shared_ptr<Area> getClearedAreaFromPath(const Toolpath *path, double diameter, double zmax);
|
||||
std::shared_ptr<Area> getRestArea(std::vector<std::shared_ptr<Area>> clearedAreas, double diameter);
|
||||
TopoDS_Shape toTopoShape();
|
||||
|
||||
@@ -62,11 +62,6 @@ same algorithm</UserDocu>
|
||||
<UserDocu></UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getClearedArea">
|
||||
<Documentation>
|
||||
<UserDocu></UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getClearedAreaFromPath">
|
||||
<Documentation>
|
||||
<UserDocu></UserDocu>
|
||||
|
||||
@@ -148,11 +148,6 @@ static const PyMethodDef areaOverrides[] = {
|
||||
"\n* plane (None): optional shape to specify a section plane. If not give, the current workplane\n"
|
||||
"of this Area is used if section mode is 'Workplane'.",
|
||||
},
|
||||
{
|
||||
"getClearedArea",nullptr,0,
|
||||
"getClearedArea(tipDiameter, diameter):\n"
|
||||
"Gets the area cleared when a tool maximally clears this area. This method assumes a tool tip diameter 'tipDiameter' traces the full area, and that (perhaps at a different height on the tool) this clears a different region with tool diameter 'diameter'.\n",
|
||||
},
|
||||
{
|
||||
"getClearedAreaFromPath",nullptr,0,
|
||||
"getClearedAreaFromPath(path, diameter, zmax):\n"
|
||||
@@ -409,18 +404,6 @@ PyObject* AreaPy::makeSections(PyObject *args, PyObject *keywds)
|
||||
} PY_CATCH_OCC
|
||||
}
|
||||
|
||||
PyObject* AreaPy::getClearedArea(PyObject *args)
|
||||
{
|
||||
PY_TRY {
|
||||
double tipDiameter, diameter;
|
||||
if (!PyArg_ParseTuple(args, "dd", &tipDiameter, &diameter))
|
||||
return nullptr;
|
||||
std::shared_ptr<Area> clearedArea = getAreaPtr()->getClearedArea(tipDiameter, diameter);
|
||||
auto pyClearedArea = Py::asObject(new AreaPy(new Area(*clearedArea, true)));
|
||||
return Py::new_reference_to(pyClearedArea);
|
||||
} PY_CATCH_OCC
|
||||
}
|
||||
|
||||
PyObject* AreaPy::getClearedAreaFromPath(PyObject *args)
|
||||
{
|
||||
PY_TRY {
|
||||
|
||||
@@ -240,39 +240,9 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
# Rest machining
|
||||
self.sectionShapes = self.sectionShapes + [section.toTopoShape() for section in sections]
|
||||
if hasattr(obj, "UseRestMachining") and obj.UseRestMachining:
|
||||
# Loop through prior operations
|
||||
clearedAreas = []
|
||||
foundSelf = False
|
||||
for op in self.job.Operations.Group:
|
||||
if foundSelf:
|
||||
break
|
||||
oplist = [op] + op.OutListRecursive
|
||||
oplist = list(filter(lambda op: hasattr(op, "Active"), oplist))
|
||||
for op in oplist:
|
||||
if op.Proxy == self:
|
||||
# Ignore self, and all later operations
|
||||
foundSelf = True
|
||||
break
|
||||
if hasattr(op, "RestMachiningRegions") and op.Active:
|
||||
if hasattr(op, "RestMachiningRegionsNeedRecompute") and op.RestMachiningRegionsNeedRecompute:
|
||||
Path.Log.warning(
|
||||
translate("PathAreaOp", "Previous operation %s is required for rest machining, but it has no stored rest machining metadata. Recomputing to generate this metadata...") % op.Label
|
||||
)
|
||||
op.recompute()
|
||||
|
||||
tool = op.Proxy.tool if hasattr(op.Proxy, "tool") else op.ToolController.Proxy.getTool(op.ToolController)
|
||||
diameter = tool.Diameter.getValueAs("mm")
|
||||
def shapeToArea(shape):
|
||||
area = Path.Area()
|
||||
area.setPlane(PathUtils.makeWorkplane(shape))
|
||||
area.add(shape)
|
||||
return area
|
||||
opClearedAreas = [shapeToArea(pa).getClearedArea(diameter, diameter) for pa in op.RestMachiningRegions.SubShapes]
|
||||
clearedAreas.extend(opClearedAreas)
|
||||
restSections = []
|
||||
for section in sections:
|
||||
z = section.getShape().BoundBox.ZMin
|
||||
# sectionClearedAreas = [a for a in clearedAreas if a.getShape().BoundBox.ZMax <= z]
|
||||
sectionClearedAreas = []
|
||||
for op in self.job.Operations.Group:
|
||||
print(op.Name)
|
||||
@@ -497,10 +467,6 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
)
|
||||
)
|
||||
|
||||
if hasattr(obj, "RestMachiningRegions"):
|
||||
obj.RestMachiningRegions = Part.makeCompound(self.sectionShapes)
|
||||
if hasattr(obj, "RestMachiningRegionsNeedRecompute"):
|
||||
obj.RestMachiningRegionsNeedRecompute = False
|
||||
Path.Log.debug("obj.Name: " + str(obj.Name) + "\n\n")
|
||||
return sims
|
||||
|
||||
|
||||
@@ -194,16 +194,6 @@ class ObjectPocket(PathAreaOp.ObjectOp):
|
||||
"Skips machining regions that have already been cleared by previous operations.",
|
||||
),
|
||||
)
|
||||
obj.addProperty(
|
||||
"Part::PropertyPartShape",
|
||||
"RestMachiningRegions",
|
||||
"Pocket",
|
||||
QT_TRANSLATE_NOOP(
|
||||
"App::Property",
|
||||
"The areas cleared by this operation, one area per height, stored as a compound part. Used internally for rest machining.",
|
||||
),
|
||||
)
|
||||
obj.setEditorMode("RestMachiningRegions", 2) # hide
|
||||
|
||||
for n in self.pocketPropertyEnumerations():
|
||||
setattr(obj, n[0], n[1])
|
||||
@@ -277,29 +267,10 @@ class ObjectPocket(PathAreaOp.ObjectOp):
|
||||
),
|
||||
)
|
||||
|
||||
if not hasattr(obj, "RestMachiningRegions"):
|
||||
obj.addProperty(
|
||||
"Part::PropertyPartShape",
|
||||
"RestMachiningRegions",
|
||||
"Pocket",
|
||||
QT_TRANSLATE_NOOP(
|
||||
"App::Property",
|
||||
"The areas cleared by this operation, one area per height, stored as a compound part. Used internally for rest machining.",
|
||||
),
|
||||
)
|
||||
obj.setEditorMode("RestMachiningRegions", 2) # hide
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"RestMachiningRegionsNeedRecompute",
|
||||
"Pocket",
|
||||
QT_TRANSLATE_NOOP(
|
||||
"App::Property",
|
||||
"Flag to indicate that the rest machining regions have never been computed, and must be recomputed before being used.",
|
||||
),
|
||||
)
|
||||
obj.setEditorMode("RestMachiningRegionsNeedRecompute", 2) # hide
|
||||
obj.RestMachiningRegionsNeedRecompute = True
|
||||
if hasattr(obj, "RestMachiningRegions"):
|
||||
obj.removeProperty("RestMachiningRegions")
|
||||
if hasattr(obj, "RestMachiningRegionsNeedRecompute"):
|
||||
obj.removeProperty("RestMachiningRegionsNeedRecompute")
|
||||
|
||||
Path.Log.track()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user