18c7c4601a
- aggiornata pugixml a versione 1.15 - correzioni stilistiche in ImportBTLx.
2375 lines
118 KiB
C++
2375 lines
118 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2020-2020
|
|
//----------------------------------------------------------------------------
|
|
// File : ImportBtlx.cpp Data : 14.12.20 Versione : 2.3a6
|
|
// Contenuto : Implementazione della classe per l'importazione BTLx.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 14.12.20 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "pugixml.hpp"
|
|
#include "ImportBtlx.h"
|
|
#include "DllMain.h"
|
|
#include "/EgtDev/Include/EExDllMain.h"
|
|
#include "/EgtDev/Include/EgtKeyCodes.h"
|
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
|
#include "/EgtDev/Include/EgtNumUtils.h"
|
|
|
|
using namespace std ;
|
|
|
|
// -----------------------------------------------------------------------------------------------------------------------------
|
|
// -------------------------------- FUNZIONI CHE LEGGONO I PARAMETRI DEI PROCESSI -------------------------------------------
|
|
// -----------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// ------------------------- Prototipi locali funzioni ausiliarie ---------------------------------
|
|
static int GetGroup12( const pugi::xml_node& process) ;
|
|
static int GetGroup34( const pugi::xml_node& process) ;
|
|
static double ReadProcessChild( const pugi::xml_node& process, const string& sChild, double dVal) ;
|
|
static double ReadProcessChildAttribute( const pugi::xml_node& process, const string& sChild, const string& sAttribute, double dVal) ;
|
|
static int ReadProcessChildBool( const pugi::xml_node& process, const string& sChild, const int& nDefaultVal, bool bInverted = false) ;
|
|
static string ReadProcessChildYesNo( const pugi::xml_node& process, const string& sChild, const string& sVal) ;
|
|
static double ReadProcessChildYesNoToDouble( const pugi::xml_node& process, const string& sChild1, const string& sDefaultOpt, const string& sChild2,
|
|
double nDefaultVal) ;
|
|
static int ComputeP04( const STRVECTOR& values) ;
|
|
static int ComputeP04( const pugi::xml_node& MachiningLimits) ;
|
|
|
|
//-------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadJackRafterCutParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 10 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup12( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: JackRafterCut Orientation is not valid") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 5) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: JackRafterCut number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), 0.0, 50000.0) ; // P02
|
|
vdPar[2] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[2]), 0.0, 50000.0) ; // P03
|
|
vdPar[3] = ReadProcessChild( process, "Angle", vdPar[3]) ; // P06
|
|
vdPar[4] = ReadProcessChild( process, "Inclination", vdPar[4]) ; // P07
|
|
|
|
return true ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadLongitudinalCutParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 10 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
if (process.attribute( "ToolPosition") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LongitudinalCut Tool position missing") ;
|
|
return false ;
|
|
}
|
|
string sToolPosition = process.attribute( "ToolPosition").value() ;
|
|
if ( sToolPosition == "center")
|
|
nGroup = 0 ;
|
|
else if ( sToolPosition == "right")
|
|
nGroup = 4 ;
|
|
else if ( sToolPosition == "left")
|
|
nGroup = 3 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LongitudinalCut Tool position not valid") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 8) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LongitudinalCut number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), 0.0, 50000.0) ; // P02
|
|
vdPar[3] = ReadProcessChild( process, "Inclination", vdPar[3]) ; // P07
|
|
vdPar[4] = Clamp( ReadProcessChild( process, "Depth", vdPar[4]), 0.0, 50000.0) ; // P11
|
|
vdPar[5] = Clamp( ReadProcessChild( process, "Length", vdPar[5]), 0.0, 100000.0) ; // P12
|
|
vdPar[6] = Clamp( ReadProcessChild( process, "AngleStart", vdPar[6]), 0.1, 179.9) ; // P13
|
|
vdPar[7] = Clamp( ReadProcessChild( process, "AngleEnd", vdPar[7]), 0.1, 179.9) ; // P14
|
|
|
|
if ( vdPar[3] < 0) {
|
|
if ( nGroup == 3)
|
|
nGroup = 4 ;
|
|
else if ( nGroup == 4)
|
|
nGroup = 3 ;
|
|
}
|
|
|
|
string sStartLimited = ReadProcessChildYesNo( process, "StartLimited", "no") ; // P04
|
|
string sEndLimited = ReadProcessChildYesNo( process, "EndLimited", "no") ;
|
|
vdPar[2] = ComputeP04( { "no", sStartLimited, sEndLimited}) ;
|
|
if ( vdPar[2] == -2)
|
|
return false ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadDoubleCutParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 11 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup12( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: DoubleCut orientation unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 6) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: DoubleCut number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[2] = ReadProcessChild( process, "Angle1", vdPar[2]) ; // P06
|
|
vdPar[3] = ReadProcessChild( process, "Inclination1", vdPar[3]) ; // P07
|
|
vdPar[4] = ReadProcessChild( process, "Angle2", vdPar[4]) ; // P08
|
|
vdPar[5] = ReadProcessChild( process, "Inclination2", vdPar[5]) ; // P09
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadRidgeValleyCutParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 12 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = 0 ;
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 11) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: RidgeValleyCut number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), 0.0, 50000.0) ; // P02
|
|
vdPar[3] = ReadProcessChild( process, "InclinationRefSide", vdPar[3]) ; // P07
|
|
vdPar[4] = ReadProcessChild( process, "InclinationOppSide", vdPar[4]) ; // P09
|
|
vdPar[5] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[5]), -50000.0, 50000.0) ; // P11
|
|
vdPar[6] = Clamp( ReadProcessChild( process, "Length", vdPar[6]), 0.0, 100000.0) ; // P12
|
|
vdPar[7] = Clamp( ReadProcessChild( process, "AngleRefStart", vdPar[7]), 0.1, 179.9) ; // P13
|
|
vdPar[8] = Clamp( ReadProcessChild( process, "AngleRefEnd", vdPar[8]), 0.1, 179.9) ; // P14
|
|
vdPar[9] = Clamp( ReadProcessChild( process, "AngleOppStart", vdPar[9]), 0.1, 179.9) ; // P15
|
|
vdPar[10] = Clamp( ReadProcessChild( process, "AngleOppEnd", vdPar[10]), 0.1, 179.9) ; // P16
|
|
|
|
string sStartLimited = ReadProcessChildYesNo( process, "StartLimited", "no") ; // P04
|
|
string sEndLimited = ReadProcessChildYesNo( process, "EndLimited", "no") ;
|
|
vdPar[2] = ComputeP04( { "no", sStartLimited, sEndLimited}) ;
|
|
if ( vdPar[2] == -2)
|
|
return false ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadSawCutParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 13 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
|
|
if ( process.attribute( "ToolPosition") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: SawCut toolposition missing") ;
|
|
return false ;
|
|
}
|
|
|
|
string sToolPosition = process.attribute( "ToolPosition").value() ;
|
|
if ( sToolPosition == "center")
|
|
nGroup = 0 ;
|
|
else if ( sToolPosition == "right")
|
|
nGroup = 3 ;
|
|
else if ( sToolPosition == "left")
|
|
nGroup = 4 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: SawCut tool position unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 8) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: SawCut number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[2] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[2]), -50000.0, 50000.0) ; // P03
|
|
vdPar[3] = Clamp( ReadProcessChild( process, "Angle", vdPar[3]), 0.0, 180.0) ; // P06
|
|
vdPar[4] = ReadProcessChild( process, "Inclination", vdPar[4]) ; // P07
|
|
vdPar[5] = ReadProcessChild( process, "Bevel", vdPar[5]) ; // P08
|
|
vdPar[6] = ReadProcessChild( process, "Depth", vdPar[6]) ; // P11
|
|
vdPar[7] = ReadProcessChild( process, "Length", vdPar[7]) ; // P12
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadSlotParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 16 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup34( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Slot orientation unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 14) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Slot number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[2] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[2]), 0.0, 50000.0) ; // P03
|
|
vdPar[4] = ReadProcessChild( process, "Angle", vdPar[4]) ; // P06
|
|
vdPar[5] = ReadProcessChild( process, "Inclination", vdPar[5]) ; // P07
|
|
vdPar[6] = ReadProcessChild( process, "AngleRefPoint", vdPar[6]) ; // P08
|
|
vdPar[7] = ReadProcessChild( process, "AngleOppPoint", vdPar[7]) ; // P09
|
|
vdPar[8] = Clamp( ReadProcessChild( process, "AddAngleOppPoint", vdPar[8]), -179.9, 179.9) ; // P10
|
|
vdPar[9] = ReadProcessChild( process, "Depth", vdPar[9]) ; // P11
|
|
vdPar[10] = ReadProcessChild( process, "Length", vdPar[10]) ; // P12
|
|
vdPar[11] = ReadProcessChild( process, "Thickness", vdPar[11]) ; // P13
|
|
|
|
if ( process.child( "MachiningLimits") != nullptr) { // P04
|
|
vdPar[3] = ComputeP04( process.child( "MachiningLimits")) ;
|
|
if ( vdPar[3] == -2)
|
|
return false ;
|
|
}
|
|
|
|
// P14 P15 non vengono usati
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadBirdsMouthParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 20 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup34( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BirdsMouth orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 13) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BirdsMouth number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[2] = ReadProcessChildBool( process, "RafterNailHole", 0) ; // P05
|
|
vdPar[3] = ReadProcessChild( process, "Angle", vdPar[3]) ; // P06
|
|
vdPar[4] = ReadProcessChild( process, "Inclination1", vdPar[4]) ; // P07
|
|
vdPar[5] = ReadProcessChild( process, "Inclination2", vdPar[5]) ; // P08
|
|
vdPar[6] = ReadProcessChildYesNoToDouble( process, "LeadAngleParallel", "yes", "LeadAngle", 90.0) ; // P09
|
|
vdPar[7] = ReadProcessChildYesNoToDouble( process, "LeadInclinationParallel", "yes", "LeadInclination", 90.0) ; // P10
|
|
vdPar[8] = ReadProcessChild( process, "StartDepth", vdPar[8]) ; // P11
|
|
vdPar[9] = ReadProcessChild( process, "Depth", vdPar[9]) ; // P12
|
|
vdPar[10] = ReadProcessChild( process, "Width", vdPar[10]) ; // P13
|
|
vdPar[11] = ReadProcessChildYesNoToDouble( process, "HeightCounterPartLimited", "no", "HeightCounterPart", 120.0) ; // P14
|
|
vdPar[12] = ReadProcessChildYesNoToDouble( process, "WidthCounterPartLimited", "no", "WidthCounterPart", 120.0) ; // P15
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadHipValleyRafterNotchParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 25 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup34( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: HipValleyRafterNotch orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 9) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: HipValleyRafterNotch number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = ReadProcessChild( process, "StartX", vdPar[0]) ; // P01
|
|
vdPar[1] = ReadProcessChild( process, "StartY", vdPar[1]) ; // P02
|
|
vdPar[2] = ReadProcessChildBool( process, "RafterNailHole", 0) ; // P05
|
|
vdPar[3] = ReadProcessChild( process, "AngleRefEdge", vdPar[3]) ; // P06
|
|
vdPar[4] = ReadProcessChild( process, "AngleRefEdge", vdPar[4]) ; // P07
|
|
vdPar[5] = ReadProcessChild( process, "Inclination", vdPar[5]) ; // P08
|
|
vdPar[6] = ReadProcessChild( process, "StartDepth", vdPar[6]) ; // P11
|
|
vdPar[7] = ReadProcessChildYesNoToDouble( process, "WidthCounterPartRefEdgeLimited", "no", "WidthCounterPartRefEdge", vdPar[7]) ; // P14
|
|
vdPar[8] = ReadProcessChildYesNoToDouble( process, "WidthCounterPartOppEdgeLimited", "no", "WidthCounterPartOppEdge", vdPar[8]) ; // P15
|
|
|
|
if ( vdPar[7] < EPS_SMALL && vdPar[8] < EPS_SMALL) {
|
|
LOG_ERROR( GetEExLogger(), " Warning reading Part Processing : P14 = P15 = 0") ;
|
|
vdPar[7] = 1000.0 ;
|
|
vdPar[8] = 1000.0 ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadLapParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 30 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup34( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: HipValleyRafterNotch orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 13) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: HipValleyRafterNotch number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
// vdPar[2] = ? Non c'è StartDepth
|
|
vdPar[4] = ReadProcessChild( process, "Angle", vdPar[4]) ; // P04
|
|
vdPar[5] = ReadProcessChild( process, "Inclination", vdPar[5]) ; // P07
|
|
vdPar[6] = ReadProcessChild( process, "Slope", vdPar[6]) ; // P08
|
|
vdPar[7] = ReadProcessChildYesNoToDouble( process, "LeadAngleParallel", "yes", "LeadAngle", 90.0) ; // P09
|
|
vdPar[8] = ReadProcessChildYesNoToDouble( process, "LeadInclinationParallel", "yes", "LeadInclination", 90.0) ; // P10
|
|
vdPar[9] = Clamp( ReadProcessChild( process, "Depth", vdPar[9]), -50000.0, 50000.0) ; // P11
|
|
vdPar[10] = ReadProcessChild( process, "Length", vdPar[10]) ; // P12
|
|
// vdPar[11] = ?
|
|
vdPar[12] = Clamp( ReadProcessChild( process, "Width", vdPar[12]), 0.0, 50000.0) ; // P14
|
|
|
|
if ( process.child( "MachiningLimits") != nullptr) {
|
|
vdPar[3] = ComputeP04( process.child( "MachiningLimits")) ;
|
|
if ( vdPar[3] == -2)
|
|
return false ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadLogHouseHalfLapParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 33 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup34( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LogHouseHalfLap orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 5) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LogHouseHalfLap number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = ReadProcessChild( process, "Angle", vdPar[1]) ; // P06
|
|
vdPar[2] = Clamp( ReadProcessChild( process, "DepthRefSide", vdPar[2]), 0.0, 50000.0) ; // P11
|
|
vdPar[3] = Clamp( ReadProcessChild( process, "DepthOppSide", vdPar[3]), 0.0, 50000.0) ; // P12
|
|
vdPar[4] = ReadProcessChild( process, "Length", vdPar[4]) ; // P13
|
|
|
|
return true ;
|
|
}
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadFrenchRidgeLapParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 33 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr){
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup12( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FrenchRidgeLap orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 4) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FrenchRidgeLap number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[2] = ReadProcessChild( process, "Angle", vdPar[2]) ; // P06
|
|
vdPar[3] = ReadProcessChild( process, "DrillholeDiam", vdPar[3]) ; // P13
|
|
|
|
string sRefPosition = process.child( "RefPosition").text().get() ; // P02
|
|
if ( sRefPosition == "refedge" || sRefPosition.empty())
|
|
vdPar[1] = 0 ;
|
|
else if ( sRefPosition == "oppedge")
|
|
vdPar[1] = 1 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FrenchRidgeLap RefPosition unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadChamferParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 36 ;
|
|
nSide = 3 ; // Chamfer non ha un reference plane
|
|
nGroup = 4 ; // Chamfer non ha orientation ( prendo start)
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 5) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Chamfer number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[2] = ReadProcessChild( process, "Depth", vdPar[2]) ; // P11
|
|
vdPar[3] = ReadProcessChild( process, "Length", vdPar[3]) ; // P12
|
|
|
|
string sCamferEdge12 = ReadProcessChildYesNo( process, "ChamferEdge12", "yes") ; // P04
|
|
string sCamferEdge23 = ReadProcessChildYesNo( process, "ChamferEdge23", "yes") ;
|
|
string sCamferEdge34 = ReadProcessChildYesNo( process, "ChamferEdge34", "yes") ;
|
|
string sCamferEdge41 = ReadProcessChildYesNo( process, "ChamferEdge41", "yes") ;
|
|
STRVECTOR vsValues = { sCamferEdge12, sCamferEdge23, sCamferEdge34, sCamferEdge41} ;
|
|
vdPar[1] = 0.0 ;
|
|
for ( int i = 0 ; i < ssize( vsValues) ; i++) {
|
|
if ( vsValues[i] == "yes")
|
|
vdPar[1] += Pow( 2, i) ;
|
|
else if ( vsValues[i] != "no") {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ChamferEdge value is not valid") ;
|
|
return false ;
|
|
}
|
|
}
|
|
|
|
string sChamferExit = process.child( "ChamferExit").text().get() ; // P15
|
|
if ( sChamferExit == "orthogonal" || sChamferExit.empty())
|
|
vdPar[4] = 0 ;
|
|
else if ( sChamferExit == "angular")
|
|
vdPar[4] = 1 ;
|
|
else if ( sChamferExit == "round")
|
|
vdPar[4] = 2 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Chamfer ExitType unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadLogHouseJointParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 37 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = 4 ;
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 16) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LogHouseJoint number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = ReadProcessChild( process, "DepthSideLaps", vdPar[1]) ; // P03
|
|
vdPar[3] = ReadProcessChildBool( process, "DrillHole", 0) ; // P05
|
|
vdPar[4] = ReadProcessChild( process, "DepthRefSide", vdPar[4]) ; // P08
|
|
vdPar[5] = ReadProcessChild( process, "LengthRefSide", vdPar[5]) ; // P09
|
|
vdPar[6] = ReadProcessChild( process, "DepthOppSide", vdPar[6]) ; // P10
|
|
vdPar[7] = ReadProcessChild( process, "LengthOppSide", vdPar[7]) ; // P11
|
|
vdPar[8] = ReadProcessChild( process, "DepthRefEdge", vdPar[8]) ; // P12
|
|
vdPar[9] = ReadProcessChild( process, "LengthRefEdge", vdPar[9]) ; // P13
|
|
vdPar[10] = ReadProcessChild( process, "DepthOppEdge", vdPar[10]) ; // P14
|
|
vdPar[11] = ReadProcessChild( process, "LengthOppEdge", vdPar[11]) ; // P15
|
|
vdPar[12] = Clamp( ReadProcessChild( process, "ArcDepth", vdPar[12]), -50000.0, 50000.0) ; // P16
|
|
vdPar[13] = Clamp( ReadProcessChild( process, "ArcRadius", vdPar[13]), 0.0, 50000.0) ; // P17
|
|
vdPar[14] = Clamp( ReadProcessChild( process, "ArcCenter", vdPar[14]), 0.0, 50000.0) ; // P18
|
|
|
|
|
|
string sLapPosition = process.child( "LapPosition").text().get() ; // P04
|
|
if ( sLapPosition == "symmetric" || sLapPosition.empty())
|
|
vdPar[2] = 0 ;
|
|
else if ( sLapPosition == "forward")
|
|
vdPar[2] = 1 ;
|
|
else if ( sLapPosition == "backward")
|
|
vdPar[2] = 2 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LogHouseJoint LapPosition unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sArcRefEdgeStart = ReadProcessChildYesNo( process, "ArcRefEdgeStart", "no") ;
|
|
string sArcOppEdgeStart = ReadProcessChildYesNo( process, "ArcOppEdgeStart", "no") ;
|
|
string sArcRefEdgeEnd = ReadProcessChildYesNo( process, "ArcRefEdgeEnd", "no") ;
|
|
string sArcOppEdgeEnd = ReadProcessChildYesNo( process, "ArcOppEdgeEnd", "no") ;
|
|
vdPar[15] = ComputeP04( { sArcOppEdgeEnd, sArcOppEdgeStart, sArcRefEdgeEnd, sArcRefEdgeStart}) ; // P19
|
|
if ( vdPar[15] == -2)
|
|
return false ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadLogHouseFrontParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 38 ;
|
|
if ( process.attribute("ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup34( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LogHouseFront orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 7) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LogHouseFront number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = ReadProcessChildBool( process, "RefSideOnly", 1, true) ; // P04
|
|
vdPar[2] = ReadProcessChild( process, "Angle", vdPar[2]) ; // P06
|
|
vdPar[3] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[3]), 0.0, 50000.0) ; // P11
|
|
vdPar[4] = Clamp( ReadProcessChild( process, "DepthOppEdge", vdPar[4]), 0.0, 50000.0) ; // P12
|
|
vdPar[5] = Clamp( ReadProcessChild( process, "DepthRefEdge", vdPar[5]), 0.0, 50000.0) ; // P13
|
|
vdPar[6] = Clamp( ReadProcessChild( process, "Length", vdPar[6]), 0.0, 50000.0) ; // P15
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadPocketParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 39 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = 4 ;
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 10) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Pocket number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[3] = ReadProcessChild( process, "Angle", vdPar[3]) ; // P06
|
|
vdPar[4] = ReadProcessChild( process, "Inclination", vdPar[4]) ; // P07
|
|
vdPar[5] = ReadProcessChild( process, "Slope", vdPar[5]) ; // P08
|
|
vdPar[6] = ReadProcessChild( process, "InternalAngle", vdPar[6]) ; // P10
|
|
vdPar[7] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[7]), -50000.0, 50000.0) ; // P11
|
|
vdPar[8] = ReadProcessChild( process, "Length", vdPar[8]) ; // P12
|
|
vdPar[9] = ReadProcessChild( process, "Width", vdPar[9]) ; // P13
|
|
|
|
if ( process.child( "MachiningLimits") != nullptr ) { // P04
|
|
vdPar[2] = ComputeP04( process.child( "MachiningLimits")) ;
|
|
if ( vdPar[2] == -2)
|
|
return false ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadDrillingParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 40 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr){
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = 4 ;
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 7) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Drilling number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
// vdPar[2] = ? // P03
|
|
vdPar[3] = Clamp( ReadProcessChild( process, "Angle", vdPar[3]), 0.0, 360.0) ; // P06
|
|
vdPar[4] = ReadProcessChild( process, "Inclination", vdPar[4]) ; // P07
|
|
vdPar[5] = Clamp( ReadProcessChild( process, "Depth", vdPar[5]), 0.0, 50000.0) ; // P11
|
|
vdPar[6] = Clamp( ReadProcessChild( process, "Diameter", vdPar[6]), 0.0, 50000.0) ; // P12
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadTenonParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 50 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup12( process) ;
|
|
if ( nGroup == -1 ) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tenon orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 12) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tenon number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // ~P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // ~P02
|
|
vdPar[3] = ReadProcessChildBool( process, "Chamfer", 0) ; // P05
|
|
vdPar[4] = Clamp( ReadProcessChild( process, "Angle", vdPar[4]), 0.1, 179.9) ; // P06
|
|
vdPar[5] = Clamp( ReadProcessChild( process, "Inclination", vdPar[5]), 0.1, 179.9) ; // P07
|
|
vdPar[6] = ReadProcessChild( process, "Rotation", vdPar[6]) ; // P08
|
|
vdPar[7] = Clamp( ReadProcessChild( process, "ShapeRadius", vdPar[7]), 0.0, 1000.0) ; // P10
|
|
vdPar[8] = Clamp( ReadProcessChild( process, "Height", vdPar[8]), 0.0, 1000.0) ; // P11
|
|
vdPar[9] = Clamp( ReadProcessChild( process, "Width", vdPar[9]), 0.0, 1000.0) ; // P12
|
|
vdPar[10] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[10]), -50000.0, 50000.0) ; // ~P14
|
|
vdPar[11] = Clamp( ReadProcessChild( process, "Length", vdPar[11]), 0.0, 50000.0) ; // ~P15
|
|
|
|
|
|
string sShape = process.child( "Shape").text().get() ; // P04
|
|
if ( sShape == "automatic" || sShape.empty())
|
|
vdPar[2] = 0 ;
|
|
else if ( sShape == "square")
|
|
vdPar[2] = 1 ;
|
|
else if ( sShape == "round")
|
|
vdPar[2] = 2 ;
|
|
else if ( sShape == "rounded")
|
|
vdPar[2] = 3 ;
|
|
else if ( sShape == "radius")
|
|
vdPar[2] = 4 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tenon Shape is unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadMortiseParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 50 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr){
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = 4 ;
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 14) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Mortise number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[2] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[2]), 0.0, 50000.0) ; // P03
|
|
vdPar[4] = Clamp( ReadProcessChild( process, "Angle", vdPar[4]), -180.0, 180.0) ; // P06
|
|
vdPar[6] = Clamp( ReadProcessChild( process, "Inclination", vdPar[6]), 0.1, 179.9) ; // P08
|
|
vdPar[7] = Clamp( ReadProcessChild( process, "ShapeRadius", vdPar[7]), 0.0, 1000.0) ; // P10
|
|
vdPar[8] = Clamp( ReadProcessChild( process, "Depth", vdPar[8]), 0.0, 1000.0) ; // P11
|
|
vdPar[9] = Clamp( ReadProcessChild( process, "Width", vdPar[9]), 0.0, 1000.0) ; // P12
|
|
vdPar[10] = Clamp( ReadProcessChild( process, "Length", vdPar[10]), 0.0, 50000.0) ; // P13
|
|
vdPar[13] = Clamp( ReadProcessChild( process, "Slope", vdPar[13]), 0.1, 179.9) ; // P16
|
|
|
|
string sShape = process.child( "Shape").text().get() ; // P04
|
|
if ( sShape == "automatic" || sShape.empty())
|
|
vdPar[3] = 0 ;
|
|
else if ( sShape == "square")
|
|
vdPar[3] = 1;
|
|
else if ( sShape == "round")
|
|
vdPar[3] = 2;
|
|
else if ( sShape == "rounded")
|
|
vdPar[3] = 3;
|
|
else if ( sShape == "radius")
|
|
vdPar[3] = 4;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Moritise Shape is unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
vdPar[11] = 0.0 ;
|
|
vdPar[12] = 0.0 ;
|
|
vdPar[5] = ANG_RIGHT ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadDovetailTenonParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con codici usate nel btl
|
|
nProc = 55 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup12( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Orientation unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 12) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Mortise number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // ~P02
|
|
vdPar[2] = ReadProcessChildBool( process, "LengthLimitedBottom", 0, true) ;
|
|
vdPar[3] = Clamp( ReadProcessChild( process, "Angle", vdPar[3]), 0.1, 179.9) ; // P06
|
|
vdPar[4] = Clamp( ReadProcessChild( process, "Inclination", vdPar[4]), 0.1, 179.9) ; // P07
|
|
vdPar[5] = Clamp( ReadProcessChild( process, "Rotation", vdPar[5]), 0.1, 179.9) ; // P08
|
|
double dWidth = Clamp( ReadProcessChild( process, "Width", 40.0 ), 0.0, 1000.0) ; // P09
|
|
vdPar[7] = Clamp( ReadProcessChild( process, "ConeAngle", vdPar[7]), 0.0, 30.0) ; // P10
|
|
vdPar[8] = Clamp( ReadProcessChild( process, "Height", vdPar[8]), 0.0, 1000.0) ; // P11
|
|
vdPar[9] = Clamp( ReadProcessChild( process, "ShapeRadius", vdPar[9]), 0.0, 1000.0) ; // P12
|
|
vdPar[10] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[10]), 0.0, 50000.0) ; // ~P14
|
|
vdPar[11] = Clamp( ReadProcessChild( process, "Length", vdPar[11]), 0.0, 50000.0) ; // ~P15
|
|
// vdPar[] = Clamp( ReadProcessChild( process, "FlankAngle", vdPar[]), 5.0, 35.0) ;
|
|
|
|
string sShape = process.child( "Shape").text().get() ; // ~P04
|
|
if ( sShape == "round") {
|
|
vdPar[6] = 0.0 ; // P09
|
|
vdPar[9] = dWidth * cos( vdPar[7] * DEGTORAD) / ( 1 - sin( vdPar[7] * DEGTORAD)) ; // P12
|
|
}
|
|
else if ( sShape == "radius" || sShape == "rounded" || sShape == "square" ) {
|
|
if ( sShape != "radius") // P12
|
|
vdPar[9] = DTMILL_DEF_RAD ;
|
|
vdPar[9] *= 2 ;
|
|
vdPar[6] = dWidth - vdPar[9] * ( 1 - sin( vdPar[7] * DEGTORAD)) / cos( vdPar[7] * DEGTORAD) ; // P09
|
|
if ( vdPar[6] < -10 * EPS_SMALL) {
|
|
LOG_ERROR( GetEExLogger(), " Error : Dovetail tenon width") ;
|
|
return false ;
|
|
}
|
|
vdPar[6] = max( vdPar[6], 0.) ;
|
|
}
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail Tenon Shape is unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
// Parametri vengono poi sistemati nella funzione AddDovetailTenonBTLX
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadDovetailMortiseParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 55 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = 4 ;
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 14) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail Mortise number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[2] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[2]), 0.0, 50000.0) ; // P03
|
|
vdPar[3] = ReadProcessChildBool( process, "LengthLimitedBottom", 0, true) ; // P04
|
|
vdPar[5] = Clamp( ReadProcessChild( process, "Angle", vdPar[5]), -180.0, 180.0) ; // P06
|
|
double dWidth = Clamp( ReadProcessChild( process, "Width", 40.0), 0.0, 1000.0) ;
|
|
vdPar[8] = Clamp( ReadProcessChild( process, "ConeAngle", vdPar[8]), 0.1, 179.9) ; // P10
|
|
vdPar[9] = Clamp( ReadProcessChild( process, "Depth", vdPar[9]), 0.0, 1000.0) ; // P11
|
|
vdPar[10] = Clamp( ReadProcessChild( process, "ShapeRadius", vdPar[10]), 0.0, 1000.0) ; // P12
|
|
vdPar[11] = Clamp( ReadProcessChild( process, "Length", vdPar[11]), 0.0, 50000.0) ; // P13
|
|
|
|
string sLimitationTop = process.child( "LimitationTop").text().get() ; // P05
|
|
if ( sLimitationTop == "unlimited")
|
|
vdPar[4] = 0 ;
|
|
else if ( sLimitationTop == "pocket")
|
|
vdPar[4] = 1 ;
|
|
else if ( sLimitationTop != "limited") {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail Mortise LimitationTop unkown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sShape = process.child( "Shape").text().get() ;
|
|
if ( sShape == "round") {
|
|
vdPar[7] = 0 ; // P09
|
|
vdPar[10] = dWidth * cos( vdPar[8] * DEGTORAD) / ( 1 - sin( vdPar[8] * DEGTORAD)) ; // P12
|
|
}
|
|
else if ( sShape == "radius" || sShape == "rounded" || sShape == "square") {
|
|
if ( sShape != "radius") // P12
|
|
vdPar[10] = DTMILL_DEF_RAD ;
|
|
vdPar[10] *= 2 ; // P12
|
|
vdPar[7] = dWidth - vdPar[10] * ( 1 - sin( vdPar[8] * DEGTORAD)) / cos( vdPar[8] * DEGTORAD) ; // P09
|
|
if ( vdPar[7] < - 10 * EPS_SMALL) {
|
|
LOG_ERROR( GetEExLogger(), " Error : Dovetail mortise width") ;
|
|
return false ;
|
|
}
|
|
vdPar[7] = max( vdPar[7], 0.) ;
|
|
}
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail mortise Shape is unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
vdPar[6] = ANG_RIGHT ; // P07
|
|
vdPar[12] = 0.0 ; // P14
|
|
vdPar[13] = 0.0 ; // P15
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadMarkingParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 60 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = 4 ;
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 8) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Text number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[2] = 0 ; // no text // P04
|
|
vdPar[3] = Clamp( ReadProcessChild( process, "Angle", vdPar[3]), 1.0, 180.0) ; // P06 ( range BTL)
|
|
vdPar[4] = Clamp( ReadProcessChild( process, "InteriorAngle", vdPar[4]), 0.0, 50000.0) ; // P13
|
|
double dWidth = Clamp( ReadProcessChild( process, "Width", 100.0), 0.0, 50000.0) ;
|
|
double dLength = Clamp( ReadProcessChild( process, "Length", 20.0), 0.0, 50000.0) ;
|
|
|
|
// Linea orizzontale
|
|
if ( abs( vdPar[3] - 180.0) < EPS_SMALL) {
|
|
vdPar[6] = dLength ;
|
|
return true ;
|
|
}
|
|
|
|
string sLimited = process.child( "LengthLimited").text().get() ; // P12
|
|
Vector3d vtD = FromPolar( 1, vdPar[3]) ;
|
|
if ( nGroup == 4)
|
|
vtD.Mirror( X_AX) ;
|
|
if ( sLimited == "no" || sLimited.empty())
|
|
vdPar[6] = 0.0 ; // la funzione AddMarking sistemerà il valore in base alla lunghezza del lato
|
|
else if ( sLimited == "yes")
|
|
if ( abs( vdPar[3]) < EPS_SMALL)
|
|
vdPar[6] = dLength ;
|
|
else
|
|
vdPar[6] = dLength * vtD.y ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: LengthLimited unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sStyle = process.child( "Style").text().get() ;
|
|
if ( sStyle == "single" || sStyle.empty()) { // P11
|
|
// Condizioni che identificano il caso della singola linea
|
|
vdPar[4] = 0.0 ;
|
|
vdPar[5] = 0.0 ;
|
|
}
|
|
else if ( sStyle == "double") {
|
|
vdPar[5] = dWidth * sin( vdPar[4] * DEGTORAD) / sin( vdPar[3] * DEGTORAD) ;
|
|
//Condizione che identifica il caso di linea doppia
|
|
vdPar[4] = 0.0 ;
|
|
}
|
|
else if ( sStyle == "square") {
|
|
Vector3d vtE = vtD ;
|
|
vtE.Rotate( Z_AX, ( ( nGroup == 3) ? vdPar[4] : - vdPar[4])) ;
|
|
vdPar[5] = dWidth * abs( vtE.x) ;
|
|
}
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MarkingStyle unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
nSPar = 1 ;
|
|
sPar = "" ; // P15
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadTextParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 61 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = 4 ;
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 8) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Text number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[2] = Clamp( ReadProcessChild( process, "Angle", vdPar[2]), -180.0, 180.0) ; // P06
|
|
vdPar[6] = ReadProcessChildBool( process, "StackedMarking", 0) ; // P12
|
|
vdPar[7] = Clamp( ReadProcessChild( process, "TextHeight", vdPar[7]), 0.0, 50000.0) ; // P13
|
|
|
|
nSPar = 1 ;
|
|
sPar = process.child( "Text").text().get() ; // P15
|
|
|
|
string sVAlignment = process.child( "AlignmentVertical").text().get() ; // P09
|
|
if ( sVAlignment == "bottom" || sVAlignment.empty())
|
|
vdPar[3] = 0 ;
|
|
else if ( sVAlignment == "middle")
|
|
vdPar[3] = 1;
|
|
else if ( sVAlignment == "top")
|
|
vdPar[3] = 2;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Text Vertical Alignment is unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sHAlignment = process.child( "AlignmentHorizontal").text().get() ; // P10
|
|
if ( sHAlignment == "left" || sHAlignment.empty())
|
|
vdPar[4] = 0 ;
|
|
else if ( sHAlignment == "middle")
|
|
vdPar[4] = 1 ;
|
|
else if ( sHAlignment == "right")
|
|
vdPar[4] = 2 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Text Horizontal Alignment is unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sMAlignment = process.child( "AlignmentMultiline").text().get() ; // P11
|
|
if ( sMAlignment == "left" || sMAlignment.empty())
|
|
vdPar[5] = 0 ;
|
|
else if ( sMAlignment == "middle")
|
|
vdPar[5] = 1 ;
|
|
else if ( sMAlignment == "right")
|
|
vdPar[5] = 2 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Text Multiline Alignment is unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadSimpleScarfParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 70 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup12( process) ;
|
|
if ( nGroup == -1 ) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: SimpleScarf orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 6) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: SimpleScarf number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = ReadProcessChild( process, "DepthRefSide", vdPar[1]) ; // P11
|
|
vdPar[2] = ReadProcessChild( process, "DepthOppSide", vdPar[2]) ; // P12
|
|
vdPar[3] = ReadProcessChild( process, "Length", vdPar[3]) ; // P13
|
|
vdPar[4] = ReadProcessChild( process, "DrillHoleDiam1", vdPar[4]) ; // P14
|
|
vdPar[5] = ReadProcessChild( process, "DrillHoleDiam2", vdPar[5]) ; // P15
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadScarfJointParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 71 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr){
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup12( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tenon orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk){
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 9) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ScarfJoint number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = ReadProcessChild( process, "Inclination", vdPar[1]) ; // P07
|
|
vdPar[3] = ReadProcessChild( process, "LapLength", vdPar[3]) ; // P10
|
|
vdPar[4] = ReadProcessChild( process, "LapDepth", vdPar[4]) ; // P11
|
|
vdPar[5] = ReadProcessChild( process, "DepthOppSide", vdPar[5]) ; // P12
|
|
vdPar[6] = ReadProcessChild( process, "Length", vdPar[6]) ; // P13
|
|
vdPar[7] = ReadProcessChild( process, "DrillHoleDiam1", vdPar[7]) ; // P14
|
|
vdPar[8] = ReadProcessChild( process, "DrillHoleDiam2", vdPar[8]) ; // P15
|
|
|
|
string sScarfShape = process.child( "ScarfShape").text().get() ; // P09
|
|
if ( sScarfShape == "classic")
|
|
vdPar[2] = 0 ;
|
|
else if ( sScarfShape == "refside" || sScarfShape.empty()) // se non esiste metto il valore di default
|
|
vdPar[2] = 1 ;
|
|
else if ( sScarfShape == "baseside")
|
|
vdPar[2] = -1 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ScarfJoint ScarfShape is unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadStepJointParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 80 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup12( process) ;
|
|
if ( nGroup == -1 ) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Step Joint orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 7) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: StepJoint number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[2] = ReadProcessChild( process, "StrutInclination", vdPar[2]) ; // P07
|
|
vdPar[3] = ReadProcessChild( process, "StepDepth", vdPar[3]) ; // P11
|
|
vdPar[4] = ReadProcessChild( process, "HeelDepth", vdPar[4]) ; // P12
|
|
vdPar[5] = ReadProcessChild( process, "TenonHeight", vdPar[5]) ; // P14
|
|
vdPar[6] = ReadProcessChild( process, "TenonWidth", vdPar[6]) ; // P15
|
|
|
|
string sStepShape = process.child( "StepShape").text().get() ; // P09
|
|
if ( sStepShape == "double" || sStepShape.empty())
|
|
vdPar[1] = 0 ;
|
|
else if ( sStepShape == "step")
|
|
vdPar[1] = 1 ;
|
|
else if ( sStepShape == "heel")
|
|
vdPar[1] = -1 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: StepJointNotch StepShape is unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadStepJointNotchParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 80 ;
|
|
if ( process.attribute( "ReferencePlaneID") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing reference plane") ;
|
|
return false ;
|
|
}
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup34( process) ;
|
|
if ( nGroup == -1 ) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Step Joint Notch orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 10) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: StepJoint number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[3] = ReadProcessChild( process, "StrutInclination", vdPar[3]) ; // P07
|
|
vdPar[4] = ReadProcessChild( process, "NotchWidth", vdPar[4]) ; // P10
|
|
vdPar[5] = ReadProcessChild( process, "StepDepth", vdPar[5]) ; // P11
|
|
vdPar[6] = ReadProcessChild( process, "HeelDepth", vdPar[6]) ; // P12
|
|
vdPar[7] = ReadProcessChild( process, "StrutHeight", vdPar[7]) ; // P13
|
|
vdPar[8] = ReadProcessChild( process, "MortiseHeight", vdPar[8]) ; // P14
|
|
vdPar[9] = ReadProcessChild( process, "MortiseWidth", vdPar[9]) ; // P15
|
|
|
|
string sStepShape = process.child( "StepShape").text().get() ; // P09
|
|
if ( sStepShape == "double" || sStepShape.empty()) {
|
|
}
|
|
else if ( sStepShape == "step") {
|
|
vdPar[6] = 0.0 ; // P12
|
|
}
|
|
else if ( sStepShape == "heel") {
|
|
vdPar[5] = 0.0 ; // P11
|
|
}
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: StepJointNotch StepShape is unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
// P04 = vdPar[2] = ?
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadPlaningParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 90 ;
|
|
nSide = BTL_SIDE_FRONT ;
|
|
nGroup = 4 ;
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 4) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Text number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[2] = Clamp( ReadProcessChild( process, "Depth", vdPar[2]), 0.0, 50.0) ; // P11
|
|
vdPar[3] = Clamp( ReadProcessChild( process, "Length", vdPar[3]), 0.0, 100000.0) ; // P12
|
|
|
|
string PlaneSide1 = ReadProcessChildYesNo( process, "PlaneSide1", "yes") ; // P04
|
|
string PlaneSide2 = ReadProcessChildYesNo( process, "PlaneSide2", "yes") ;
|
|
string PlaneSide3 = ReadProcessChildYesNo( process, "PlaneSide3", "yes") ;
|
|
string PlaneSide4 = ReadProcessChildYesNo( process, "PlaneSide4", "yes") ;
|
|
vdPar[1] = ComputeP04( { PlaneSide1, PlaneSide2, PlaneSide3, PlaneSide4}) ;
|
|
if ( vdPar[1] == -2)
|
|
return false ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadProfileFrontParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 100 ;
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup34( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ProfileFront orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 7) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ProfileFront number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "Depth", vdPar[1]), 0.0, 1000.0) ; // P03
|
|
vdPar[2] = ReadProcessChild( process, "Rotation1", vdPar[2]) ; // P06
|
|
vdPar[3] = ReadProcessChild( process, "Rotation2", vdPar[3]) ; // P07
|
|
vdPar[4] = Clamp( ReadProcessChild( process, "StartRotation", vdPar[4]), -90.0, 90.0) ; // P08
|
|
vdPar[5] = Clamp( ReadProcessChild( process, "Radius1", vdPar[5]), 0.0, 1000.0) ; // P11
|
|
vdPar[6] = Clamp( ReadProcessChild( process, "Radius2", vdPar[6]), 0.0, 1000.0) ; // P12
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadProfileCamberedParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 103 ;
|
|
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup34( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ProfileCambered orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 7) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ProfileCambered number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "Length", vdPar[1]), 0.0, 100000.0) ; // P10
|
|
vdPar[2] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[2]), 0.0, 1000.0) ; // P11
|
|
vdPar[3] = Clamp( ReadProcessChild( process, "MaxDepth", vdPar[3]), 0.0, 1000.0) ; // P12
|
|
vdPar[4] = Clamp( ReadProcessChild( process, "MinDepth", vdPar[4]), 0.0, 1000.0) ; // P13
|
|
vdPar[5] = Clamp( ReadProcessChild( process, "EndDepth", vdPar[5]), 0.0, 1000.0) ; // P14
|
|
|
|
string sPremill = process.child( "Premill").text().get() ; // P15
|
|
if ( sPremill == "round")
|
|
vdPar[6] = 0 ;
|
|
else if ( sPremill == "angular" || sPremill.empty())
|
|
vdPar[6] = 1 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ProfileCambered Premill unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadRoundArchParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 104 ;
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = 4 ;
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 3) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: RoundARch number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "Camber", vdPar[1]), 0.0, 1000.0) ; // P11
|
|
vdPar[2] = ReadProcessChild( process, "Length", vdPar[2]) ; // P12
|
|
|
|
string sArcShape = process.child( "ArcShape").text().get() ;
|
|
if ( sArcShape == "convex")
|
|
vdPar[1] = -vdPar[1] ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadProfileHeadParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 106 ;
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup34( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ProfileHead orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 16) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ProfileHead number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[2] = ReadProcessChild( process, "LapLength", vdPar[2]) ; // P09
|
|
vdPar[3] = ReadProcessChild( process, "LapHeight", vdPar[3]) ; // P10
|
|
|
|
// Tipologia archi // P04
|
|
string sArc1Shape = process.child( "Arc1").attribute( "ArcShape").value() ;
|
|
string sArc2Shape = process.child( "Arc2").attribute( "ArcShape").value() ;
|
|
vdPar[1] = 0 ;
|
|
if ( sArc1Shape != "concave")
|
|
vdPar[1] += 1 ;
|
|
if ( sArc2Shape != "concave")
|
|
vdPar[1] += 2 ;
|
|
|
|
// Arc 1
|
|
vdPar[4] = ReadProcessChildAttribute( process, "Arc1", "Displacement", vdPar[4]) ; // P11
|
|
vdPar[8] = ReadProcessChildAttribute( process, "Arc1", "LapLength", vdPar[8]) ; // P15
|
|
vdPar[9] = ReadProcessChildAttribute( process, "Arc1", "LapHeight", vdPar[9]) ; // P16
|
|
|
|
if ( process.child( "Arc1").child( "QuarterArc") != nullptr) {
|
|
vdPar[5] = process.child( "Arc1").child( "QuarterArc").attribute( "Radius").as_double() ; // P12
|
|
vdPar[6] = 0.0 ; // P13
|
|
vdPar[7] = 0.0 ; // P14
|
|
}
|
|
else if ( process.child( "Arc1").child( "Segment") != nullptr) {
|
|
vdPar[5] = process.child( "Arc1").child( "Segment").attribute( "Length").as_double() ; // P12
|
|
vdPar[6] = process.child( "Arc1").child( "Segment").attribute( "Height").as_double() ; // P13
|
|
vdPar[7] = process.child( "Arc1").child( "Segment").attribute( "Camber").as_double() ; // P14
|
|
}
|
|
else { // se non ci fosse metto i parametri a zero (non ai valori di default)
|
|
vdPar[5] = 0.0 ;
|
|
vdPar[6] = 0.0 ;
|
|
vdPar[7] = 0.0 ;
|
|
}
|
|
|
|
// Arc2
|
|
if ( process.child ( "Arc2") == nullptr) {
|
|
vdPar[10] = 0.0 ;
|
|
vdPar[11] = 0.0 ;
|
|
vdPar[12] = 0.0 ;
|
|
vdPar[13] = 0.0 ;
|
|
vdPar[14] = 0.0 ;
|
|
vdPar[15] = 0.0 ;
|
|
}
|
|
|
|
vdPar[10] = ReadProcessChildAttribute( process, "Arc2", "Displacement", vdPar[10]) ; // P17
|
|
vdPar[14] = ReadProcessChildAttribute( process, "Arc2", "LapLength", vdPar[14]) ; // P21
|
|
vdPar[15] = ReadProcessChildAttribute( process, "Arc2", "LapHeight", vdPar[15]) ; // P22
|
|
|
|
if ( process.child( "Arc2").child( "QuarterArc") != nullptr) {
|
|
vdPar[11] = process.child( "Arc2").child( "QuarterArc").attribute( "Radius").as_double() ; // P18
|
|
vdPar[12] = 0.0 ; // P19
|
|
vdPar[13] = 0.0 ; // P20
|
|
}
|
|
else if ( process.child( "Arc2").child( "Segment") != nullptr) {
|
|
vdPar[11] = process.child( "Arc2").child( "Segment").attribute( "Length").as_double() ; // P18
|
|
vdPar[12] = process.child( "Arc2").child( "Segment").attribute( "Height").as_double() ; // P19
|
|
vdPar[13] = process.child( "Arc2").child( "Segment").attribute( "Camber").as_double() ; // P20
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadSphereParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 107 ;
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = GetGroup34( process) ;
|
|
if ( nGroup == -1) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Sphere orientation unknwon") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 6) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Sphere number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[2] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[2]), -50000.0, 50000.0) ; // P03
|
|
vdPar[3] = Clamp( ReadProcessChild( process, "Radius", vdPar[3]), 0.0, 50000.0) ; // P11
|
|
vdPar[4] = Clamp( ReadProcessChild( process, "StartOffset", vdPar[4]), 0.0, 50000.0) ; // P12
|
|
vdPar[5] = Clamp( ReadProcessChild( process, "Length", vdPar[5]), 0.0, 50000.0) ; // P13
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadTriangleCutParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 120 ;
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
nGroup = 4 ;
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 9) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: TriangleCut number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
|
|
vdPar[2] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[2]), -50000.0, 50000.0) ; // P03
|
|
vdPar[3] = Clamp( ReadProcessChild( process, "Normal1X", vdPar[3]), -50000.0, 50000.0) ; // P10
|
|
vdPar[4] = Clamp( ReadProcessChild( process, "Normal1Y", vdPar[4]), -50000.0, 50000.0) ; // P11
|
|
vdPar[5] = Clamp( ReadProcessChild( process, "Normal1Z", vdPar[5]), -50000.0, 50000.0) ; // P12
|
|
vdPar[6] = Clamp( ReadProcessChild( process, "Normal2X", vdPar[6]), -50000.0, 50000.0) ; // P13
|
|
vdPar[7] = Clamp( ReadProcessChild( process, "Normal2Y", vdPar[7]), -50000.0, 50000.0) ; // P14
|
|
vdPar[8] = Clamp( ReadProcessChild( process, "Normal2Z", vdPar[8]), -50000.0, 50000.0) ; // P15
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadTyroleanDovetailParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 136 ;
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
string sOrientation = process.child( "Orientation").text().get() ;
|
|
string sCutOff = process.child( "CutOff").text().get() ;
|
|
if ( sCutOff.empty())
|
|
sCutOff = "no" ; // se non ci fosse, valore di default
|
|
|
|
if( sOrientation == "end" && sCutOff == "yes")
|
|
nGroup = 1 ;
|
|
else if (sOrientation == "start" && sCutOff == "yes")
|
|
nGroup = 2 ;
|
|
else if (sOrientation == "end" && sCutOff == "no")
|
|
nGroup = 3 ;
|
|
else if (sOrientation == "start" && sCutOff == "yes")
|
|
nGroup = 4 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tyrolean Dovetail group not defined") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk){
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 15) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: TriangleCut number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = ReadProcessChild( process, "StartY", vdPar[1]) ; // P02
|
|
vdPar[2] = ReadProcessChild( process, "StartDepth", vdPar[2]) ; // P03
|
|
vdPar[5] = ReadProcessChild( process, "Angle", vdPar[5]) ; // P06
|
|
vdPar[6] = Clamp( ReadProcessChild( process.child( "Frosh"), "Width", vdPar[6]), 0.0, 50000.0) ; // P07
|
|
vdPar[7] = Clamp( ReadProcessChild( process.child( "Frosh"), "Depth", vdPar[7]), 0.0, 50000.0) ; // P08
|
|
vdPar[8] = ReadProcessChild( process, "Slope", vdPar[8]) ; // P09
|
|
vdPar[9] = ReadProcessChild( process, "Height", vdPar[9]) ; // P11
|
|
vdPar[10] = Clamp( ReadProcessChild( process.child( "Klingschrot"), "Radius", vdPar[10]), 0.0, 50000.0) ; // P12
|
|
vdPar[11] = Clamp( ReadProcessChild( process.child( "Klingschrot"), "ArcLength", vdPar[11]), 0.0, 50000.0) ; // P13
|
|
vdPar[13] = Clamp( ReadProcessChild( process, "Length", vdPar[13]), 0.0, 50000.0) ; // P15
|
|
|
|
|
|
string sLapPosition = process.child( "LapPosition").text().get() ; // P04
|
|
if ( sLapPosition == "refedge" || sLapPosition.empty())
|
|
vdPar[3] = 1 ;
|
|
else if ( sLapPosition == "oppedge")
|
|
vdPar[3] = 0 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tyrolean Dovetail LapPosition unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sLapExit = process.child( "LapExit").text().get() ; // P05
|
|
if ( sLapExit == "none")
|
|
vdPar[4] = 0 ;
|
|
else if ( sLapExit == "mitre" || sLapExit.empty())
|
|
vdPar[4] = -1 ;
|
|
else if ( sLapExit == "rebate") {
|
|
if ( process.child( "RebateLength") != nullptr)
|
|
FromString( process.child( "RebateLength").text().get(), vdPar[4]) ;
|
|
else
|
|
vdPar[4] = 10.0 ; // valore di default
|
|
}
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tyrolean Dovetail LapExit unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sShape = process.child( "Shape").text().get() ; // P14
|
|
if ( sShape == "straigth")
|
|
vdPar[12] = 1 ;
|
|
else if ( sShape == "angular" || sShape.empty())
|
|
vdPar[12] = 0 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tyrolean Dovetail Shape unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sProcessSide = process.child( "ProcessSide").text().get() ; // P16
|
|
if ( sProcessSide == "both" || sProcessSide.empty())
|
|
vdPar[14] = 0 ;
|
|
else if ( sProcessSide == "refside")
|
|
vdPar[14] = 1 ;
|
|
else if ( sProcessSide == "oppside")
|
|
vdPar[14] = 2 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tyrolean Dovetail Shape unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadDovetailParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
|
|
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar)
|
|
{
|
|
// Identifico il processo con sigle usate nel btl
|
|
nProc = 138 ;
|
|
nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
string sOrientation = process.child( "Orientation").text().get() ;
|
|
string sCutOff = process.child( "CutOff").text().get() ;
|
|
if ( sCutOff.empty())
|
|
sCutOff = "no" ; // se non ci fosse, valore di default
|
|
|
|
if( sOrientation == "end" && sCutOff == "yes")
|
|
nGroup = 1 ;
|
|
else if ( sOrientation == "start" && sCutOff == "yes")
|
|
nGroup = 2 ;
|
|
else if ( sOrientation == "end" && sCutOff == "no")
|
|
nGroup = 3 ;
|
|
else if ( sOrientation == "start" && sCutOff == "yes")
|
|
nGroup = 4 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail group not defined") ;
|
|
return false ;
|
|
}
|
|
|
|
// Inizializzo i vettori dei parametri
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 11) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
|
|
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
|
|
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), 0.0, 50000.0) ; // P02
|
|
vdPar[2] = ReadProcessChild( process, "StartDepth", vdPar[2]) ; // P03
|
|
vdPar[5] = ReadProcessChild( process, "Slope", vdPar[5]) ; // P09
|
|
vdPar[6] = ReadProcessChild( process, "HeightRefSide", vdPar[6]) ; // P11
|
|
vdPar[7] = ReadProcessChild( process, "HeightOppSide", vdPar[7]) ; // P12
|
|
vdPar[9] = ReadProcessChild( process, "Length", vdPar[9]) ; // P09
|
|
|
|
string sShape = process.child( "Shape").text().get() ; // P14
|
|
if ( sShape == "european" || sShape.empty())
|
|
vdPar[8] = 0 ;
|
|
else if ( sShape == "american")
|
|
vdPar[8] = 1 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tyrolean Dovetail Shape unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sLapPosition = process.child( "LapPosition").text().get() ;
|
|
if ( sLapPosition == "refedge" || sLapPosition.empty())
|
|
vdPar[3] = 1 ;
|
|
else if ( sLapPosition == "oppedge")
|
|
vdPar[3] = 0 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail LapPosition unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sLapExit = process.child( "LapExit").text().get() ; // P05
|
|
if ( sLapExit == "none")
|
|
vdPar[4] = 0 ;
|
|
else if ( sLapExit == "mitre" || sLapExit.empty())
|
|
vdPar[4] = -1 ;
|
|
else if ( sLapExit == "rebate") {
|
|
if ( process.child( "RebateLength") != nullptr)
|
|
FromString( process.child( "RebateLength").text().get(), vdPar[4]) ;
|
|
else
|
|
vdPar[4] = 10.0 ; // valore di default
|
|
}
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tyrolean Dovetail LapExit unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sProcessSide = process.child( "ProcessSide").text().get() ; // P16
|
|
if ( sProcessSide == "both" || sProcessSide.empty())
|
|
vdPar[10] = 0 ;
|
|
else if ( sProcessSide == "refside")
|
|
vdPar[10] = 1 ;
|
|
else if ( sProcessSide == "oppside")
|
|
vdPar[10] = 2 ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Tyrolean Dovetail Shape unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadFreeContourParams( pugi::xml_node process, const STRVECTOR& vsUAtt)
|
|
{
|
|
// identifico il processo con sigle usate nel btl
|
|
int nProc = 250 ;
|
|
int nSide = process.attribute( "ReferencePlaneID").as_int() ;
|
|
string sToolPosition = process.attribute( "ToolPosition").value() ;
|
|
int nGroup = 0 ;
|
|
if ( sToolPosition == "left")
|
|
nGroup = 3 ;
|
|
else if ( sToolPosition == "right")
|
|
nGroup = 4 ;
|
|
else if ( sToolPosition != "center") {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Free Contour group not defined") ;
|
|
return false ;
|
|
}
|
|
|
|
// recupero parametri del free contour
|
|
bool bCounterSink = false ;
|
|
string sCounterSink = process.attribute( "CounterSink").value() ;
|
|
if ( sCounterSink == "yes")
|
|
bCounterSink = true ;
|
|
else if ( sCounterSink == "no")
|
|
bCounterSink = false ;
|
|
else {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FreeContour CounterSink is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
int nCrvCnt = 1 ;
|
|
// scrorro i contours
|
|
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it ++) {
|
|
|
|
string sName = it->name() ;
|
|
bool bContOk = true ;
|
|
if ( sName == "Contour") {
|
|
bContOk = ReadSContourParams( *it, 0, 0, nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
|
if ( ! bContOk)
|
|
return false ;
|
|
}
|
|
else if ( sName == "DualContour") {
|
|
bContOk = ReadDContourParams( *it, nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
|
if ( ! bContOk)
|
|
return false ;
|
|
}
|
|
else {
|
|
LOG_ERROR ( GetEExLogger(), " Error reading Part Processing: FreeContour type is wrong") ;
|
|
return false ;
|
|
}
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId, const int nGroup, const int nProc, const int nSide,
|
|
bool bCounterSink, int& nCrvCnt, const STRVECTOR& vsUAtt)
|
|
{
|
|
// recupero eventuale riferimento da UserReferencePlanes
|
|
Frame3d frRef ;
|
|
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_RIGHT) {
|
|
// se non esiste, errore
|
|
if ( m_mapRefPlanes.find( nSide) == m_mapRefPlanes.end()) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Reference Plane unknown") ;
|
|
return false ;
|
|
}
|
|
frRef = m_mapRefPlanes[nSide] ;
|
|
if ( ! frRef.IsValid()) {
|
|
LOG_ERROR( GetEExLogger(), ( " Error reading Part Process: FreeContour User Reference Plane " + to_string( nSide) + " is not valid").c_str()) ;
|
|
return false ;
|
|
}
|
|
}
|
|
|
|
// inizializzo i parametri
|
|
INTVECTOR vnDPar ;
|
|
int nSPar ;
|
|
DBLVECTOR vdPar ;
|
|
string sPar ;
|
|
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
|
|
if ( ! bParamsInfoOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
|
|
return false ;
|
|
}
|
|
if ( vdPar.size() != 14) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FreeContour number of parameters is wrong") ;
|
|
return false ;
|
|
}
|
|
|
|
// parametri propri del contour che non cambiano
|
|
vdPar[5] = bCounterSink ? 1 : 0 ;
|
|
string sDepthBounded = process.attribute( "DepthBounded").value() ;
|
|
if ( sDepthBounded == "no")
|
|
vdPar[3] = 0 ;
|
|
else
|
|
vdPar[3] = process.attribute( "Depth").as_double() ;
|
|
|
|
int nContourCnt = 0 ;
|
|
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it++)
|
|
nContourCnt ++ ;
|
|
|
|
int i = 0 ;
|
|
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it++) {
|
|
|
|
// reinizializzo i parametri
|
|
vdPar[0] = 0.0 ; vdPar[1] = 0.0 ; vdPar[2] = 0.0 ; vdPar[6] = 0.0 ; vdPar[8] = 0.0 ; vdPar[9] = 0.0 ; vdPar[10] = 0.0 ;
|
|
vdPar[4] = it->attribute( "Inclination").as_double() ;
|
|
|
|
i++ ;
|
|
if ( i != nContourCnt)
|
|
vdPar[7] = nCrvCnt + 1 ;
|
|
else
|
|
vdPar[7] = 0 ;
|
|
|
|
string sName = it->name() ;
|
|
// Start Point
|
|
if ( sName == "StartPoint") {
|
|
vdPar[6] = nType ;
|
|
|
|
if ( nType == 100 || nType == 101) // salvo id del contour associato
|
|
vdPar[4] = nOtherId ;
|
|
|
|
if ( it->attribute( "X") == nullptr || it->attribute( "Y") == nullptr || it->attribute( "Z") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour StartPoint component missing") ;
|
|
return false ;
|
|
}
|
|
vdPar[0] = it->attribute( "X").as_double() ;
|
|
vdPar[1] = it->attribute( "Y").as_double() ;
|
|
vdPar[2] = it->attribute( "Z").as_double() ;
|
|
}
|
|
|
|
// Line
|
|
else if ( sName == "Line") {
|
|
vdPar[6] = 1 ;
|
|
|
|
if ( it->child( "EndPoint") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Line EndPoint missing") ;
|
|
return false ;
|
|
}
|
|
if ( it->child( "EndPoint").attribute( "X") == nullptr || it->child( "EndPoint").attribute( "Y") == nullptr ||
|
|
it->child( "EndPoint").attribute( "Z") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Line EndPoint component missing") ;
|
|
return false ;
|
|
}
|
|
vdPar[0] = it->child( "EndPoint").attribute( "X").as_double() ;
|
|
vdPar[1] = it->child( "EndPoint").attribute( "Y").as_double() ;
|
|
vdPar[2] = it->child( "EndPoint").attribute( "Z").as_double() ;
|
|
}
|
|
|
|
// Arc
|
|
else if ( sName == "Arc") {
|
|
vdPar[6] = 2 ;
|
|
|
|
if ( it->child( "EndPoint") == nullptr || it->child( "PointOnArc") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Arc EndPoint missing") ;
|
|
return false ;
|
|
}
|
|
if ( it->child( "EndPoint").attribute( "X") == nullptr ||
|
|
it->child( "EndPoint").attribute( "Y") == nullptr ||
|
|
it->child( "EndPoint").attribute( "Z") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Arc end point component missing") ;
|
|
return false ;
|
|
}
|
|
vdPar[0] = it->child( "EndPoint").attribute( "X").as_double() ;
|
|
vdPar[1] = it->child( "EndPoint").attribute( "Y").as_double() ;
|
|
vdPar[2] = it->child( "EndPoint").attribute( "Z").as_double() ;
|
|
|
|
if ( it->child( "PointOnArc").attribute( "X") == nullptr ||
|
|
it->child( "PointOnArc").attribute( "Y") == nullptr ||
|
|
it->child( "PointOnArc").attribute( "Z") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Arc component missing") ;
|
|
return false ;
|
|
}
|
|
vdPar[8] = it->child( "PointOnArc").attribute( "X").as_double() ;
|
|
vdPar[9] = it->child( "PointOnArc").attribute( "Y").as_double() ;
|
|
vdPar[10] = it->child( "PointOnArc").attribute( "Z").as_double() ;
|
|
}
|
|
else {
|
|
LOG_ERROR ( GetEExLogger(), " Error reading Part Process: FreeContour Contour element unknown") ;
|
|
return false ;
|
|
}
|
|
|
|
string sDes ;
|
|
bool bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nCrvCnt, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
|
|
if ( ! bProcessOk) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddProcess error") ;
|
|
return false ;
|
|
}
|
|
nCrvCnt ++ ;
|
|
}
|
|
|
|
return true ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
bool
|
|
ImportBtlx::ReadDContourParams( pugi::xml_node process, const int nGroup, const int nProc, const int nSide, bool bCounterSink,
|
|
int& nCrvCnt, const STRVECTOR& vsUAtt)
|
|
{
|
|
if ( process.child( "PrincipalContour") == nullptr || process.child( "AssociatedContour") == nullptr) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Process: DualContour contour missing") ;
|
|
return false ;
|
|
}
|
|
|
|
// principal contour
|
|
int nPrincipalId = nCrvCnt + 1 ;
|
|
int nPrincipalCrvCnt = 0 ;
|
|
// numero di curve nel principal contour
|
|
for ( pugi::xml_node_iterator it = process.child( "PrincipalContour").child( "Contour").begin() ;
|
|
it != process.child( "PrincipalContour").child( "Contour").end() ; it ++)
|
|
nPrincipalCrvCnt ++ ;
|
|
|
|
bool bContourOk = ReadSContourParams( process.child( "PrincipalContour"), 100, nCrvCnt + nPrincipalCrvCnt,
|
|
nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
|
if ( ! bContourOk)
|
|
return false ;
|
|
|
|
// associated Contour
|
|
bContourOk = ReadSContourParams( process.child( "AssociatedContour"), 101, nPrincipalId,
|
|
nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
|
|
if ( ! bContourOk)
|
|
return false ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
// -------------------------------------------------------------------------------------------------------------
|
|
// ------------------------- Funzioni ausiliarie ----------------------------------------------------------------
|
|
// -------------------------------------------------------------------------------------------------------------
|
|
|
|
int
|
|
GetGroup12( const pugi::xml_node& process)
|
|
{
|
|
string sOrientation = process.child( "Orientation").text().get() ;
|
|
if ( sOrientation == "start")
|
|
return 2 ;
|
|
else if ( sOrientation == "end")
|
|
return 1 ;
|
|
else
|
|
return -1 ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
int
|
|
GetGroup34( const pugi::xml_node& process)
|
|
{
|
|
string sOrientation = process.child( "Orientation").text().get() ;
|
|
if ( sOrientation == "start")
|
|
return 4 ;
|
|
else if ( sOrientation == "end")
|
|
return 3 ;
|
|
else
|
|
return -1 ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
double
|
|
ReadProcessChild( const pugi::xml_node& process, const string& sChild, double dVal)
|
|
{
|
|
if ( process.child( sChild.c_str()) != nullptr && process.child( sChild.c_str()).text().get() != nullptr) {
|
|
double dRes = dVal ;
|
|
FromString( process.child( sChild.c_str()).text().get(), dRes) ;
|
|
return dRes ;
|
|
}
|
|
else
|
|
return dVal ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
double
|
|
ReadProcessChildAttribute( const pugi::xml_node& process, const string& sChild, const string& sAttribute, double dVal)
|
|
{
|
|
if ( process.child( sChild.c_str()) != nullptr && process.child( sChild.c_str()).attribute( sAttribute.c_str()) != nullptr)
|
|
return process.child( sChild.c_str()).attribute( sAttribute.c_str()).as_double() ;
|
|
else
|
|
return dVal ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
int
|
|
ReadProcessChildBool( const pugi::xml_node& process, const string& sChild, const int& nDefaultVal, bool bInverted)
|
|
{
|
|
string sValue = process.child( sChild.c_str()).text().get() ;
|
|
if ( ! bInverted) {
|
|
if ( sValue == "yes")
|
|
return 1 ;
|
|
else if ( sValue == "no")
|
|
return 0 ;
|
|
}
|
|
else if ( bInverted) {
|
|
if ( sValue == "yes")
|
|
return 0 ;
|
|
else if ( sValue == "no")
|
|
return 1 ;
|
|
}
|
|
|
|
// se sValue fosse empty o valore non ammesso restituisco valore di default
|
|
return nDefaultVal ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------------------------------------------------------
|
|
string
|
|
ReadProcessChildYesNo( const pugi::xml_node& process, const string& sChild, const string& sDefaultVal)
|
|
{
|
|
if ( process.child( sChild.c_str()) == nullptr)
|
|
return sDefaultVal ;
|
|
else
|
|
return process.child( sChild.c_str()).text().get() ;
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------------
|
|
double
|
|
ReadProcessChildYesNoToDouble( const pugi::xml_node& process, const string& sChild1, const string& sDefaultOpt, const string& sChild2,
|
|
double nDefaultVal)
|
|
{
|
|
string sValue = process.child( sChild1.c_str()).text().get() ;
|
|
if ( sValue == sDefaultOpt || sValue.empty() || ( sValue != "no" && sValue != "yes"))
|
|
return 0.0 ;
|
|
else
|
|
return ReadProcessChild( process, sChild2, nDefaultVal) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------------------------------------------------------
|
|
int
|
|
ComputeP04( const STRVECTOR& vsValues)
|
|
{
|
|
if ( vsValues.size() > 6 || vsValues.empty()) {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: P04 is not valid") ;
|
|
return -2 ;
|
|
}
|
|
|
|
int nResult = 0 ;
|
|
for ( int i = 0 ; i < ssize( vsValues) ; i ++) {
|
|
if ( vsValues[i] == "no")
|
|
nResult += int( Pow( 2, i)) ;
|
|
else if ( vsValues[i] != "yes") {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit value is not valid") ;
|
|
return -2 ;
|
|
}
|
|
}
|
|
|
|
return nResult ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------------------------------------------------------
|
|
int
|
|
ComputeP04( const pugi::xml_node& MachiningLimits)
|
|
{
|
|
string sFaceLimitedStart = "yes" ;
|
|
if ( MachiningLimits.attribute( "FaceLimitedStart") != nullptr)
|
|
sFaceLimitedStart = MachiningLimits.attribute( "FaceLimitedStart").value() ;
|
|
|
|
string sFaceLimitedEnd = "yes" ;
|
|
if ( MachiningLimits.attribute( "FaceLimitedEnd") != nullptr)
|
|
sFaceLimitedEnd = MachiningLimits.attribute( "FaceLimitedEnd").value() ;
|
|
|
|
string sFaceLimitedFront = "yes" ;
|
|
if ( MachiningLimits.attribute( "FaceLimitedFront") != nullptr)
|
|
sFaceLimitedFront = MachiningLimits.attribute( "FaceLimitedFront").value() ;
|
|
|
|
string sFaceLimitedBack = "yes" ;
|
|
if ( MachiningLimits.attribute( "FaceLimitedBack") != nullptr)
|
|
sFaceLimitedBack = MachiningLimits.attribute( "FaceLimitedBack").value() ;
|
|
|
|
string sFaceLimitedBottom = "yes" ;
|
|
if ( MachiningLimits.attribute( "FaceLimitedBottom") != nullptr)
|
|
sFaceLimitedBottom = MachiningLimits.attribute( "FaceLimitedBottom").value() ;
|
|
|
|
string sFaceLimitedTop = "no" ;
|
|
if ( MachiningLimits.attribute( "FaceLimitedTop") != nullptr)
|
|
sFaceLimitedTop = MachiningLimits.attribute( "FaceLimitedTop").value() ;
|
|
|
|
int nResult = 0 ;
|
|
if ( sFaceLimitedStart == "no")
|
|
nResult += 1 ;
|
|
else if ( sFaceLimitedStart != "yes") {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
|
return -2 ;
|
|
}
|
|
|
|
if ( sFaceLimitedEnd == "no")
|
|
nResult += 2 ;
|
|
else if ( sFaceLimitedEnd != "yes") {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
|
return -2 ;
|
|
}
|
|
|
|
if ( sFaceLimitedFront == "no")
|
|
nResult += 4 ;
|
|
else if ( sFaceLimitedFront != "yes") {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
|
return -2 ;
|
|
}
|
|
|
|
if ( sFaceLimitedBack == "no")
|
|
nResult += 8 ;
|
|
else if ( sFaceLimitedBack != "yes") {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
|
return -2 ;
|
|
}
|
|
|
|
if ( sFaceLimitedBottom == "no")
|
|
nResult += 16 ;
|
|
else if ( sFaceLimitedBottom != "yes") {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
|
return -2 ;
|
|
}
|
|
|
|
if ( sFaceLimitedTop == "no")
|
|
nResult += 32 ;
|
|
else if ( sFaceLimitedTop != "yes") {
|
|
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit is not valid") ;
|
|
return -2 ;
|
|
}
|
|
|
|
return nResult ;
|
|
}
|