Skip to content

Commit

Permalink
pass the tool shape to the CSimTool and handle the shape internally
Browse files Browse the repository at this point in the history
  • Loading branch information
dubstar-04 committed May 4, 2020
1 parent 7cb8141 commit 8994829
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 59 deletions.
59 changes: 2 additions & 57 deletions src/Mod/Path/PathSimulator/App/PathSim.cpp
Expand Up @@ -33,7 +33,6 @@
#include <Base/Console.h>

#include "PathSim.h"
//#include "VolSim.h"

using namespace Base;
using namespace PathSimulator;
Expand All @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions src/Mod/Path/PathSimulator/App/PathSim.h
Expand Up @@ -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"

Expand All @@ -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:
Expand Down

0 comments on commit 8994829

Please sign in to comment.