Cam simulator feature update (#15597)

* remove redundant code

* Improve lighting, add ambient occlusion

* Add cleanup code. Dialog is now deleted when cloesd.

* change back to ambient occlusion

* Fix G8x drill sequence bug.  issue #14369

* fix bad simulation artifacts under Linux and QT. Issue #14369

* fix merge issue

* fix border artifact on buttons

* support showing path lines. revise the gui.

* add option for arbitrary solids. wip

* use vectors instead of mallocs

* Handle arbitrary stock shapes + show base shape.

* Complete the base shape display feature. eliminate co-planar artifacts.

* support window scaling. upstream issue #14334

* Apply lint fixes

* some missing lints.

* Attend pylint issues

* Apply code fixes based on @kadet1090 review

* fix some clang-tidy warnings.

* CAM: Linter cleanup round 1

---------

Co-authored-by: Chris Hennes <chennes@gmail.com>
This commit is contained in:
Shai Seger
2024-08-21 23:18:52 +03:00
committed by GitHub
parent c4a506146f
commit 778107939c
42 changed files with 2744 additions and 1067 deletions

View File

@@ -20,10 +20,16 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "PreCompiled.h" // NOLINT
#ifndef _PreComp_
#include <string>
#include <vector>
#endif
#include "CAMSim.h"
#include "DlgCAMSimulator.h"
#include <stdio.h>
#include <Mod/Part/App/BRepMesh.h>
using namespace Base;
@@ -31,25 +37,9 @@ using namespace CAMSimulator;
TYPESYSTEM_SOURCE(CAMSimulator::CAMSim, Base::BaseClass);
#define MAX_GCODE_LINE_LEN 120
CAMSim::CAMSim()
{}
CAMSim::~CAMSim()
{}
void CAMSim::BeginSimulation(Part::TopoShape* stock, float quality)
void CAMSim::BeginSimulation(const Part::TopoShape& stock, float quality)
{
Base::BoundBox3d bbox = stock->getBoundBox();
SimStock stk = {(float)bbox.MinX,
(float)bbox.MinY,
(float)bbox.MinZ,
(float)bbox.LengthX(),
(float)bbox.LengthY(),
(float)bbox.LengthZ(),
quality};
DlgCAMSimulator::GetInstance()->startSimulation(&stk, quality);
DlgCAMSimulator::GetInstance()->startSimulation(stock, quality);
}
void CAMSimulator::CAMSim::resetSimulation()
@@ -57,7 +47,7 @@ void CAMSimulator::CAMSim::resetSimulation()
DlgCAMSimulator::GetInstance()->resetSimulation();
}
void CAMSim::addTool(const std::vector<float> toolProfilePoints,
void CAMSim::addTool(const std::vector<float> &toolProfilePoints,
int toolNumber,
float diameter,
float resolution)
@@ -65,6 +55,15 @@ void CAMSim::addTool(const std::vector<float> toolProfilePoints,
DlgCAMSimulator::GetInstance()->addTool(toolProfilePoints, toolNumber, diameter, resolution);
}
void CAMSimulator::CAMSim::SetBaseShape(const Part::TopoShape& baseShape, float resolution)
{
if (baseShape.isNull()) {
return;
}
DlgCAMSimulator::GetInstance()->SetBaseShape(baseShape, resolution);
}
void CAMSim::AddCommand(Command* cmd)
{
std::string gline = cmd->toGCode();