Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 063b0f5cc4 | |||
| 2da612140e | |||
| 5d6f9c5d1d | |||
| 83ee155b8a | |||
| 3ff02fe0fe | |||
| 52cb174832 | |||
| d3a6f99ba5 | |||
| e31fcee338 | |||
| 4746474864 | |||
| 7cefd64b2a | |||
| 8a51d5e3a5 | |||
| d32fdc5417 | |||
| ccaaa5bd22 | |||
| 00e6d24f2e | |||
| 2d4d4ddf03 | |||
| cfcb844923 | |||
| e9f368a85f | |||
| 1abcac8aa4 | |||
| a9b5d9627a | |||
| 41790f7d57 | |||
| c33cbe7b9f | |||
| 35455e011e | |||
| 0e8f8d0502 |
+1
-1
@@ -760,7 +760,7 @@ ExeShowCurveBezierControlPoints( int nCrvId, int nDestGrpId, int* pnCount)
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva di Bezier
|
||||
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nCrvId) ;
|
||||
if ( pGeoObj->GetType() != CRV_BEZIER && pGeoObj->GetType() != CRV_COMPO)
|
||||
if ( pGeoObj == nullptr || ( pGeoObj->GetType() != CRV_BEZIER && pGeoObj->GetType() != CRV_COMPO))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCrv ;
|
||||
|
||||
@@ -59,7 +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, INFINITO, 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) {
|
||||
|
||||
+1
-1
@@ -1906,7 +1906,7 @@ ExeShowSurfBezierControlPoints( int nSrfId, int nDestGrpId, int* pnCount)
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la superficie di bezier
|
||||
IGeoObj* pGeoObj = pGeomDB->GetGeoObj( nSrfId) ;
|
||||
if ( pGeoObj->GetType() != SRF_BEZIER)
|
||||
if ( pGeoObj == nullptr || pGeoObj->GetType() != SRF_BEZIER)
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento della superficie
|
||||
Frame3d frSurf ;
|
||||
|
||||
+18
-17
@@ -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()) {
|
||||
@@ -2545,7 +2544,7 @@ ExeProjectCurveOnSurf( int nCurveId, const INTVECTOR& vnSurfId, int nDestGrpId,
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
MyProjectCurveOnSurfDir( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& vtProj, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromProj, int nRefType)
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromProj, bool bFromVsTo, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
@@ -2587,7 +2586,7 @@ MyProjectCurveOnSurfDir( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d
|
||||
bool bSharpEdges = ( ! bDirFromProj) ;
|
||||
// eseguo la proiezione
|
||||
PNT5AXVECTOR vPt5ax ;
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, vtProjL, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, vtProjL, dLinTol, dMaxSegmLen, bSharpEdges, bFromVsTo, vPt5ax))
|
||||
return false ;
|
||||
// inserisco la composita nel gruppo destinazione
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
@@ -2626,9 +2625,9 @@ MyProjectCurveOnSurfDir( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeProjectCurveOnSurfDir( int nCurveId, const INTVECTOR& vnSurfId, const Vector3d& vtProj, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromProj, int nRefType)
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromProj, bool bFromVsTo, int nRefType)
|
||||
{
|
||||
bool bOk = MyProjectCurveOnSurfDir( nCurveId, vnSurfId, vtProj, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
|
||||
bool bOk = MyProjectCurveOnSurfDir( nCurveId, vnSurfId, vtProj, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, bFromVsTo, nRefType) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
@@ -2639,6 +2638,7 @@ ExeProjectCurveOnSurfDir( int nCurveId, const INTVECTOR& vnSurfId, const Vector3
|
||||
ToString( dLinTol) + "," +
|
||||
ToString( dMaxSegmLen) + "," +
|
||||
( bDirFromProj ? "true" : "false") + "," +
|
||||
( bFromVsTo ? "true" : "false") + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
@@ -2649,7 +2649,7 @@ ExeProjectCurveOnSurfDir( int nCurveId, const INTVECTOR& vnSurfId, const Vector3
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
MyProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide, bool bFromVsTo)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
@@ -2710,14 +2710,14 @@ MyProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId,
|
||||
if ( pGdeLoc == nullptr)
|
||||
return false ;
|
||||
pGdeLoc->LocToLoc( frGde, frSurf) ;
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, bFromVsTo, vPt5ax))
|
||||
return false ;
|
||||
}
|
||||
else if ( pGdeCrv != nullptr) {
|
||||
CurveLocal GdeLoc( pGdeCrv, frGde, frSurf) ;
|
||||
if ( GdeLoc.Get() == nullptr)
|
||||
return false ;
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *GdeLoc.Get(), dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *GdeLoc.Get(), dLinTol, dMaxSegmLen, bSharpEdges, bFromVsTo, vPt5ax))
|
||||
return false ;
|
||||
}
|
||||
else { // pGdeStm != nullptr
|
||||
@@ -2725,7 +2725,7 @@ MyProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId,
|
||||
const ISurf* pGdeLoc = GetSurf( GdeLoc.Get()) ;
|
||||
if ( pGdeLoc == nullptr)
|
||||
return false ;
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, vPt5ax))
|
||||
if ( ! ProjectCurveOnSurf( *CrvLoc.Get(), vpSurf, *pGdeLoc, dLinTol, dMaxSegmLen, bSharpEdges, bFromVsTo, vPt5ax))
|
||||
return false ;
|
||||
}
|
||||
// inserisco la composita nel gruppo destinazione
|
||||
@@ -2765,9 +2765,9 @@ MyProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId,
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide, bool bFromVsTo)
|
||||
{
|
||||
bool bOk = MyProjectCurveOnSurfExt( nCurveId, vnSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
|
||||
bool bOk = MyProjectCurveOnSurfExt( nCurveId, vnSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide, bFromVsTo) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
@@ -2777,7 +2777,8 @@ ExeProjectCurveOnSurfExt( int nCurveId, const INTVECTOR& vnSurfId, int nGuideId,
|
||||
ToString( nDestGrpId) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
ToString( dMaxSegmLen) + "," +
|
||||
( bDirFromGuide ? "true" : "false") + ")" +
|
||||
( bDirFromGuide ? "true" : "false") + "," +
|
||||
( bFromVsTo ? "true" : "false") + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
|
||||
+22
-1
@@ -1185,7 +1185,10 @@ ExeSurfTmGetShowEdges( int nId, bool& bShow)
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
// recupero lo stato di visualizzazione degli spigoli vivi
|
||||
bShow = ( bOk && pStm->GetShowEdges()) ;
|
||||
if ( bOk)
|
||||
bShow = pStm->GetShowEdges() ;
|
||||
else
|
||||
bShow = false ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -1199,6 +1202,7 @@ ExeSurfTmSetSmoothAng( int nId, double dAngDeg)
|
||||
ISurfTriMesh* pSrfTm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pSrfTm == nullptr)
|
||||
return false ;
|
||||
// imposto l'angolo discriminante degli spigoli vivi
|
||||
pSrfTm->SetSmoothAngle( dAngDeg) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
@@ -1210,6 +1214,23 @@ ExeSurfTmSetSmoothAng( int nId, double dAngDeg)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmGetSmoothAng( int nId, double& dAngDeg)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie trimesh
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
// recupero l'angolo discriminante degli spigoli vivi
|
||||
if ( bOk)
|
||||
dAngDeg = pStm->GetSmoothAngle() ;
|
||||
else
|
||||
dAngDeg = 0 ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static double
|
||||
GetStmOffsPrec( double dOffs, double dLinTol)
|
||||
|
||||
@@ -142,6 +142,23 @@ ExeVolZmapSetShowEdges( int nId, bool bShow)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVolZmapGetShowEdges( int nId, bool& bShow)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero lo Zmap
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pVZM != nullptr) ;
|
||||
// leggo lo stato di visualizzazione degli spigoli vivi
|
||||
if ( bOk)
|
||||
bShow = pVZM->GetShowEdges() ;
|
||||
else
|
||||
bShow = false ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRemoveVolZmapPart( int nId, int nPart)
|
||||
|
||||
+29
-8
@@ -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) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -267,6 +267,21 @@ ExeDraw( void)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeRedraw( void)
|
||||
{
|
||||
// se interfaccia disabilitata, esco subito
|
||||
if ( ! ExeGetEnableUI())
|
||||
return true ;
|
||||
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, false)
|
||||
// forzo ridisegno
|
||||
pScene->RedrawWindow() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSelect( int nWinX, int nWinY, int nSelW, int nSelH, int* pnSel)
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -866,3 +871,560 @@ ExeTrimmingGetSurfBzSyncPoints( int nParentId, int nEdge1Id, int nEdge2Id, doubl
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
bool
|
||||
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)
|
||||
{
|
||||
// Verifica database geometrico
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
|
||||
// recupero la superficie
|
||||
ISurfBezier* pSurfBez = GetSurfBezier( GetSurf( pGeomDB->GetGeoObj( nSurfId))) ;
|
||||
|
||||
// recupero le due isocurve
|
||||
const ICurve* pSyncStart = GetCurveLine( GetCurve( pGeomDB->GetGeoObj( nSyncStartId))) ;
|
||||
const ICurve* pSyncEnd = GetCurveLine( GetCurve( pGeomDB->GetGeoObj( nSyncEndId))) ;
|
||||
Point3d ptS1 ; pSyncStart->GetStartPoint( ptS1) ;
|
||||
Point3d ptE1 ; pSyncStart->GetEndPoint( ptE1) ;
|
||||
BIPOINT bpIsoStart( ptS1, ptE1) ;
|
||||
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)) ;
|
||||
|
||||
return nId ;
|
||||
}
|
||||
Binary file not shown.
@@ -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) ;
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
+25
-17
@@ -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 ;
|
||||
@@ -1031,7 +1035,7 @@ LuaProjectCurveOnSurf( lua_State* L)
|
||||
static int
|
||||
LuaProjectCurveOnSurfDir( lua_State* L)
|
||||
{
|
||||
// 4, 5, 6, 7 o 8 parametri : nCurveId, vSurfId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromProj] [, nRefType]]
|
||||
// 4, 5, 6, 7 o 8 parametri : nCurveId, vSurfId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromProj] [,bFromVsTo] [, nRefType]]
|
||||
int nCurveId ;
|
||||
LuaCheckParam( L, 1, nCurveId)
|
||||
INTVECTOR vSurfId ;
|
||||
@@ -1043,14 +1047,16 @@ LuaProjectCurveOnSurfDir( lua_State* L)
|
||||
double dLinTol = 0.01 ;
|
||||
double dMaxSegmLen = INFINITO ;
|
||||
bool bDirFromProj = false ;
|
||||
bool bFromVsTo = true ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 5, dLinTol) &&
|
||||
LuaGetParam( L, 6, dMaxSegmLen) &&
|
||||
LuaGetParam( L, 7, bDirFromProj))
|
||||
LuaGetParam( L, 8, nRefType) ;
|
||||
LuaGetParam( L, 7, bDirFromProj) &&
|
||||
LuaGetParam( L, 8, bFromVsTo))
|
||||
LuaGetParam( L, 9, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// proietto la curva su una o più superfici secondo la direzione data
|
||||
bool bOk = ExeProjectCurveOnSurfDir( nCurveId, vSurfId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromProj, nRefType) ;
|
||||
// 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 ;
|
||||
}
|
||||
@@ -1059,7 +1065,7 @@ LuaProjectCurveOnSurfDir( lua_State* L)
|
||||
static int
|
||||
LuaProjectCurveOnSurfExt( lua_State* L)
|
||||
{
|
||||
// 4, 5, 6 o 7 parametri : nCurveId, vSurfId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide]]
|
||||
// 4, 5, 6 o 7 parametri : nCurveId, vSurfId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide] [,bFromVsTo]]
|
||||
int nCurveId ;
|
||||
LuaCheckParam( L, 1, nCurveId)
|
||||
INTVECTOR vSurfId ;
|
||||
@@ -1071,12 +1077,14 @@ LuaProjectCurveOnSurfExt( lua_State* L)
|
||||
double dLinTol = 0.01 ;
|
||||
double dMaxSegmLen = INFINITO ;
|
||||
bool bDirFromGuide = false ;
|
||||
bool bFromVsTo = true ;
|
||||
if ( LuaGetParam( L, 5, dLinTol) &&
|
||||
LuaGetParam( L, 6, dMaxSegmLen))
|
||||
LuaGetParam( L, 7, bDirFromGuide) ;
|
||||
LuaGetParam( L, 6, dMaxSegmLen) &&
|
||||
LuaGetParam( L, 7, bDirFromGuide))
|
||||
LuaGetParam( L, 8, bFromVsTo) ;
|
||||
LuaClearStack( L) ;
|
||||
// proietto la curva su una o più superfici secondo la direzione verso la guida
|
||||
bool bOk = ExeProjectCurveOnSurfExt( nCurveId, vSurfId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
|
||||
// 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 ;
|
||||
}
|
||||
|
||||
+21
-2
@@ -565,7 +565,7 @@ LuaSurfTmGetShowEdges( lua_State* L)
|
||||
static int
|
||||
LuaSurfTmSetSmoothAng( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nId, nCutterId
|
||||
// 2 parametri : nId, dAngDeg
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dAngDeg ;
|
||||
@@ -577,6 +577,24 @@ LuaSurfTmSetSmoothAng( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmGetSmoothAng( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nId
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero lo smooth angle della superficie
|
||||
double dAngDeg ;
|
||||
bool bOk = ExeSurfTmGetSmoothAng( nId, dAngDeg) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, dAngDeg) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmOffset( lua_State* L)
|
||||
@@ -664,7 +682,7 @@ LuaSurfBzTrim( lua_State* L)
|
||||
bool
|
||||
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bool bOk = true ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtInvertSurf", LuaInvertSurf) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeSurf", LuaExplodeSurf) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtApproxSurf", LuaApproxSurf) ;
|
||||
@@ -694,6 +712,7 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetShowEdges", LuaSurfTmGetShowEdges) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetSmoothAng", LuaSurfTmSetSmoothAng) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetSmoothAng", LuaSurfTmGetSmoothAng) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmOffset", LuaSurfTmOffset) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmThickeningOffset", LuaSurfTmThickeningOffset) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCutSurfBzPlane", LuaCutSurfBzPlane) ;
|
||||
|
||||
@@ -73,6 +73,25 @@ LuaVolZmapSetShowEdges( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVolZmapGetShowEdges( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// imposto flag visualizzazione spigoli vivi
|
||||
bool bShow ;
|
||||
bool bOk = ExeVolZmapGetShowEdges( nId, bShow) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk)
|
||||
LuaSetParam( L, bShow) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRemoveVolZmapPart( lua_State* L)
|
||||
@@ -465,6 +484,7 @@ LuaInstallGdbModifyVol( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeVolume", LuaExplodeVolume) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapChangeResolution", LuaVolZmapChangeResolution) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetShowEdges", LuaVolZmapSetShowEdges) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapGetShowEdges", LuaVolZmapGetShowEdges) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveVolZmapPart", LuaRemoveVolZmapPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetStdTool", LuaVolZmapSetStdTool) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapSetAdvTool", LuaVolZmapSetAdvTool) ;
|
||||
|
||||
+36
-12
@@ -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) ;
|
||||
|
||||
+15
-1
@@ -73,6 +73,19 @@ LuaDraw( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaRedraw( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// forzo ridisegno
|
||||
bool bOk = ExeRedraw() ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSetShowMode( lua_State* L)
|
||||
@@ -378,10 +391,11 @@ LuaSetShowSurfBezierTol( lua_State* L)
|
||||
bool
|
||||
LuaInstallScene( LuaMgr& luaMgr)
|
||||
{
|
||||
bool bOk = ( &luaMgr != nullptr) ;
|
||||
bool bOk = true ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetBackground", LuaSetBackground) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetBackground", LuaGetBackground) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDraw", LuaDraw) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtRedraw", LuaRedraw) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowMode", LuaSetShowMode) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowCurveDirection", LuaSetShowCurveDirection) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSetShowTriaAdv", LuaSetShowTriaAdv) ;
|
||||
|
||||
@@ -283,6 +283,102 @@ 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, 2, nSurfId)
|
||||
int nSyncStartId ;
|
||||
LuaCheckParam( L, 3, nSyncStartId)
|
||||
int nSyncEndId ;
|
||||
LuaCheckParam( L, 4, nSyncEndId)
|
||||
double dLinTol ;
|
||||
LuaCheckParam( L, 5, dLinTol)
|
||||
int nType = 0 ;
|
||||
LuaCheckParam( L, 6, nType)
|
||||
|
||||
int nId = ExeRegolarizeSurfaceLocally( nParentId, nSurfId, nSyncStartId, nSyncEndId, dLinTol, nType) ;
|
||||
LuaSetParam( L, nId) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallTrimming( LuaMgr& luaMgr)
|
||||
@@ -302,5 +398,10 @@ 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 ;
|
||||
}
|
||||
Reference in New Issue
Block a user