Skip to content

Commit 531a76c

Browse files
committed
LibMCCore: Refine hatch interpolation handling and improve nonlinear factor processing
- Core toolpath logic (amc_toolpathlayerdata.cpp): - Introduced compile-time switch `USEALLMODIFICATIONFACTORS` to control whether all modification factors (F/G/H) or only factor F are processed. - Added safeguard when assigning nonlinear interpolation data to avoid out-of-range vector access when `nSubInterpolationCount` is zero. - ScanLabSMC driver (CSMCJobInstance): - Added parsing and output of new active channel data (`active0`, `active1`) in SMC v1.0 simulation files. - Updated CSV field mapping to include new channels, replacing placeholder unused entries. - Extended data table schema to add `active0` and `active1` columns. - Populated active channel values in the output table and reset corresponding vectors after use. - LibMCEnv layer evaluation (libmcenv_toolpathlayer.cpp): - Commented out exception throw for incomplete hatch profile evaluation to allow partial evaluation without interrupting execution. Signed-off-by: Yury Rodzikau <[email protected]>
1 parent cecae7e commit 531a76c

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

Drivers/ScanLabSMC/Implementation/libmcdriver_scanlabsmc_smcjobinstance.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,10 @@ void CSMCJobInstance::ReadSimulationFile_SMC_v1_0(LibMCEnv::PDataTable pDataTabl
795795
{{CSMCCSVParser::FieldParserType::Double, CSMCCSVParser::FieldProcessingStep::Extend | CSMCCSVParser::FieldProcessingStep::Interpolate }, &scanheadY},
796796
{{CSMCCSVParser::FieldParserType::LaserSignal,CSMCCSVParser::FieldProcessingStep::Nop}, &laserSignal},
797797
{{CSMCCSVParser::FieldParserType::UInt32,CSMCCSVParser::FieldProcessingStep::Nop}, &laserToggle},
798-
{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
799-
{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
798+
//{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
799+
//{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
800+
{{CSMCCSVParser::FieldParserType::Double,CSMCCSVParser::FieldProcessingStep::Nop}, &activeChannel0},
801+
{{CSMCCSVParser::FieldParserType::Double,CSMCCSVParser::FieldProcessingStep::Nop}, &activeChannel1},
800802
{{CSMCCSVParser::FieldParserType::Int,CSMCCSVParser::FieldProcessingStep::Nop}, &cmdCount},
801803
{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
802804
{{CSMCCSVParser::FieldParserType::None,CSMCCSVParser::FieldProcessingStep::Nop}, nullptr},
@@ -815,8 +817,8 @@ void CSMCJobInstance::ReadSimulationFile_SMC_v1_0(LibMCEnv::PDataTable pDataTabl
815817
pDataTable->AddColumn("x", "X", LibMCEnv::eDataTableColumnType::DoubleColumn);
816818
pDataTable->AddColumn("y", "Y", LibMCEnv::eDataTableColumnType::DoubleColumn);
817819
pDataTable->AddColumn("laseron", "LaserOn", LibMCEnv::eDataTableColumnType::Uint32Column);
820+
pDataTable->AddColumn("active0", "Active Channel 0", LibMCEnv::eDataTableColumnType::DoubleColumn);
818821
pDataTable->AddColumn("active1", "Active Channel 1", LibMCEnv::eDataTableColumnType::DoubleColumn);
819-
pDataTable->AddColumn("active2", "Active Channel 2", LibMCEnv::eDataTableColumnType::DoubleColumn);
820822
pDataTable->AddColumn("cmdindex", "Command Index", LibMCEnv::eDataTableColumnType::Int32Column);
821823

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

834836
pDataTable->SetUint32ColumnValues("laseron", laserSignal);
835837
laserSignal.resize(0);
838+
839+
pDataTable->SetDoubleColumnValues("active0", activeChannel0);
840+
activeChannel0.resize(0);
841+
842+
pDataTable->SetDoubleColumnValues("active1", activeChannel1);
843+
activeChannel1.resize(0);
836844
}
837845

838846
void CSMCJobInstance::ReadLogRecordFile(LibMCEnv::PDataTable pDataTable)

Implementation/Core/amc_toolpathlayerdata.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,11 @@ namespace AMC {
429429

430430
}
431431

432-
432+
#if USEALLMODIFICATIONFACTORS
433433
for (uint32_t nFactorIndex = 0; nFactorIndex < 3; nFactorIndex++) {
434-
434+
#else // USE ONLY FACTOR_F MODIFICATOR
435+
for (uint32_t nFactorIndex = 0; nFactorIndex < 1; nFactorIndex++) {
436+
#endif
435437
Lib3MF::eToolpathProfileModificationFactor factorType = Lib3MF::eToolpathProfileModificationFactor::Unknown;
436438
uint32_t factorFlag = 0;
437439
switch (nFactorIndex) {
@@ -478,7 +480,8 @@ namespace AMC {
478480
Lib3MF::sHatchModificationInterpolationData* pSubInterpolationData = nullptr;
479481
if (nonLinearCounts.size() > 0) {
480482
nSubInterpolationCount = nonLinearCounts.at(nHatchIndex);
481-
pSubInterpolationData = &m_InterpolationData.at(nInterpolationDataStartIndex + nTotalSubInterpolationCount);
483+
if (nSubInterpolationCount > 0)
484+
pSubInterpolationData = &m_InterpolationData.at(nInterpolationDataStartIndex + nTotalSubInterpolationCount);
482485
}
483486

484487
pDstOverride->m_dFactors[nFactorIndex] = pSrcOverride->m_Point1Factor;

Implementation/LibMCEnv/libmcenv_toolpathlayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ void CToolpathLayer::EvaluateTypedHatchProfileInterpolation(const LibMCEnv_uint3
559559
}
560560
else {
561561
if ((pCountArrayBuffer != nullptr) || (pEvaluationDataBuffer != nullptr)) {
562-
throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_COULDNOTEVALUATEHATCHPROFILES);
562+
//throw ELibMCEnvInterfaceException(LIBMCENV_ERROR_COULDNOTEVALUATEHATCHPROFILES);
563563

564564
}
565565
}

0 commit comments

Comments
 (0)