Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Artifacts/clientdist/clientpackage.zip
Binary file not shown.
Binary file modified Artifacts/clientdist/clientsourcepackage.zip
Binary file not shown.
69 changes: 69 additions & 0 deletions Client/src/common/AMCImplementation_LayerView.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,28 @@ class LayerViewImpl {

}

computeChannelColumnRange (pointsChannelName, pointsColumnName)
{
if (this[pointsChannelName] && this[pointsChannelName][pointsColumnName]) {
let dataArray = this[pointsChannelName][pointsColumnName];

let maxValue = Number.NEGATIVE_INFINITY;
let minValue = Number.POSITIVE_INFINITY;

for (let i = 0; i < dataArray.length; i++) {
let value = dataArray[i];
if (value > maxValue) {
maxValue = value;
}
if (value < minValue) {
minValue = value;
}
}
this[pointsChannelName][pointsColumnName].max = maxValue;
this[pointsChannelName][pointsColumnName].min = minValue;
}
}

makeLaserOnColors ()
{
this.laserOnPointsColorArray = null;
Expand All @@ -351,6 +373,37 @@ class LayerViewImpl {

}

makeLaserPowerColors ()
{
this.layerPointsColorArray = null;

if (this.laser && this.laser.power && this.layerPointsArray) {
const powerRange = (this.laser.power.max - this.laser.power.min);
if (powerRange > 0) {

let pointCount = this.laser.power.length;
let colors = [];

for (let pointIndex = 0; pointIndex < pointCount; pointIndex++) {
let power = this.laser.power[pointIndex];
let fraction = (power - this.laser.power.min) / powerRange;
if (fraction >= 0.0) {
if (fraction > 1.0)
fraction = 1.0;
} else {
fraction = 0.0;
}

const hue = (fraction) * 240 / 360;
colors.push (this.hslToRgb (hue, 1.0, 0.5));
}

this.layerPointsColorArray = colors;
}
}
}


hslToRgb(h, s, l) {
// Ensure h, s, l are in the range [0, 1]
h = h % 1; // Wrap around if h is greater than 1
Expand Down Expand Up @@ -429,6 +482,8 @@ class LayerViewImpl {

// Assign the data array to the corresponding column
this[pointsChannelName][pointsColumnName] = pointsChannelDataArray;

this.computeChannelColumnRange (pointsChannelName, pointsColumnName);
}

clearPoints ()
Expand Down Expand Up @@ -469,6 +524,10 @@ class LayerViewImpl {
if (this.layerPointsMode == "laseron") {
this.makeLaserOnColors ();
}

if (this.layerPointsMode == "powerramp") {
this.makeLaserPowerColors ();
}
}

setColorMode (newColorMode) {
Expand Down Expand Up @@ -587,6 +646,16 @@ class LayerViewImpl {

}

getPointPower (pointIndex)
{
if (this.laser && this.laser.power) {
if (pointIndex >= 0 && pointIndex < this.laser.power.length) {
return this.laser.power[pointIndex];
}
}
return null;
}

updateLoadedLayer () {
if (!this.glInstance)
return;
Expand Down
22 changes: 20 additions & 2 deletions Client/src/modules/AMCModule_LayerView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
this.LayerViewerInstance.setColorMode ("laseron");
}
else if (this.LayerViewerInstance.layerPointsMode == "laseron") {
this.LayerViewerInstance.setColorMode ("powerramp");
}
else if (this.LayerViewerInstance.layerPointsMode == "powerramp") {
this.LayerViewerInstance.setColorMode ("uniform");
} else {
}
else {
this.LayerViewerInstance.setColorMode ("time");
}
},
Expand Down Expand Up @@ -240,6 +244,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
return "Color: LaserOn";
}

if (this.LayerViewerInstance.layerPointsMode == "powerramp") {
return "Color: Power";
}

return "Color: Uniform";
},

Expand Down Expand Up @@ -357,6 +365,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
} else {
console.log(`${key}: ${floatArray.length}`);
}
} else if (key.toLowerCase() === 'power') {
if (this.LayerViewerInstance) {
this.LayerViewerInstance.loadPointsChannelData ("laser", key.toLowerCase(), floatArray);
} else {
console.log(`${key}: ${floatArray.length}`);
}
}
} else {
console.warn(`Key "${key}" is not an array and will be ignored.`);
Expand Down Expand Up @@ -588,6 +602,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
let pointVelocity = this.LayerViewerInstance.getPointVelocity (pointIndex);
let pointAcceleration = this.LayerViewerInstance.getPointAcceleration (pointIndex);
let pointJerk = this.LayerViewerInstance.getPointJerk (pointIndex);
let pointPower = this.LayerViewerInstance.getPointPower (pointIndex);

let infoCaption = `Point ID = ${pointIndex.toFixed(0)}\n`;
if (pointPosition) {
Expand All @@ -605,7 +620,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
let jerkinmeterspersecondsquared = pointJerk.j / 1000000.0;
infoCaption += `Jerk: ${jerkinmeterspersecondsquared.toFixed(4)} km/s³\n`;
}

if (pointPower) {
let powerinwatts = pointPower; // * 1000.0;
infoCaption += `Power: ${powerinwatts.toFixed(4)} W\n`;
}

this.lastMouseX = mouseX;
this.lastMouseY = mouseY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,10 @@ void CSMCJobInstance::ReadSimulationFile_SMC_v1_0(LibMCEnv::PDataTable pDataTabl
{{CSMCCSVParser::FieldParserType::Double, CSMCCSVParser::FieldProcessingStep::Extend | CSMCCSVParser::FieldProcessingStep::Interpolate }, &scanheadY},
{{CSMCCSVParser::FieldParserType::LaserSignal,CSMCCSVParser::FieldProcessingStep::Nop}, &laserSignal},
{{CSMCCSVParser::FieldParserType::UInt32,CSMCCSVParser::FieldProcessingStep::Nop}, &laserToggle},
{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
//{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
//{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
{{CSMCCSVParser::FieldParserType::Double,CSMCCSVParser::FieldProcessingStep::Nop}, &activeChannel0},
{{CSMCCSVParser::FieldParserType::Double,CSMCCSVParser::FieldProcessingStep::Nop}, &activeChannel1},
{{CSMCCSVParser::FieldParserType::Int,CSMCCSVParser::FieldProcessingStep::Nop}, &cmdCount},
{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
Expand All @@ -815,8 +817,8 @@ void CSMCJobInstance::ReadSimulationFile_SMC_v1_0(LibMCEnv::PDataTable pDataTabl
pDataTable->AddColumn("x", "X", LibMCEnv::eDataTableColumnType::DoubleColumn);
pDataTable->AddColumn("y", "Y", LibMCEnv::eDataTableColumnType::DoubleColumn);
pDataTable->AddColumn("laseron", "LaserOn", LibMCEnv::eDataTableColumnType::Uint32Column);
pDataTable->AddColumn("power", "Laser Power", LibMCEnv::eDataTableColumnType::DoubleColumn);
pDataTable->AddColumn("active1", "Active Channel 1", LibMCEnv::eDataTableColumnType::DoubleColumn);
pDataTable->AddColumn("active2", "Active Channel 2", LibMCEnv::eDataTableColumnType::DoubleColumn);
pDataTable->AddColumn("cmdindex", "Command Index", LibMCEnv::eDataTableColumnType::Int32Column);

m_dJobDuration = (double)timestampValues.size() / (double)SCANLABSMC_MICROSTEPSPERSECOND;
Expand All @@ -833,6 +835,12 @@ void CSMCJobInstance::ReadSimulationFile_SMC_v1_0(LibMCEnv::PDataTable pDataTabl

pDataTable->SetUint32ColumnValues("laseron", laserSignal);
laserSignal.resize(0);

pDataTable->SetDoubleColumnValues("power", activeChannel0);
activeChannel0.resize(0);

pDataTable->SetDoubleColumnValues("active1", activeChannel1);
activeChannel1.resize(0);
}

void CSMCJobInstance::ReadLogRecordFile(LibMCEnv::PDataTable pDataTable)
Expand Down
9 changes: 6 additions & 3 deletions Implementation/Core/amc_toolpathlayerdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,11 @@ namespace AMC {

}


#if USEALLMODIFICATIONFACTORS
for (uint32_t nFactorIndex = 0; nFactorIndex < 3; nFactorIndex++) {

#else // USE ONLY FACTOR_F MODIFICATOR
for (uint32_t nFactorIndex = 0; nFactorIndex < 1; nFactorIndex++) {
#endif
Lib3MF::eToolpathProfileModificationFactor factorType = Lib3MF::eToolpathProfileModificationFactor::Unknown;
uint32_t factorFlag = 0;
switch (nFactorIndex) {
Expand Down Expand Up @@ -478,7 +480,8 @@ namespace AMC {
Lib3MF::sHatchModificationInterpolationData* pSubInterpolationData = nullptr;
if (nonLinearCounts.size() > 0) {
nSubInterpolationCount = nonLinearCounts.at(nHatchIndex);
pSubInterpolationData = &m_InterpolationData.at(nInterpolationDataStartIndex + nTotalSubInterpolationCount);
if (nSubInterpolationCount > 0)
pSubInterpolationData = &m_InterpolationData.at(nInterpolationDataStartIndex + nTotalSubInterpolationCount);
}

pDstOverride->m_dFactors[nFactorIndex] = pSrcOverride->m_Point1Factor;
Expand Down
28 changes: 27 additions & 1 deletion Implementation/LibMCEnv/libmcenv_datatable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,33 @@ class CDataTableColumn_Double : public CDataTableColumn

void fillScatterplotChannel(AMC::CScatterplot* pScatterplot, const std::string& sChannel, const std::string& sColumn, double dScaleFactor, double dOffset) override
{
throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_NOTIMPLEMENTED);
if (pScatterplot == nullptr)
throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_INVALIDPARAM);

auto& channelEntries = pScatterplot->getChannelEntries();
auto channelIter = channelEntries.find(sChannel);

if (channelIter == channelEntries.end()) {
channelEntries[sChannel][sColumn] = std::vector<double>();
}
else {
auto& columnEntries = channelIter->second;

if (columnEntries.find(sColumn) == columnEntries.end())
columnEntries[sColumn] = std::vector<double>();
else {
std::string sException = "The channel = " + sChannel + " with the column = " + sColumn + " already exists";
throw std::runtime_error(sException.c_str());
}
}

auto& vecColumn = channelEntries[sChannel][sColumn];

vecColumn.resize(m_Rows.size());

for (size_t nIndex = 0; nIndex < m_Rows.size(); nIndex++) {
vecColumn[nIndex] = (double)m_Rows.at(nIndex) * dScaleFactor + dOffset;
}
}

};
Expand Down
2 changes: 1 addition & 1 deletion Implementation/LibMCEnv/libmcenv_toolpathlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ void CToolpathLayer::EvaluateTypedHatchProfileInterpolation(const LibMCEnv_uint3
}
else {
if ((pCountArrayBuffer != nullptr) || (pEvaluationDataBuffer != nullptr)) {
throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_COULDNOTEVALUATEHATCHPROFILES);
//throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_COULDNOTEVALUATEHATCHPROFILES);

}
}
Expand Down
Loading