Fix Path Keep View and Sim in Sync,typo Linuxcnc_post

This commit is contained in:
Sammel Lothar LTS
2018-01-08 15:17:59 +01:00
committed by Yorik van Havre
parent 636f361268
commit b6304d16a7
3 changed files with 27 additions and 10 deletions

View File

@@ -50,7 +50,7 @@ PathSim::PathSim()
PathSim::~PathSim()
{
if (m_stock != nullptr)
delete m_stock;
delete m_stock;
if (m_tool != nullptr)
delete m_tool;
}
@@ -79,6 +79,13 @@ void PathSim::SetCurrentTool(Tool * tool)
case Tool::UNDEFINED:
case Tool::DRILL:
tp = cSimTool::CHAMFER;
angle = tool->CuttingEdgeAngle;
if (angle > 180)
{
angle = 180;
}
break;
case Tool::CENTERDRILL:
case Tool::COUNTERSINK:
case Tool::COUNTERBORE:
@@ -88,13 +95,19 @@ void PathSim::SetCurrentTool(Tool * tool)
case Tool::SLOTCUTTER:
case Tool::CORNERROUND:
case Tool::ENGRAVER:
break; // quiet warnings
tp = cSimTool::CHAMFER;
angle = tool->CuttingEdgeAngle;
if (angle > 180)
{
angle = 180;
}
break;
break; // quiet warnings
}
m_tool = new cSimTool(tp, tool->Diameter / 2.0, angle);
}
Base::Placement * PathSim::ApplyCommand(Base::Placement * pos, Command * cmd)
{
Point3D fromPos(*pos);
@@ -102,7 +115,7 @@ Base::Placement * PathSim::ApplyCommand(Base::Placement * pos, Command * cmd)
toPos.UpdateCmd(*cmd);
if (cmd->Name == "G0" || cmd->Name == "G1")
{
m_stock->ApplyLinearTool(fromPos, toPos, *m_tool);
m_stock->ApplyLinearTool(fromPos, toPos, *m_tool);
}
else if (cmd->Name == "G2")
{
@@ -116,6 +129,7 @@ Base::Placement * PathSim::ApplyCommand(Base::Placement * pos, Command * cmd)
Point3D cent(vcent);
m_stock->ApplyCircularTool(fromPos, toPos, cent, *m_tool, true);
}
Base::Placement *plc = new Base::Placement();
Vector3d vec(toPos.x, toPos.y, toPos.z);
plc->setPosition(vec);