pass the tool shape to the CSimTool and handle the shape internally

This commit is contained in:
Daniel Wood
2020-04-29 19:33:47 +01:00
parent f3789ebfad
commit 0d3d7157f8
2 changed files with 3 additions and 59 deletions

View File

@@ -33,7 +33,6 @@
#include <Base/Console.h>
#include "PathSim.h"
//#include "VolSim.h"
using namespace Base;
using namespace PathSimulator;
@@ -54,69 +53,15 @@ PathSim::~PathSim()
delete m_tool;
}
void PathSim::BeginSimulation(Part::TopoShape * stock, float resolution)
{
Base::BoundBox3d bbox = stock->getBoundBox();
m_stock = new cStock(bbox.MinX, bbox.MinY, bbox.MinZ, bbox.LengthX(), bbox.LengthY(), bbox.LengthZ(), resolution);
}
void PathSim::SetCurrentTool(Tool * tool)
void PathSim::SetToolShape(const TopoDS_Shape& toolShape, float resolution)
{
cSimTool::Type tp = cSimTool::FLAT;
float angle = 180;
switch (tool->Type)
{
case Tool::BALLENDMILL:
tp = cSimTool::ROUND;
break;
case Tool::CHAMFERMILL:
tp = cSimTool::CHAMFER;
angle = tool->CuttingEdgeAngle;
break;
case Tool::UNDEFINED:
case Tool::DRILL:
tp = cSimTool::CHAMFER;
angle = tool->CuttingEdgeAngle;
if (angle > 180)
{
angle = 180;
}
break;
case Tool::CENTERDRILL:
tp = cSimTool::CHAMFER;
angle = tool->CuttingEdgeAngle;
if (angle > 180)
{
angle = 180;
}
break;
case Tool::COUNTERSINK:
case Tool::COUNTERBORE:
case Tool::REAMER:
case Tool::TAP:
case Tool::ENDMILL:
tp = cSimTool::FLAT;
angle = 180;
break;
case Tool::SLOTCUTTER:
case Tool::CORNERROUND:
case Tool::ENGRAVER:
tp = cSimTool::CHAMFER;
angle = tool->CuttingEdgeAngle;
if (angle > 180)
{
angle = 180;
}
break;
default:
tp = cSimTool::FLAT;
angle = 180;
break;
}
m_tool = new cSimTool(tp, tool->Diameter / 2.0, angle);
m_tool = new cSimTool(toolShape, resolution);
}
Base::Placement * PathSim::ApplyCommand(Base::Placement * pos, Command * cmd)

View File

@@ -31,7 +31,6 @@
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <Mod/Path/App/Command.h>
#include <Mod/Path/App/Tooltable.h>
#include <Mod/Part/App/TopoShape.h>
#include "VolSim.h"
@@ -51,7 +50,7 @@ namespace PathSimulator
~PathSim();
void BeginSimulation(Part::TopoShape * stock, float resolution);
void SetCurrentTool(Tool * tool);
void SetToolShape(const TopoDS_Shape& toolShape, float resolution);
Base::Placement * ApplyCommand(Base::Placement * pos, Command * cmd);
public: