Compare commits

...

12 Commits

Author SHA1 Message Date
Riccardo Elitropi 063b0f5cc4 EgtExecutor (5AxTrimming) :
- prima versione per Linee di Direzione Utensile.
2026-05-15 18:03:54 +02:00
Dario Sassi 2da612140e EgtExecutor :
- aggiunte funzioni exe/lua AddRawPartGen (per definire un nuovo grezzo a partire da una curva con spessore o da una superficie).
2026-05-15 11:43:08 +02:00
Riccardo Elitropi 5d6f9c5d1d EgtExecutor :
- in ExePocketing aggiunto flag per CalcPocketing per ToolCompensation (Default=false).
2026-05-14 15:31:35 +02:00
Dario Sassi 83ee155b8a EgtExecutor :
- modifiche a EgtSurfTmSwept per avere RMF anche con curve piane e garantendo la retrocompatibilità.
2026-05-14 13:04:07 +02:00
SaraP 3ff02fe0fe EgtExecutor :
- nelle funzioni exe e lua ChainCurvesInGroup e ReorderCurvesInGroup aggiunta tolleranza come parametro opzionale.
2026-05-12 15:09:11 +02:00
Dario Sassi 52cb174832 EgtExecutor 3.1e2 :
- ricompilazione con cambio versione.
2026-05-12 09:48:45 +02:00
Riccardo Elitropi d3a6f99ba5 EgtExecutor :
- in CalcPocketing aggiunto flag per Conventional Milling ( default=true) per ExePocketing.
2026-05-11 10:07:37 +02:00
Dario Sassi e31fcee338 EgtExecutor 3.1e1 :
- ricompilazione con cambio versione.
2026-05-07 12:23:40 +02:00
Daniele Bariletti 4746474864 EgtExecutor :
- aggiunto argomento alla RegolarizeSurfaceLocally.
2026-05-07 11:29:44 +02:00
Daniele Bariletti 7cefd64b2a EgtExecutor :
- modificata funzione per la regolarize.
2026-04-22 16:42:46 +02:00
Daniele Bariletti 8a51d5e3a5 Merge branch 'Trimming' 2026-04-21 15:09:38 +02:00
Dario Sassi 00e6d24f2e EgtExecutor 3.1d3 :
- piccoli aggiustamenti.
2026-04-19 10:55:49 +02:00
10 changed files with 721 additions and 49 deletions
+2 -2
View File
@@ -59,8 +59,8 @@ ExePocketing( int nId, double dRad, double dStep, double dAngle, int nType, bool
// eseguo Pocketing
ICRVCOMPOPOVECTOR vCrvCompoRes ;
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, true, false, false, false, true, P_INVALID, nullptr, false,
dStep, 0, INFINITO, 0, 0, INFINITO, false, 0., 0., vCrvCompoRes) ;
bool bOk = CalcPocketing( pSfr, dRad, 0, dStep, dAngle, 5., nType, bSmooth, true, false, false, true, false, true, P_INVALID, nullptr, false,
dStep, 0, INFINITO, 0, 0, INFINITO, false, 0., 0., false, vCrvCompoRes) ;
nFirstId = GDB_ID_NULL ;
nCrvCount = int( vCrvCompoRes.size()) ;
if ( bOk && nCrvCount > 0) {
+5 -6
View File
@@ -2358,7 +2358,7 @@ ExeCurveCompoSetTempParam( int nId, int nCrv, double dParam, int nParamInd)
//-------------------------------------------------------------------------------
static bool
MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType)
MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, int nRefType, double dToler)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -2368,7 +2368,6 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in
if ( ! pGeomDB->GetGroupGlobFrame( nGroupId, frGrp))
return false ;
// preparo i dati per il concatenamento
double dToler = 10 * EPS_SMALL ;
ChainCurves chainC ;
chainC.Init( bAllowInvert, dToler, pGeomDB->GetGroupObjs( nGroupId)) ;
int nId = pGeomDB->GetFirstInGroup( nGroupId) ;
@@ -2412,9 +2411,9 @@ MyChainCurvesInGroup( int nGroupId, const Point3d& ptNear, bool bAllowInvert, in
//-------------------------------------------------------------------------------
bool
ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType, double dToler)
{
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, true, nRefType) ;
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, true, nRefType, dToler) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -2429,9 +2428,9 @@ ExeChainCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
//-------------------------------------------------------------------------------
bool
ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType)
ExeReorderCurvesInGroup( int nGroupId, const Point3d& ptNear, int nRefType, double dToler)
{
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, false, nRefType) ;
bool bOk = MyChainCurvesInGroup( nGroupId, ptNear, false, nRefType, dToler) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
+29 -8
View File
@@ -524,17 +524,38 @@ ExeAddRawPart( Point3d ptOrig, double dLength, double dWidth, double dHeight, Co
//-----------------------------------------------------------------------------
int
ExeAddRawPartWithPart( int nPartId, int nCrvId, double dOverMat, Color cCol)
ExeAddRawPartGen( int nCrvSrfId, double dOverMat, Color cCol)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// inserisco grezzo con pezzo nella macchinata corrente
int nId = pMachMgr->AddRawPartWithPart( nPartId, nCrvId, dOverMat, cCol) ;
int nId = pMachMgr->AddRawPart( nCrvSrfId, dOverMat, cCol) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAddRawPartGen(" + ToString( nCrvSrfId) + "," +
ToString( dOverMat) + ",{" +
ToString( cCol) + "})" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nId ;
}
//-----------------------------------------------------------------------------
int
ExeAddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// inserisco grezzo con pezzo nella macchinata corrente
int nId = pMachMgr->AddRawPartWithPart( nPartId, nCrvSrfId, dOverMat, cCol) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtAddRawPartWithPart(" + ToString( nPartId) + "," +
ToString( nCrvId) + "," +
ToString( nCrvSrfId) + "," +
ToString( dOverMat) + ",{" +
ToString( cCol) + "})" +
" -- Id=" + ToString( nId) ;
@@ -3142,12 +3163,12 @@ ExeGetClEntAxesVal( int nEntId, DBLVECTOR& vAxes)
//-----------------------------------------------------------------------------
bool
ExeGetClEntTDir( int nEntId, Vector3d& vTDir)
ExeGetClEntTDir( int nEntId, Vector3d& vtTDir)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) ;
// recupero vTDir
return pMachMgr->GetClEntTDir( nEntId, vTDir) ;
// recupero TDir
return pMachMgr->GetClEntTDir( nEntId, vtTDir) ;
}
//-----------------------------------------------------------------------------
@@ -3162,12 +3183,12 @@ ExeGetClEntCDir( int nEntId, Vector3d& vtCDir)
//-----------------------------------------------------------------------------
bool
ExeGetClEntADir( int nEntId, Vector3d& vADir)
ExeGetClEntADir( int nEntId, Vector3d& vtADir)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false) ;
// recupero ADir
return pMachMgr->GetClEntADir( nEntId, vADir) ;
return pMachMgr->GetClEntADir( nEntId, vtADir) ;
}
//-----------------------------------------------------------------------------
+540 -5
View File
@@ -16,6 +16,8 @@
#include "DllExchange.h"
#include "GeoTools.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -24,9 +26,12 @@
#include "/EgtDev/Include/EGkTrimming.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EGkDistPointCurve.h"
#include "/EgtDev/Include/EGkDistPointSurfBz.h"
#include "/EgtDev/Include/EGkSbzFromCurves.h"
#include <unordered_map>
#include <algorithm>
using namespace std ;
// ---------------------------------------------------------------------------
@@ -869,9 +874,536 @@ ExeTrimmingGetSurfBzSyncPoints( int nParentId, int nEdge1Id, int nEdge2Id, doubl
// ---------------------------------------------------------------------------
bool
ExeRegolarizeSurfaceLocally( int nSurfId, int nSyncStartId, int nSyncEndId, double dLinTol)
ExeTrimmingGetToolOrientationLines( int nParentId, int nMainEdgeId, int nOtherEdgeId, int nSyncLayerId, int nLineSId, int nLineEId,
double dThetaStart, double dPhiStart, double dThetaEnd, double dPhiEnd, double dInterpLenS,
double dInterpLenE, double dLinTol,
int& nInterpStartId, int& nStartId, int& nEndId, int& nInterpEndId)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Imposto i parametri di ritorno
nInterpStartId = GDB_ID_NULL, nStartId = GDB_ID_NULL, nEndId = GDB_ID_NULL, nInterpEndId = GDB_ID_NULL ;
// Se necessario aggiusto le tolleranze
double dMyLinTol = Clamp( dLinTol, EPS_SMALL, 1e5 * EPS_SMALL) ;
const double TOL = dMyLinTol ;
// Definisco costanti per interpolazione
const double INTERPOLATION_DIST = 0.5 ; // alzare
const double ISO_PAR_SAMPLE = 20.0 ;
// Recupero il riferimento del gruppo di destinazione
Frame3d frDest ;
bool bOk = ( pGeomDB->GetGlobFrame( nParentId, frDest)) ;
// Recupero le due Curve di bordo
const ICurve* pCrvMainEdge = GetCurve( pGeomDB->GetGeoObj( nMainEdgeId)) ;
const ICurve* pCrvOtherEdge = GetCurve( pGeomDB->GetGeoObj( nOtherEdgeId)) ;
bOk = bOk && ( pCrvMainEdge != nullptr && pCrvMainEdge->IsValid() && pCrvOtherEdge != nullptr && pCrvOtherEdge->IsValid()) ;
// Verifico che le curve siano entrambe Aperte o entrambe Chiuse e memorizzo il risultato
bOk = bOk && ( pCrvMainEdge->IsClosed() == pCrvOtherEdge->IsClosed()) ;
bool bBorderClosed = ( pCrvMainEdge->IsClosed()) ;
// Recupero le Linee di Sincronizzazione iniziali e finali e verifico che giacciano sulle Curve di Bordo
ICurve* pCrvSyncS = GetCurve( pGeomDB->GetGeoObj( nLineSId)) ;
ICurve* pCrvSyncE = GetCurve( pGeomDB->GetGeoObj( nLineEId)) ;
bOk = bOk && ( pCrvSyncS != nullptr && pCrvSyncS->IsValid() && pCrvSyncE != nullptr && pCrvSyncE->IsValid()) ;
BIPOINT Line1, Line2 ;
bOk = bOk && ( pCrvSyncS->GetStartPoint( Line1.first)) && ( pCrvSyncS->GetEndPoint( Line1.second)) ;
bOk = bOk && ( pCrvSyncE->GetStartPoint( Line2.first)) && ( pCrvSyncE->GetEndPoint( Line2.second)) ;
// --- se necessario oriento le linee di Sync in modo che inizino entrambe dal Bordo Main
if ( bOk) {
if ( pCrvMainEdge->IsPointOn( Line1.first, TOL))
bOk = ( pCrvOtherEdge->IsPointOn( Line1.second, TOL)) ;
else if ( pCrvOtherEdge->IsPointOn( Line1.first, TOL)) {
bOk = ( pCrvMainEdge->IsPointOn( Line1.second, TOL)) ;
if ( bOk) {
swap( Line1.first, Line1.second) ;
pCrvSyncS->Invert() ;
}
}
else
bOk = false ;
}
if ( bOk) {
if ( pCrvMainEdge->IsPointOn( Line2.first, TOL))
bOk = ( pCrvOtherEdge->IsPointOn( Line2.second, TOL)) ;
else if ( pCrvOtherEdge->IsPointOn( Line2.first, TOL)) {
bOk = ( pCrvMainEdge->IsPointOn( Line2.second, TOL)) ;
if ( bOk) {
swap( Line2.first, Line2.second) ;
pCrvSyncE->Invert() ;
}
}
else bOk = false ;
}
// Il percorso selezionato è il minore tra le due possibilità di percorrenza
if ( bOk && bBorderClosed) {
double dParS = 0. ;
PtrOwner<ICurveComposite> pCompoMainCL( ConvertCurveToComposite( pCrvMainEdge->Clone())) ;
bOk = ( ! IsNull( pCompoMainCL) && pCompoMainCL->IsValid() &&
pCompoMainCL->GetParamAtPoint( Line1.first, dParS, TOL)) ;
if ( bOk) {
pCompoMainCL->ChangeStartPoint( dParS) ;
double dLenE = 0., dLenMain = 0. ;
bOk = ( pCompoMainCL->GetLengthAtPoint( Line2.first, dLenE, TOL) &&
pCompoMainCL->GetLength( dLenMain)) ;
if ( dLenE > dLenMain / 2. + EPS_SMALL) {
swap( Line1, Line2) ;
swap( pCrvSyncS, pCrvSyncE) ;
}
}
}
// Calcolo la lunghezza delle due curve di Bordo
double dLenMain = 0., dLenOther = 0. ;
bOk = bOk && ( pCrvMainEdge->GetLength( dLenMain) && pCrvOtherEdge->GetLength( dLenOther) &&
dLenMain > 2. * TOL + dInterpLenS + dInterpLenE + EPS_SMALL &&
dLenOther > 2. * TOL + dInterpLenS + dInterpLenE + EPS_SMALL) ;
// Recupero i punti di sincronizzazione (se presenti)
BIPNTVECTOR vSyncPoints ; vSyncPoints.reserve( pGeomDB->GetGroupObjs( nSyncLayerId)) ;
int nLineId = pGeomDB->GetFirstInGroup( nSyncLayerId) ;
while ( bOk && nLineId != GDB_ID_NULL) {
// Recupero la Curva
const ICurve* pLine = GetCurve( pGeomDB->GetGeoObj( nLineId)) ;
bOk = bOk && ( pLine != nullptr && pLine->IsValid()) ;
if ( bOk) {
// Recupero gli Estremi
Point3d ptStart ; pLine->GetStartPoint( ptStart) ;
Point3d ptEnd ; pLine->GetEndPoint( ptEnd) ;
// Mi assicuro che gli estremi siano sulle curve di Bordo e orientati correttamente ( nel caso inverto)
double dDistS1 = INFINITO ;
if ( ! DistPointCurve( ptStart, *pCrvMainEdge).GetDist( dDistS1)) {
nLineId = pGeomDB->GetNext( nLineId) ;
continue ;
}
if ( dDistS1 < dLinTol) {
double dDistE2 = INFINITO ;
if ( ! DistPointCurve( ptEnd, *pCrvOtherEdge).GetDist( dDistE2) || dDistE2 > dLinTol) {
nLineId = pGeomDB->GetNext( nLineId) ;
continue ;
}
}
else {
double dDistS2 = INFINITO ;
if ( ! DistPointCurve( ptStart, *pCrvMainEdge).GetDist( dDistS2) || dDistS2 > dLinTol) {
nLineId = pGeomDB->GetNext( nLineId) ;
continue ;
}
double dDistE1 = INFINITO ;
if ( ! DistPointCurve( ptEnd, *pCrvOtherEdge).GetDist( dDistE1) || dDistE1 > dLinTol) {
nLineId = pGeomDB->GetNext( nLineId) ;
continue ;
}
swap( ptStart, ptEnd) ;
}
vSyncPoints.emplace_back( make_pair( ptStart, ptEnd)) ;
}
nLineId = pGeomDB->GetNext( nLineId) ;
}
// Recupero la superficie Bezier rigata
PtrOwner<ISurfBezier> pSurfBzRuled ;
if ( bOk) {
// Se non ho linee di sincronizzazione
if ( vSyncPoints.empty())
pSurfBzRuled.Set( GetSurfBezierRuledSmooth( pCrvMainEdge, pCrvOtherEdge, vSyncPoints, ISO_PAR_SAMPLE)) ;
// Se ho linee di sincronizzazione
else
pSurfBzRuled.Set( GetSurfBezierRuledGuided( pCrvMainEdge, pCrvOtherEdge, vSyncPoints, dMyLinTol)) ;
bOk = bOk && ( ! IsNull( pSurfBzRuled) && pSurfBzRuled->IsValid()) ;
}
// --- Calcolo delle Linee di Orientamento ---
if ( bOk) {
// Rotazione delle curve di Bordo rispetto al Bordo Main
double dLenS ; pCrvSyncS->GetLength( dLenS) ;
Line1.second = Line1.first + FromSpherical( dLenS, dThetaStart, dPhiStart) ;
double dLenE ; pCrvSyncE->GetLength( dLenE) ;
Line2.second = Line2.first + FromSpherical( dLenE, dThetaEnd, dPhiEnd) ;
// --- Eventuale Interpolazione Lineare di Raccordo all'Inizio ---
if ( dInterpLenS > TOL) {
double dExtension = dInterpLenS ;
double dLen = -1. ; pCrvMainEdge->GetLengthAtPoint( Line1.first, dLen, TOL) ;
if ( bBorderClosed) {
dLen -= dInterpLenS ;
if ( dLen < EPS_SMALL)
dLen = dLenMain + dLen ;
}
else {
if ( dLen < dInterpLenS - EPS_SMALL) {
dExtension = dLen ;
dLen = 0 ;
}
}
double dU = - 1;
bOk = pCrvMainEdge->GetParamAtLength( dLen, dU) ;
if ( bOk) {
// Definisco la linea si sincronizzazione
Point3d ptInterpS ; double dParU, dParV ;
PtrOwner<ICurveComposite> pCompoIso( nullptr) ;
BIPOINT LineInterpS ;
bOk = ( pCrvMainEdge->GetPointD1D2( dU, ICurve::FROM_MINUS, ptInterpS) &&
DistPointSurfBz( ptInterpS, *pSurfBzRuled).GetParamsAtMinDistPoint( dParU, dParV) &&
pCompoIso.Set( pSurfBzRuled->GetCurveOnV( dParU)) &&
pCompoIso->IsValid() &&
pCompoIso->GetStartPoint( LineInterpS.first) &&
pCompoIso->GetEndPoint( LineInterpS.second)) ;
if ( bOk) {
bool bFirst = true ;
// Interpolo
double dLenLineInterpS = Dist( LineInterpS.first, LineInterpS.second) ;
double dLenLine1 = Dist( Line1.first, Line1.second) ;
int nStep = max( 1, int( ceil( dExtension / INTERPOLATION_DIST))) ;
Vector3d vtInterpStart = ( LineInterpS.second - LineInterpS.first) ; vtInterpStart.Normalize() ;
Vector3d vtInterpEnd = ( Line1.second - Line1.first) ; vtInterpEnd.Normalize() ;
Vector3d vtDiff = vtInterpEnd - vtInterpStart ;
for ( int i = 0 ; bOk && i < ( nStep - 1) ; ++ i) { // ( nStep - 1) per evitare sovrapposizione con la Copia del vettore
double dI = double( i) ;
Vector3d vtInterp = vtInterpStart + ( dI / ( nStep - 1)) * vtDiff ;
double dUInterpMain = 0. ; Point3d ptInterpOnMain ;
double dCurrLen = dLen + ( dI * dExtension / ( nStep - 1)) ;
if ( dCurrLen > dLenMain)
dCurrLen -= dLenMain ;
bOk = ( pCrvMainEdge->GetParamAtLength( dCurrLen, dUInterpMain) &&
pCrvMainEdge->GetPointD1D2( dUInterpMain, ICurve::FROM_MINUS, ptInterpOnMain)) ;
if ( bOk) {
double dMagnitude = dLenLineInterpS + ( dI / ( nStep - 1)) * ( dLenLine1 - dLenLineInterpS) ;
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
bOk = ( ! IsNull( pLine) && pLine->Set( ptInterpOnMain, ptInterpOnMain + vtInterp * dMagnitude)) ;
if ( bOk) {
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pLine)) ;
bOk = ( nNewId != GDB_ID_NULL) ;
if ( bOk) {
if ( bFirst) {
nInterpStartId = nNewId ;
bFirst = false ;
}
}
}
}
}
}
}
}
// --- Interpolazione tra le due Linee di Sincronizzazione ---
if ( bOk) {
double dLenS = -1., dLenE = -1 ;
bOk = ( pCrvMainEdge->GetLengthAtPoint( Line1.first, dLenS, TOL) &&
pCrvMainEdge->GetLengthAtPoint( Line2.first, dLenE, TOL)) ;
if ( bOk) {
double dToTDist = 0. ;
if ( dLenS < dLenE)
dToTDist = dLenE - dLenS ;
else
dToTDist = ( dLenMain - dLenS) + dLenE ;
if ( dToTDist > TOL) {
bool bFirst = true ;
// Interpolo
double dLenLine1 = Dist( Line1.first, Line1.second) ;
double dLenLine2 = Dist( Line2.first, Line2.second) ;
int nStep = max( 1, int( ceil( dToTDist / INTERPOLATION_DIST))) ;
Vector3d vtLineS = ( Line1.second - Line1.first) ; vtLineS.Normalize() ;
Vector3d vtLineE = ( Line2.second - Line2.first) ; vtLineE.Normalize() ;
Vector3d vtDiff = ( vtLineE - vtLineS) ;
for ( int i = 0 ; bOk && i <= nStep ; ++ i) {
double dI = double( i) ;
Vector3d vtInterp = vtLineS + ( dI / nStep) * vtDiff ;
double dUInterpMain = 0. ; Point3d ptInterpOnMain ;
double dCurrLen = dLenS + ( dI * dToTDist / nStep) ;
if ( dCurrLen > dLenMain)
dCurrLen -= dLenMain ;
bOk = ( pCrvMainEdge->GetParamAtLength( dCurrLen, dUInterpMain) &&
pCrvMainEdge->GetPointD1D2( dUInterpMain, ICurve::FROM_MINUS, ptInterpOnMain)) ;
if ( bOk) {
double dMagnitude = dLenLine1 + ( dI / nStep) * ( dLenLine2 - dLenLine1) ;
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
bOk = ( ! IsNull( pLine) && pLine->Set( ptInterpOnMain, ptInterpOnMain + vtInterp * dMagnitude)) ;
if ( bOk) {
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pLine)) ;
bOk = ( nNewId != GDB_ID_NULL) ;
if ( bOk) {
if ( bFirst) {
nStartId = nNewId ;
bFirst = false ;
}
nEndId = nNewId ;
}
}
}
}
}
}
}
// --- Eventuale Interpolazione Lineare di Raccordo alla Fine ---
if ( bOk && dInterpLenE > TOL) {
double dExtension = dInterpLenE ;
double dLen = -1. ; pCrvMainEdge->GetLengthAtPoint( Line2.first, dLen, TOL) ;
if ( bBorderClosed) {
dLen += dInterpLenE ;
if ( dLen > dLenMain - EPS_SMALL)
dLen -= dLenMain ;
}
else {
if ( dLen > dLenMain - dInterpLenE - EPS_SMALL) {
dExtension = dLenMain - dLen ;
dLen = dLenMain ;
}
}
double dU = - 1 ;
bOk = pCrvMainEdge->GetParamAtLength( dLen, dU) ;
if ( bOk) {
// Definisco la linea si sincronizzazione
Point3d ptInterpE ; double dParU, dParV ;
PtrOwner<ICurveComposite> pCompoIso( nullptr) ;
BIPOINT LineInterpE ;
bOk = ( pCrvMainEdge->GetPointD1D2( dU, ICurve::FROM_MINUS, ptInterpE) &&
DistPointSurfBz( ptInterpE, *pSurfBzRuled).GetParamsAtMinDistPoint( dParU, dParV) &&
pCompoIso.Set( pSurfBzRuled->GetCurveOnV( dParU)) &&
pCompoIso->IsValid() &&
pCompoIso->GetStartPoint( LineInterpE.first) &&
pCompoIso->GetEndPoint( LineInterpE.second)) ;
if ( bOk) {
// Interpolo
double dLenLineInterpE = Dist( LineInterpE.first, LineInterpE.second) ;
double dLenLine2 = Dist( Line2.first, Line2.second) ;
int nStep = max( 1, int( ceil( dExtension / INTERPOLATION_DIST))) ;
Vector3d vtInterpStart = ( Line2.second - Line2.first) ; vtInterpStart.Normalize() ;
Vector3d vtInterpEnd = ( LineInterpE.second - LineInterpE.first) ; vtInterpEnd.Normalize() ;
Vector3d vtDiff = vtInterpEnd - vtInterpStart ;
for ( int i = 1 ; bOk && i < nStep ; ++ i) { // i = 1 per evitare la sopvrapposizione con la Copia del vettore
double dI = double( i) ;
Vector3d vtInterp = vtInterpStart + ( dI / ( nStep - 1)) * vtDiff ;
double dUInterpMain = 0. ; Point3d ptInterpOnMain ;
double dCurrLen = ( dLen - dExtension) + ( dI * dExtension / ( nStep - 1)) ;
if ( dCurrLen > dLenMain)
dCurrLen -= dLenMain ;
bOk = ( pCrvMainEdge->GetParamAtLength( dCurrLen, dUInterpMain) &&
pCrvMainEdge->GetPointD1D2( dUInterpMain, ICurve::FROM_MINUS, ptInterpOnMain)) ;
if ( bOk) {
double dMagnitude = dLenLine2 + ( dI / ( nStep - 1)) * ( dLenLineInterpE - dLenLine2) ;
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
bOk = ( ! IsNull( pLine) && pLine->Set( ptInterpOnMain, ptInterpOnMain + vtInterp * dMagnitude)) ;
if ( bOk) {
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pLine)) ;
bOk = ( nNewId != GDB_ID_NULL) ;
if ( bOk)
nInterpEndId = nNewId ;
}
}
}
}
}
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetToolOrientationLines(" + ToString( nParentId) + "," +
ToString( nMainEdgeId) + "," +
ToString( nOtherEdgeId) + "," +
ToString( nLineSId) + "," +
ToString( nLineEId) + "," +
ToString( dThetaStart) + "," +
ToString( dPhiStart) + "," +
ToString( dThetaEnd) + "," +
ToString( dPhiEnd) + "," +
ToString( dLinTol) + "," +
ToString( dInterpLenS) + "," +
ToString( dInterpLenE) + "," +
" -- bOk=" + ToString( bOk) +
" -- nInterpStartId=" + ToString( nInterpStartId) + ", nStartId=" + ToString( nStartId) +
", nEndId=" + ToString( nEndId) + ", nInterpEndId=" + ToString( nInterpEndId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
struct TrimmingInterval {
double dLenStart ;
double dLenEnd ;
Vector3d vtStart ;
Vector3d vtEnd ;
TrimmingInterval()
: dLenStart( - EPS_SMALL), dLenEnd( - EPS_SMALL), vtStart( V_INVALID), vtEnd( V_INVALID) {} ;
TrimmingInterval( double dLenS, double dLenE, const Vector3d& vtS, const Vector3d& vtE)
: dLenStart( dLenS), dLenEnd( dLenE), vtStart( vtS), vtEnd( vtE) {} ;
} ;
typedef vector<TrimmingInterval> TRIMMINGINTERVALVECTOR ;
// ---------------------------------------------------------------------------
bool
GetTrimmingInterval( const IGeomDB* pGeomDB, const ICurveComposite* pCompo, const Frame3d& frCompo, int nIdS, int nIdE, TrimmingInterval& TrimmingInt)
{
// Verifico validità dei parametri
VERIFY_GEOMDB( pGeomDB, false)
if ( pCompo == nullptr || ! pCompo->IsValid() || ! frCompo.IsValid())
return false ;
// Recupero le linee di Orienting
const ICurve* pGeoCrvS = GetCurve( pGeomDB->GetGeoObj( nIdS)) ;
const ICurve* pGeoCrvE = GetCurve( pGeomDB->GetGeoObj( nIdE)) ;
if ( pGeoCrvS != nullptr && pGeoCrvE != nullptr && pGeoCrvS->IsValid() && pGeoCrvE->IsValid()) {
// Recupero i punti base e i vettori direzioni ( sono ICurveLine*, ma le tratto come ICurve* generiche)
Point3d ptS = P_INVALID ; pGeoCrvS->GetStartPoint( ptS) ; // Line1.ptStart
Point3d ptE = P_INVALID ; pGeoCrvE->GetStartPoint( ptE) ; // Line2.ptStart
Vector3d vtS = V_INVALID ; pGeoCrvS->GetStartDir( vtS) ; // Line1.vtStart
Vector3d vtE = V_INVALID ; pGeoCrvE->GetStartDir( vtE) ; // Line2.vtStart
if ( ptS.IsValid() && ptE.IsValid() && vtS.IsValid() && vtE.IsValid()) {
// Recupero il Frame delle Linee
Frame3d frCrv1, frCrv2 ;
if ( ! pGeomDB->GetGlobFrame( nIdS, frCrv1) || ! pGeomDB->GetGlobFrame( nIdE, frCrv2))
return false ;
// Porto Tali valori nel riferimento dalla Composita
Point3d ptSLoc = GetLocToLoc( ptS, frCrv1, frCompo) ;
Point3d ptELoc = GetLocToLoc( ptE, frCrv2, frCompo) ;
Vector3d vtSLoc = GetLocToLoc( vtS, frCrv1, frCompo) ;
Vector3d vtELoc = GetLocToLoc( vtE, frCrv2, frCompo) ;
// Recupero il parametro sulla curva
double dParS = - EPS_PARAM, dParE = - EPS_PARAM ;
int nFlag = 0 ;
if ( DistPointCurve( ptSLoc, *pCompo).GetParamAtMinDistPoint( EPS_SMALL, dParS, nFlag) &&
DistPointCurve( ptELoc, *pCompo).GetParamAtMinDistPoint( EPS_SMALL, dParE, nFlag)) {
// Recupero la lunghezza su tale curva
double dLenS = - EPS_SMALL, dLenE = - EPS_SMALL ;
if ( pCompo->GetLengthAtParam( dParS, dLenS) && pCompo->GetLengthAtParam( dParE, dLenE)) {
TrimmingInt = TrimmingInterval( dLenS, dLenE, vtSLoc, vtELoc) ;
return true ;
}
}
}
}
return false ;
}
// ---------------------------------------------------------------------------
bool
Exe5AxTrimmingModifyToolDir( int nCrvId, int nPathId, int nTrimLayId, const INTVECTOR& vnOrientingId, const INTVECTOR& vnOrientingISId,
const INTVECTOR& vnOrientingSId, const INTVECTOR& vnOrientingEId, const INTVECTOR& vnOrientingIEId)
{
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// Verifico validità dei parametri
bool bOk = ( nCrvId != GDB_ID_NULL && nPathId != GDB_ID_NULL && nTrimLayId != GDB_ID_NULL &&
ssize( vnOrientingId) == ssize( vnOrientingISId) && ssize( vnOrientingISId) == ssize( vnOrientingSId) &&
ssize( vnOrientingSId) == ssize( vnOrientingEId) && ssize( vnOrientingEId) == ssize( vnOrientingIEId)) ;
// Recupero la curva di Bordo e la sua composit associata
const ICurve* pCrvBorder = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
bOk = bOk && ( pCrvBorder != nullptr && pCrvBorder->IsValid()) ;
PtrOwner<ICurveComposite> pCompoBorder( nullptr) ;
if ( bOk)
bOk = ( pCompoBorder.Set( ConvertCurveToComposite( pCrvBorder->Clone())) && pCompoBorder->IsValid()) ;
double dLen = - EPS_SMALL ;
if ( bOk)
bOk = pCompoBorder->GetLength( dLen) ;
// Recupero il Frame della curva corrente
Frame3d frCompo ;
bOk = bOk && ( pGeomDB->GetGlobFrame( nCrvId, frCompo)) ;
// Recupero i versori di interpolazione e creo dei gruppi
TRIMMINGINTERVALVECTOR vInterval ; vInterval.reserve( 3 * ssize( vnOrientingId)) ;
for ( int i = 0 ; bOk && i < ssize( vnOrientingId) ; ++ i) {
// Se presente Interpolazione iniziale
if ( vnOrientingISId[i] != GDB_ID_NULL && vnOrientingSId[i] != GDB_ID_NULL) {
TrimmingInterval myTrimInt ;
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingISId[i], vnOrientingSId[i], myTrimInt))
vInterval.emplace_back( myTrimInt) ;
}
// Interpolazione ( deve essere sempre presente, ma per scrupolo si controlla lo stesso)
if ( vnOrientingSId[i] != GDB_ID_NULL && vnOrientingEId[i] != GDB_ID_NULL) {
TrimmingInterval myTrimInt ;
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingSId[i], vnOrientingEId[i], myTrimInt))
vInterval.emplace_back( myTrimInt) ;
}
// Se presente Interpolazione finale
if ( vnOrientingEId[i] != GDB_ID_NULL && vnOrientingIEId[i] != GDB_ID_NULL) {
TrimmingInterval myTrimInt ;
if ( GetTrimmingInterval( pGeomDB, pCompoBorder, frCompo, vnOrientingEId[i], vnOrientingIEId[i], myTrimInt))
vInterval.emplace_back( myTrimInt) ;
}
}
// Se ho degli intervalli di Interpolazione
if ( ! vInterval.empty()) {
// Scorro i vettori presenti nel Layer ausiliario della lavorazione
int nId = pGeomDB->GetFirstInGroup( nPathId) ;
while ( bOk && nId != GDB_ID_NULL) {
IGeoVector3d* vGeo = GetGeoVector3d( pGeomDB->GetGeoObj( nId)) ;
if ( vGeo != nullptr && vGeo->IsValid()) {
// Recupero i parametri di tale vettore
Point3d ptBase = vGeo->GetBase() ;
Vector3d vtDirV = V_INVALID ; ;
if ( pGeomDB->GetInfo( nId, "DirV", vtDirV) && vtDirV.IsValid()) {
// Recupero la lunghezza associata al Punto di Base sulla Compo
double dCurrPar = - EPS_SMALL ;
int nFlag = 0 ;
if ( DistPointCurve( ptBase, *pCompoBorder).GetParamAtMinDistPoint( 0., dCurrPar, nFlag)) {
double dCurrLen = - EPS_SMALL ;
if ( pCompoBorder->GetLengthAtParam( dCurrPar, dCurrLen)) {
for ( const TrimmingInterval& CurrInterval : vInterval) {
// Controlli per Intervalli a cavallo dei punti iniziali e finali della curva
double dLenA = CurrInterval.dLenStart ;
double dLenB = CurrInterval.dLenEnd ;
double dLenC = dCurrLen ;
if ( dLenA > dLenB) {
dLenB += dLen ;
if ( dLenC < CurrInterval.dLenStart - EPS_SMALL)
dLenC += dLen ;
}
// Se l'intervallo non è troppo piccolo e se sono all'interno di tale Intervallo
if ( dLenB - dLenA > 10. * EPS_SMALL && /* bastava anche 2 * EPS_SMALL */
dLenA + EPS_SMALL < dLenC && dLenC < dLenB + EPS_SMALL /* estremi esclusi, va bene ? */) {
// Media pesata dei due vettori
double dMeanPar = ( dLenC - dLenA) / ( dLenB - dLenA) ;
Vector3d vtMean = Media( CurrInterval.vtStart, CurrInterval.vtEnd, dMeanPar) ;
// Assegno la Info a tale vettore
pGeomDB->SetInfo( nId, "DirV", vtMean) ;
break ; // non controllo altri intervalli
}
}
}
}
}
}
nId = pGeomDB->GetNext( nId) ;
}
}
ExeSetModified() ;
// Se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtTrimmingGetToolOrientationLines(" + ToString( nCrvId) + "," +
ToString( nPathId) + "," +
ToString( nTrimLayId) + "," +
ToString( vnOrientingId) + "," +
ToString( vnOrientingISId) + "," +
ToString( vnOrientingSId) + "," +
ToString( vnOrientingEId) + "," +
ToString( vnOrientingIEId) + "," +
" -- bOk=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
// ---------------------------------------------------------------------------
int
ExeRegolarizeSurfaceLocally( int nParentId, int nSurfId, int nSyncStartId, int nSyncEndId, double dLinTol, int nType)
{
bool bOk = true ;
// Verifica database geometrico
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -888,8 +1420,11 @@ ExeRegolarizeSurfaceLocally( int nSurfId, int nSyncStartId, int nSyncEndId, doub
Point3d ptS2 ; pSyncEnd->GetStartPoint( ptS2) ;
Point3d ptE2 ; pSyncEnd->GetEndPoint( ptE2) ;
BIPOINT bpIsoEnd( ptS2, ptE2) ;
PtrOwner<ISurfBezier> pNewSurf( RegolarizeBordersLocally( pSurfBez, bpIsoStart, bpIsoEnd, dLinTol, nType)) ;
if ( IsNull( pNewSurf))
return GDB_ID_NULL ;
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pNewSurf)) ;
bOk = RegolarizeBordersLocally( pSurfBez, bpIsoStart, bpIsoEnd, 0.2) ;
return bOk ;
return nId ;
}
BIN
View File
Binary file not shown.
+8
View File
@@ -38,6 +38,8 @@ AdjustId( int nId, int nCtx)
Vector3d
GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc)
{
if ( ! vtV.IsValid())
return vtV ;
Vector3d vtVL( vtV) ;
if ( nRefType == RTY_GLOB)
vtVL.ToLoc( frLoc) ;
@@ -50,6 +52,8 @@ GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame
Vector3d
GetVectorInRef( IGeomDB* pGeomDB, const Vector3d& vtV, const Frame3d& frLoc, int nRefType)
{
if ( ! vtV.IsValid())
return vtV ;
Vector3d vtVL( vtV) ;
if ( nRefType == RTY_GLOB)
vtVL.ToGlob( frLoc) ;
@@ -62,6 +66,8 @@ GetVectorInRef( IGeomDB* pGeomDB, const Vector3d& vtV, const Frame3d& frLoc, int
Point3d
GetPointLocal( IGeomDB* pGeomDB, const Point3d& ptP, int nRefType, const Frame3d& frLoc)
{
if ( ! ptP.IsValid())
return ptP ;
Point3d ptPL( ptP) ;
if ( nRefType == RTY_GLOB)
ptPL.ToLoc( frLoc) ;
@@ -74,6 +80,8 @@ GetPointLocal( IGeomDB* pGeomDB, const Point3d& ptP, int nRefType, const Frame3d
Point3d
GetPointInRef( IGeomDB* pGeomDB, const Point3d& ptP, const Frame3d& frLoc, int nRefType)
{
if ( ! ptP.IsValid())
return ptP ;
Point3d ptPL( ptP) ;
if ( nRefType == RTY_GLOB)
ptPL.ToGlob( frLoc) ;
+1 -1
View File
@@ -805,7 +805,7 @@ LuaCreateSurfTmSwept( lua_State* L)
int nGuideId ;
LuaCheckParam( L, 3, nGuideId)
int nPar = 4 ;
Vector3d vtAx = V_NULL ;
Vector3d vtAx = V_INVALID ;
if ( LuaGetParam( L, nPar, vtAx))
++ nPar ;
bool bCapEnds ;
+13 -9
View File
@@ -409,7 +409,7 @@ LuaTrimExtendCurveByLen( lua_State* L)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// taglio o allungo la curva nell'estremo più vicino al punto
// taglio o allungo la curva nell'estremo più vicino al punto
bool bOk = ExeTrimExtendCurveByLen( nId, dLen, ptNear, nRefType) ;
LuaSetParam( L, bOk) ;
return 1 ;
@@ -943,7 +943,7 @@ LuaCurveCompoSetTempProp( lua_State* L)
int nPropInd = 0 ;
LuaGetParam( L, 4, nPropInd) ;
LuaClearStack( L) ;
// imposto sulla curva della composita la proprietà temporanea
// imposto sulla curva della composita la proprietà temporanea
bool bOk = ExeCurveCompoSetTempProp( nId, nCrv, nProp, nPropInd) ;
LuaSetParam( L, bOk) ;
return 1 ;
@@ -973,16 +973,18 @@ LuaCurveCompoSetTempParam( lua_State* L)
static int
LuaChainCurvesInGroup( lua_State* L)
{
// 2 o 3 parametri : nGroupId, ptNear [, nRefType]
// 2, 3 o 4 parametri : nGroupId, ptNear [, nRefType] [, dToler]
int nGroupId ;
LuaCheckParam( L, 1, nGroupId)
Point3d ptNear ;
LuaCheckParam( L, 2, ptNear)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 3, nRefType) ;
double dToler = 10 * EPS_SMALL ;
LuaGetParam( L, 4, dToler) ;
LuaClearStack( L) ;
// concateno le curve nel gruppo (senza fonderle in una curva composita)
bool bOk = ExeChainCurvesInGroup( nGroupId, ptNear, nRefType) ;
bool bOk = ExeChainCurvesInGroup( nGroupId, ptNear, nRefType, dToler) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -991,16 +993,18 @@ LuaChainCurvesInGroup( lua_State* L)
static int
LuaReorderCurvesInGroup( lua_State* L)
{
// 2 o 3 parametri : nGroupId, ptNear [, nRefType]
// 2, 3 o 4 parametri : nGroupId, ptNear [, nRefType] [, dToler]
int nGroupId ;
LuaCheckParam( L, 1, nGroupId)
Point3d ptNear ;
LuaCheckParam( L, 2, ptNear)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 3, nRefType) ;
double dToler = 10 * EPS_SMALL ;
LuaGetParam( L, 4, dToler) ;
LuaClearStack( L) ;
// riordino le curve nel gruppo (senza fonderle in una curva composita)
bool bOk = ExeReorderCurvesInGroup( nGroupId, ptNear, nRefType) ;
bool bOk = ExeReorderCurvesInGroup( nGroupId, ptNear, nRefType, dToler) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
@@ -1021,7 +1025,7 @@ LuaProjectCurveOnSurf( lua_State* L)
if ( LuaGetParam( L, 4, dLinTol))
LuaGetParam( L, 5, dMaxSegmLen) ;
LuaClearStack( L) ;
// proietto la curva su una o più superfici a minima distanza
// proietto la curva su una o più superfici a minima distanza
bool bOk = ExeProjectCurveOnSurf( nCurveId, vSurfId, nDestGrpId, dLinTol, dMaxSegmLen) ;
LuaSetParam( L, bOk) ;
return 1 ;
@@ -1051,7 +1055,7 @@ LuaProjectCurveOnSurfDir( lua_State* L)
LuaGetParam( L, 8, bFromVsTo))
LuaGetParam( L, 9, nRefType) ;
LuaClearStack( L) ;
// proietto la curva su una o più superfici secondo la direzione data
// proietto la curva su una o più superfici secondo la direzione data
bool bOk = ExeProjectCurveOnSurfDir( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, bFromVsTo, nRefType) ;
LuaSetParam( L, bOk) ;
return 1 ;
@@ -1079,7 +1083,7 @@ LuaProjectCurveOnSurfExt( lua_State* L)
LuaGetParam( L, 7, bDirFromGuide))
LuaGetParam( L, 8, bFromVsTo) ;
LuaClearStack( L) ;
// proietto la curva su una o più superfici secondo la direzione verso la guida
// proietto la curva su una o più superfici secondo la direzione verso la guida
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide, bFromVsTo) ;
LuaSetParam( L, bOk) ;
return 1 ;
+36 -12
View File
@@ -504,6 +504,7 @@ LuaGetNextRawPart( lua_State* L)
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaAddRawPart( lua_State* L)
@@ -530,6 +531,28 @@ LuaAddRawPart( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaAddRawPartGen( lua_State* L)
{
// 3 parametri : nCrvSrfId, dOverMat, Color
int nCrvSrfId ;
LuaCheckParam( L, 1, nCrvSrfId)
double dOverMat ;
LuaCheckParam( L, 2, dOverMat)
Color cCol ;
LuaCheckParam( L, 3, cCol)
LuaClearStack( L) ;
// inserisco il grezzo nella macchinata corrente
int nInd = ExeAddRawPartGen( nCrvSrfId, dOverMat, cCol) ;
// restituisco il risultato
if ( nInd != GDB_ID_NULL)
LuaSetParam( L, nInd) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaAddRawPartWithPart( lua_State* L)
@@ -3317,11 +3340,11 @@ LuaGetClEntTDir( lua_State* L)
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero vTDir
Vector3d vTDir ;
bool bOk = ExeGetClEntTDir( nEntId, vTDir) ;
// recupero TDir
Vector3d vtTDir ;
bool bOk = ExeGetClEntTDir( nEntId, vtTDir) ;
if ( bOk)
LuaSetParam( L, vTDir) ;
LuaSetParam( L, vtTDir) ;
else
LuaSetParam( L) ;
return 1 ;
@@ -3335,11 +3358,11 @@ LuaGetClEntCDir( lua_State* L)
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero vCDir
Vector3d vCDir ;
bool bOk = ExeGetClEntCDir( nEntId, vCDir) ;
// recupero CDir
Vector3d vtCDir ;
bool bOk = ExeGetClEntCDir( nEntId, vtCDir) ;
if ( bOk)
LuaSetParam( L, vCDir) ;
LuaSetParam( L, vtCDir) ;
else
LuaSetParam( L) ;
return 1 ;
@@ -3353,11 +3376,11 @@ LuaGetClEntADir( lua_State* L)
int nEntId ;
LuaGetParam( L, 1, nEntId) ;
LuaClearStack( L) ;
// recupero vADir
Vector3d vADir ;
bool bOk = ExeGetClEntADir( nEntId, vADir) ;
// recupero ADir
Vector3d vtADir ;
bool bOk = ExeGetClEntADir( nEntId, vtADir) ;
if ( bOk)
LuaSetParam( L, vADir) ;
LuaSetParam( L, vtADir) ;
else
LuaSetParam( L) ;
return 1 ;
@@ -4584,6 +4607,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetFirstRawPart", LuaGetFirstRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetNextRawPart", LuaGetNextRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPart", LuaAddRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartGen", LuaAddRawPartGen) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAddRawPartWithPart", LuaAddRawPartWithPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPart", LuaModifyRawPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyRawPartSize", LuaModifyRawPartSize) ;
+87 -6
View File
@@ -283,21 +283,99 @@ LuaTrimmingGetSurfBzSyncPoints( lua_State* L)
return 3 ;
}
//-------------------------------------------------------------------------------
static int
LuaTrimmingGetToolOrientationLines( lua_State* L)
{
// 13 parametri : nParentId, nMainEdgeId, nOtherEdgeId, nSyncLayerId, nLineSId, nLineEId,
// dThetaStart, dPhiStart, dThetaEnd, dPhiEnd, dInterpLenS, dInterpLenE, dLinTol
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nMainEdgeId ;
LuaCheckParam( L, 2, nMainEdgeId)
int nOtherEdgeId ;
LuaCheckParam( L, 3, nOtherEdgeId)
int nLineSId ;
LuaCheckParam( L, 4, nLineSId)
int nLineEId ;
LuaCheckParam( L, 5, nLineEId)
int nSyncLayerId ;
LuaCheckParam( L, 6, nSyncLayerId)
double dThetaStart ;
LuaCheckParam( L, 7, dThetaStart)
double dPhiStart ;
LuaCheckParam( L, 8, dPhiStart)
double dThetaEnd ;
LuaCheckParam( L, 9, dThetaEnd)
double dPhiEnd ;
LuaCheckParam( L, 10, dPhiEnd) ;
double dInterpLenS ;
LuaCheckParam( L, 11, dInterpLenS)
double dInterpLenE ;
LuaCheckParam( L, 12, dInterpLenE)
double dLinTol ;
LuaCheckParam( L, 13, dLinTol)
LuaClearStack( L) ;
// Inserisco i tratti lineari associati calcolati lungo il percorso
int nInterpStartId = GDB_ID_NULL, nStartId = GDB_ID_NULL, nEndId = GDB_ID_NULL, nInterpEndId = GDB_ID_NULL ;
bool bOk = ExeTrimmingGetToolOrientationLines( nParentId, nMainEdgeId, nOtherEdgeId, nSyncLayerId, nLineSId, nLineEId,
dThetaStart, dPhiStart, dThetaEnd, dPhiEnd, dInterpLenS, dInterpLenE, dLinTol,
nInterpStartId, nStartId, nEndId, nInterpEndId) ;
LuaSetParam( L, bOk) ;
LuaSetParam( L, nInterpStartId) ;
LuaSetParam( L, nStartId) ;
LuaSetParam( L, nEndId) ;
LuaSetParam( L, nInterpEndId) ;
return 5 ;
}
//-------------------------------------------------------------------------------
static int
Lua5AxTrimmingModifyToolDir( lua_State* L)
{
// 8 parametri : nCrvId, nAuxId, nTrimLayId, vnOrientingId, vnOrientingISId, vnOrientingSId, vnOrientingEId, vnOrientingIEId
int nCrvId ;
LuaCheckParam( L, 1, nCrvId)
int nPathId ;
LuaCheckParam( L, 2, nPathId)
int nTrimLayId ;
LuaCheckParam( L, 3, nTrimLayId)
INTVECTOR vnOrientingId ;
LuaCheckParam( L, 4, vnOrientingId)
INTVECTOR vnOrientingISId ;
LuaCheckParam( L, 5, vnOrientingISId)
INTVECTOR vnOrientingSId ;
LuaCheckParam( L, 6, vnOrientingSId)
INTVECTOR vnOrientingEId ;
LuaCheckParam( L, 7, vnOrientingEId)
INTVECTOR vnOrientingIEId ;
LuaCheckParam( L, 8, vnOrientingIEId) ;
LuaClearStack( L) ;
// Modifico le Direzioni utensile
bool bOk = Exe5AxTrimmingModifyToolDir( nCrvId, nPathId, nTrimLayId, vnOrientingId, vnOrientingISId, vnOrientingSId, vnOrientingEId, vnOrientingIEId) ;
LuaSetParam( L, bOk) ;
return true ;
}
//-------------------------------------------------------------------------------
static int
LuaRegolarizeSurfaceLocally( lua_State* L)
{
int nParentId = GDB_ID_NULL ;
LuaCheckParam( L, 1, nParentId)
int nSurfId = GDB_ID_NULL ;
LuaCheckParam( L, 1, nSurfId)
LuaCheckParam( L, 2, nSurfId)
int nSyncStartId ;
LuaCheckParam( L, 2, nSyncStartId)
LuaCheckParam( L, 3, nSyncStartId)
int nSyncEndId ;
LuaCheckParam( L, 3, nSyncEndId)
LuaCheckParam( L, 4, nSyncEndId)
double dLinTol ;
LuaCheckParam( L, 4, dLinTol)
LuaCheckParam( L, 5, dLinTol)
int nType = 0 ;
LuaCheckParam( L, 6, nType)
bool bOk = ExeRegolarizeSurfaceLocally( nSurfId, nSyncStartId, nSyncEndId, dLinTol) ;
LuaSetParam( L, bOk) ;
int nId = ExeRegolarizeSurfaceLocally( nParentId, nSurfId, nSyncStartId, nSyncEndId, dLinTol, nType) ;
LuaSetParam( L, nId) ;
return 1 ;
}
@@ -320,6 +398,9 @@ LuaInstallTrimming( LuaMgr& luaMgr)
// --- Recupero linee di sincronizzazione
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingInterpolateSyncLines", LuaTrimmingInterpolateSyncLines) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetSurfBzSyncPoints", LuaTrimmingGetSurfBzSyncPoints) ;
// --- Recupero linee di Orientamento dell'Utensile e Modifica della lavorazione 5Ax
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimmingGetToolOrientationLines", LuaTrimmingGetToolOrientationLines) ;
bOk = bOk && luaMgr.RegisterFunction( "Egt5AxTrimmingModifyToolDir", Lua5AxTrimmingModifyToolDir) ;
// --- Modifica della superficie
bOk = bOk && luaMgr.RegisterFunction( "EgtRegolarizeSurfaceLocally", LuaRegolarizeSurfaceLocally) ;
return bOk ;