diff --git a/EXE_GdbCreateCurve.cpp b/EXE_GdbCreateCurve.cpp index a73ade5..1d86f5d 100644 --- a/EXE_GdbCreateCurve.cpp +++ b/EXE_GdbCreateCurve.cpp @@ -64,7 +64,7 @@ static Vector3d CalcExtrusion( IGeomDB* pGeomDB, int nParentId, int nRefType) ; //------------------------------------------------------------------------------- int -ExeCreateCurveLine( int nParentId, const Point3d& ptIni, const Point3d& ptFin, int nRefType) +ExeCreateLine( int nParentId, const Point3d& ptIni, const Point3d& ptFin, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -104,7 +104,7 @@ ExeCreateCurveLine( int nParentId, const Point3d& ptIni, const Point3d& ptFin, i //------------------------------------------------------------------------------- int -ExeCreateCurveLineEx( int nParentId, const Point3d& ptIni, int nSepI, int nIdI, +ExeCreateLineEx( int nParentId, const Point3d& ptIni, int nSepI, int nIdI, const Point3d& ptFin, int nSepF, int nIdF, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; @@ -479,8 +479,8 @@ CreateLineTgCurvePerpCurve( IGeomDB* pGeomDB, int nParentId, //------------------------------------------------------------------------------- int -ExeCreateCurveLinePDL( int nParentId, const Point3d& ptIni, - double dDirDeg, double dLen, int nRefType) +ExeCreateLinePDL( int nParentId, const Point3d& ptIni, + double dDirDeg, double dLen, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -521,8 +521,8 @@ ExeCreateCurveLinePDL( int nParentId, const Point3d& ptIni, //------------------------------------------------------------------------------- int -ExeCreateCurveLinePVL( int nParentId, const Point3d& ptIni, - const Vector3d& vtDir, double dLen, int nRefType) +ExeCreateLinePVL( int nParentId, const Point3d& ptIni, + const Vector3d& vtDir, double dLen, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -563,8 +563,8 @@ ExeCreateCurveLinePVL( int nParentId, const Point3d& ptIni, //------------------------------------------------------------------------------- int -ExeCreateCurveLineMinPointCurve( int nParentId, - const Point3d& ptStart, int nCrvId, double dNearPar, int nRefType) +ExeCreateLineMinPointCurve( int nParentId, + const Point3d& ptStart, int nCrvId, double dNearPar, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -623,7 +623,7 @@ ExeCreateCurveLineMinPointCurve( int nParentId, //------------------------------------------------------------------------------- int -ExeCreateCurveCircle( int nParentId, const Point3d& ptCen, double dRad, int nRefType) +ExeCreateCircle( int nParentId, const Point3d& ptCen, double dRad, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -663,8 +663,8 @@ ExeCreateCurveCircle( int nParentId, const Point3d& ptCen, double dRad, int nRef //------------------------------------------------------------------------------- int -ExeCreateCurveCircleCP( int nParentId, const Point3d& ptCen, - const Point3d& ptOn, int nRefType) +ExeCreateCircleCP( int nParentId, const Point3d& ptCen, + const Point3d& ptOn, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -704,8 +704,8 @@ ExeCreateCurveCircleCP( int nParentId, const Point3d& ptCen, //------------------------------------------------------------------------------- int -ExeCreateCurveCircleCPEx( int nParentId, const Point3d& ptCen, - const Point3d& ptOn, int nSepO, int nIdO, int nRefType) +ExeCreateCircleCPEx( int nParentId, const Point3d& ptCen, + const Point3d& ptOn, int nSepO, int nIdO, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -763,8 +763,8 @@ ExeCreateCurveCircleCPEx( int nParentId, const Point3d& ptCen, //------------------------------------------------------------------------------- int -ExeCreateCurveCircle3P( int nParentId, const Point3d& ptP1, - const Point3d& ptP2, const Point3d& ptP3, int nRefType) +ExeCreateCircle3P( int nParentId, const Point3d& ptP1, + const Point3d& ptP2, const Point3d& ptP3, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -806,8 +806,8 @@ ExeCreateCurveCircle3P( int nParentId, const Point3d& ptP1, //------------------------------------------------------------------------------- int -ExeCreateCurveArc( int nParentId, const Point3d& ptCen, double dRad, - double dAngIniDeg, double dAngCenDeg, double dDeltaN, int nRefType) +ExeCreateArc( int nParentId, const Point3d& ptCen, double dRad, + double dAngIniDeg, double dAngCenDeg, double dDeltaN, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -851,8 +851,8 @@ ExeCreateCurveArc( int nParentId, const Point3d& ptCen, double dRad, //------------------------------------------------------------------------------- int -ExeCreateCurveArcC2P( int nParentId, const Point3d& ptCen, const Point3d& ptStart, - const Point3d& ptNearEnd, int nRefType) +ExeCreateArcC2P( int nParentId, const Point3d& ptCen, const Point3d& ptStart, + const Point3d& ptNearEnd, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -895,9 +895,9 @@ ExeCreateCurveArcC2P( int nParentId, const Point3d& ptCen, const Point3d& ptStar //------------------------------------------------------------------------------- int -ExeCreateCurveArcC2PEx( int nParentId, const Point3d& ptCen, - const Point3d& ptStart, int nSepS, int nIdS, - const Point3d& ptNearEnd, int nRefType) +ExeCreateArcC2PEx( int nParentId, const Point3d& ptCen, + const Point3d& ptStart, int nSepS, int nIdS, + const Point3d& ptNearEnd, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -956,8 +956,8 @@ ExeCreateCurveArcC2PEx( int nParentId, const Point3d& ptCen, //------------------------------------------------------------------------------- int -ExeCreateCurveArc3P( int nParentId, const Point3d& ptP1, - const Point3d& ptP2, const Point3d& ptP3, int nRefType) +ExeCreateArc3P( int nParentId, const Point3d& ptP1, + const Point3d& ptP2, const Point3d& ptP3, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -1003,8 +1003,8 @@ ExeCreateCurveArc3P( int nParentId, const Point3d& ptP1, //------------------------------------------------------------------------------- int -ExeCreateCurveArc2PD( int nParentId, const Point3d& ptStart, const Point3d& ptEnd, - double dDirSDeg, int nRefType) +ExeCreateArc2PD( int nParentId, const Point3d& ptStart, const Point3d& ptEnd, + double dDirSDeg, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -1045,9 +1045,9 @@ ExeCreateCurveArc2PD( int nParentId, const Point3d& ptStart, const Point3d& ptEn //------------------------------------------------------------------------------- int -ExeCreateCurveArc2PDEx( int nParentId, const Point3d& ptStart, - const Point3d& ptEnd, int nSep, int nId, - double dDirSDeg, int nRefType) +ExeCreateArc2PDEx( int nParentId, const Point3d& ptStart, + const Point3d& ptEnd, int nSep, int nId, + double dDirSDeg, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -1119,8 +1119,8 @@ ExeCreateCurveArc2PDEx( int nParentId, const Point3d& ptStart, //------------------------------------------------------------------------------- int -ExeCreateCurveArc2PV( int nParentId, const Point3d& ptStart, const Point3d& ptEnd, - const Vector3d& vtDirS, int nRefType) +ExeCreateArc2PV( int nParentId, const Point3d& ptStart, const Point3d& ptEnd, + const Vector3d& vtDirS, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -1168,8 +1168,8 @@ ExeCreateCurveArc2PV( int nParentId, const Point3d& ptStart, const Point3d& ptEn //------------------------------------------------------------------------------- int -ExeCreateCurveBiArc( int nParentId, const Point3d& ptStart, const Point3d& ptEnd, - double dDirSDeg, double dDirEDeg, double dPar, int nRefType) +ExeCreateBiArc( int nParentId, const Point3d& ptStart, const Point3d& ptEnd, + double dDirSDeg, double dDirEDeg, double dPar, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) @@ -1580,10 +1580,6 @@ MyCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) nParentId = AdjustId( nParentId) ; - // creo la curva composita - PtrOwner pCrvCompo( CreateCurveComposite()) ; - if ( IsNull( pCrvCompo)) - return GDB_ID_NULL ; // recupero il riferimento del gruppo destinazione Frame3d frDest ; if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest)) diff --git a/EXE_GdbModifyCurve.cpp b/EXE_GdbModifyCurve.cpp index 03c6ebe..5eab9e7 100644 --- a/EXE_GdbModifyCurve.cpp +++ b/EXE_GdbModifyCurve.cpp @@ -671,7 +671,7 @@ ExeSplitCurveAtSelfInters( int nId, int* pnCount) //------------------------------------------------------------------------------- bool -ExeModifyCurveCircleCPN( int nId, const Point3d& ptOn, int nRefType) +ExeModifyCircleCP( int nId, const Point3d& ptOn, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, false) @@ -702,7 +702,7 @@ ExeModifyCurveCircleCPN( int nId, const Point3d& ptOn, int nRefType) //------------------------------------------------------------------------------- bool -ExeModifyCurveArcRadius( int nId, double dRad) +ExeModifyArcRadius( int nId, double dRad) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, false) @@ -723,7 +723,7 @@ ExeModifyCurveArcRadius( int nId, double dRad) //------------------------------------------------------------------------------- bool -ExeModifyCurveArcC2PN( int nId, const Point3d& ptEnd, int nRefType) +ExeModifyArcC2P( int nId, const Point3d& ptEnd, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, false) @@ -754,7 +754,7 @@ ExeModifyCurveArcC2PN( int nId, const Point3d& ptEnd, int nRefType) //------------------------------------------------------------------------------- bool -ExeModifyCurveArc3P( int nId, const Point3d& ptMid, int nRefType) +ExeModifyArc3P( int nId, const Point3d& ptMid, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, false) @@ -781,6 +781,34 @@ ExeModifyCurveArc3P( int nId, const Point3d& ptMid, int nRefType) } } +//------------------------------------------------------------------------------- +bool +ExeModifyArcToExplementary( int nId) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + // recupero l'arco + ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ; + if ( pArc == nullptr) + return false ; + // eseguo trasformazione + return pArc->ToExplementary() ; +} + +//------------------------------------------------------------------------------- +bool +ExeModifyArcByFlip( int nId) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + // recupero l'arco + ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ; + if ( pArc == nullptr) + return false ; + // eseguo trasformazione + return pArc->Flip() ; +} + //------------------------------------------------------------------------------- int ExeExplodeCurveCompo( int nId, int* pnCount) @@ -856,6 +884,7 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol) bool bOk = ( pCurve != nullptr) ; // eseguo l'approssimazione const double ANG_TOL_MAX_DEG = 90 ; + const double LIN_FEA_LEN_STD = 20 ; PtrOwner pCC( CreateCurveComposite()) ; bOk = bOk && ! IsNull( pCC) ; if ( nApprType == APP_LINES || @@ -866,7 +895,7 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol) } else { // con bi-archi PolyArc PA ; - bOk = bOk && pCurve->ApproxWithArcs( dLinTol, ANG_TOL_MAX_DEG, PA) && pCC->FromPolyArc( PA) ; + bOk = bOk && pCurve->ApproxWithArcsEx( dLinTol, ANG_TOL_MAX_DEG, LIN_FEA_LEN_STD, PA) && pCC->FromPolyArc( PA) ; } // copio estrusione e spessore Vector3d vtExtr ; diff --git a/EXE_General.cpp b/EXE_General.cpp index 26b2364..91c56d0 100644 --- a/EXE_General.cpp +++ b/EXE_General.cpp @@ -86,8 +86,10 @@ ExeInit( int nDebug, const string& sLogFile, const string& sLogMsg) if ( LoadMachKernelDll( s_pGenLog, s_sKey)) LOG_INFO( s_pGenLog, MyGetEMkVersion()) - // Info sul sistema + // Info sulla protezione e sul sistema string sTmp ; + if ( ExeGetKeyInfo( sTmp)) + LOG_INFO( s_pGenLog, sTmp.c_str()) if ( GetOsInfo( sTmp)) LOG_INFO( s_pGenLog, sTmp.c_str()) if ( GetCpuInfo( sTmp)) @@ -278,12 +280,18 @@ ExeGetKeyInfo( string& sKey) return false ; // se protezione hardware if ( sLockId.find( KEY_LOCK_HW_START) != string::npos) { - sKey = sLockId.substr( 7, 6) ; - return ( ! sKey.empty()) ; + sLockId = sLockId.substr( 7, 6) ; + if ( sLockId.empty()) + return false ; } // altrimenti - else - return GetLockId2( sKey) ; + else { + if ( ! GetLockId2( sLockId)) + return false ; + } + // assemblo stringa da restituire + sKey = "Key " + sLockId ; + return true ; } //----------------------------------------------------------------------------- diff --git a/EXE_GeoSnap.cpp b/EXE_GeoSnap.cpp index 700e787..d7093b6 100644 --- a/EXE_GeoSnap.cpp +++ b/EXE_GeoSnap.cpp @@ -784,7 +784,7 @@ ExeGetMinDistPntSidePointCurve( const Point3d& ptP, int nId, const Vector3d& vtN //---------------------------------------------------------------------------- bool -ExeCurveArcRadius( int nId, double* pdRad) +ExeArcRadius( int nId, double* pdRad) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, false) @@ -801,7 +801,41 @@ ExeCurveArcRadius( int nId, double* pdRad) //---------------------------------------------------------------------------- bool -ExeCurveArcNormVersor( int nId, int nRefId, Vector3d& vtNorm) +ExeArcAngCenter( int nId, double* pdAngDeg) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + // verifico il parametro + if ( pdAngDeg == nullptr) + return false ; + // recupero l'arco + const ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ; + if ( pArc == nullptr) + return false ; + *pdAngDeg = pArc->GetAngCenter() ; + return true ; +} + +//---------------------------------------------------------------------------- +bool +ExeArcDeltaN( int nId, double* pdDeltaN) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, false) + // verifico il parametro + if ( pdDeltaN == nullptr) + return false ; + // recupero l'arco + const ICurveArc* pArc = GetCurveArc( pGeomDB->GetGeoObj( nId)) ; + if ( pArc == nullptr) + return false ; + *pdDeltaN = pArc->GetDeltaN() ; + return true ; +} + +//---------------------------------------------------------------------------- +bool +ExeArcNormVersor( int nId, int nRefId, Vector3d& vtNorm) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, false) @@ -944,7 +978,7 @@ ExeSurfTmFacetNormVersor( int nId, int nFacet, int nRefId, Vector3d& vtNorm) //---------------------------------------------------------------------------- bool -ExeExtTextNormVersor( int nId, int nRefId, Vector3d& vtNorm) +ExeTextNormVersor( int nId, int nRefId, Vector3d& vtNorm) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, false) diff --git a/LUA_GdbCreateCurve.cpp b/LUA_GdbCreateCurve.cpp index f64b050..98a4d25 100644 --- a/LUA_GdbCreateCurve.cpp +++ b/LUA_GdbCreateCurve.cpp @@ -23,7 +23,7 @@ using namespace std ; //------------------------------------------------------------------------------- static int -LuaCreateCurveLine( lua_State* L) +LuaCreateLine( lua_State* L) { // 3 o 4 parametri : ParentId, PtIni, PtFin [, nRefType] int nParentId ; @@ -36,7 +36,7 @@ LuaCreateCurveLine( lua_State* L) LuaGetParam( L, 4, nRefType) ; LuaClearStack( L) ; // creo il segmento di retta - int nId = ExeCreateCurveLine( nParentId, ptIni, ptFin, nRefType) ; + int nId = ExeCreateLine( nParentId, ptIni, ptFin, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -47,7 +47,7 @@ LuaCreateCurveLine( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveLineEx( lua_State* L) +LuaCreateLineEx( lua_State* L) { // 7 o 8 parametri : ParentId, PtIni, nSepI, nIdI, PtFin, nSepF, nIdF [, nRefType] int nParentId ; @@ -68,9 +68,9 @@ LuaCreateCurveLineEx( lua_State* L) LuaGetParam( L, 8, nRefType) ; LuaClearStack( L) ; // creo il segmento di retta - int nId = ExeCreateCurveLineEx( nParentId, - ptIni, nSepI, nIdI, - ptFin, nSepF, nIdF, nRefType) ; + int nId = ExeCreateLineEx( nParentId, + ptIni, nSepI, nIdI, + ptFin, nSepF, nIdF, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -81,7 +81,7 @@ LuaCreateCurveLineEx( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveLinePDL( lua_State* L) +LuaCreateLinePDL( lua_State* L) { // 4 o 5 parametri : ParentId, PtIni, dDirDeg, dLen [, nRefType] int nParentId ; @@ -96,7 +96,7 @@ LuaCreateCurveLinePDL( lua_State* L) LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo il segmento di retta - int nId = ExeCreateCurveLinePDL( nParentId, ptIni, dDirDeg, dLen, nRefType) ; + int nId = ExeCreateLinePDL( nParentId, ptIni, dDirDeg, dLen, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -107,7 +107,7 @@ LuaCreateCurveLinePDL( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveLinePVL( lua_State* L) +LuaCreateLinePVL( lua_State* L) { // 4 o 5 parametri : ParentId, PtIni, VtDir, dLen [, nRefType] int nParentId ; @@ -122,7 +122,7 @@ LuaCreateCurveLinePVL( lua_State* L) LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo il segmento di retta - int nId = ExeCreateCurveLinePVL( nParentId, ptIni, vtDir, dLen, nRefType) ; + int nId = ExeCreateLinePVL( nParentId, ptIni, vtDir, dLen, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -133,7 +133,7 @@ LuaCreateCurveLinePVL( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveLineMinPointCurve( lua_State* L) +LuaCreateLineMinPointCurve( lua_State* L) { // 3 o 4 o 5 parametri : ParentId, PtIni, CrvId [, NearPar] [, nRefType] int nParentId ; @@ -150,7 +150,7 @@ LuaCreateCurveLineMinPointCurve( lua_State* L) LuaGetParam( L, 4, nRefType) ; LuaClearStack( L) ; // creo il segmento di retta - int nId = ExeCreateCurveLineMinPointCurve( nParentId, ptIni, nCrvId, dNearPar, nRefType) ; + int nId = ExeCreateLineMinPointCurve( nParentId, ptIni, nCrvId, dNearPar, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -161,7 +161,7 @@ LuaCreateCurveLineMinPointCurve( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveCircle( lua_State* L) +LuaCreateCircle( lua_State* L) { // 3 o 4 parametri : ParentId, PtCen, Rad [, nRefType] int nParentId ; @@ -174,7 +174,7 @@ LuaCreateCurveCircle( lua_State* L) LuaGetParam( L, 4, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveCircle( nParentId, ptCen, dRad, nRefType) ; + int nId = ExeCreateCircle( nParentId, ptCen, dRad, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -185,7 +185,7 @@ LuaCreateCurveCircle( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveCircleCP( lua_State* L) +LuaCreateCircleCP( lua_State* L) { // 3 o 4 parametri : ParentId, PtCen, PtOn [, nRefType] int nParentId ; @@ -198,7 +198,7 @@ LuaCreateCurveCircleCP( lua_State* L) LuaGetParam( L, 4, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveCircleCP( nParentId, ptCen, ptOn, nRefType) ; + int nId = ExeCreateCircleCP( nParentId, ptCen, ptOn, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -209,7 +209,7 @@ LuaCreateCurveCircleCP( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveCircleCPEx( lua_State* L) +LuaCreateCircleCPEx( lua_State* L) { // 5 o 6 parametri : ParentId, PtCen, PtOn, nSepO, nIdO [, nRefType] int nParentId ; @@ -226,7 +226,7 @@ LuaCreateCurveCircleCPEx( lua_State* L) LuaGetParam( L, 6, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveCircleCPEx( nParentId, ptCen, ptOn, nSepO, nIdO, nRefType) ; + int nId = ExeCreateCircleCPEx( nParentId, ptCen, ptOn, nSepO, nIdO, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -237,7 +237,7 @@ LuaCreateCurveCircleCPEx( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveCircle3P( lua_State* L) +LuaCreateCircle3P( lua_State* L) { // 4 o 5 parametri : ParentId, PtP1, PtP2, PtP3 [, nRefType] int nParentId ; @@ -252,7 +252,7 @@ LuaCreateCurveCircle3P( lua_State* L) LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveCircle3P( nParentId, ptP1, ptP2, ptP3, nRefType) ; + int nId = ExeCreateCircle3P( nParentId, ptP1, ptP2, ptP3, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -263,7 +263,7 @@ LuaCreateCurveCircle3P( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveArc( lua_State* L) +LuaCreateArc( lua_State* L) { // 6 o 7 parametri : ParentId, PtCen, Rad, AngIniDeg, AngCenDeg, DeltaN [, nRefType] int nParentId ; @@ -282,7 +282,7 @@ LuaCreateCurveArc( lua_State* L) LuaGetParam( L, 7, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArc( nParentId, ptCen, dRad, dAngIniDeg, dAngCenDeg, dDeltaN, nRefType) ; + int nId = ExeCreateArc( nParentId, ptCen, dRad, dAngIniDeg, dAngCenDeg, dDeltaN, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -293,7 +293,7 @@ LuaCreateCurveArc( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveArcC2P( lua_State* L) +LuaCreateArcC2P( lua_State* L) { // 4 o 5 parametri : ParentId, PtCen, PtStart, PtNearEnd [, nRefType] int nParentId ; @@ -308,7 +308,7 @@ LuaCreateCurveArcC2P( lua_State* L) LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArcC2P( nParentId, ptCen, ptStart, ptNearEnd, nRefType) ; + int nId = ExeCreateArcC2P( nParentId, ptCen, ptStart, ptNearEnd, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -319,7 +319,7 @@ LuaCreateCurveArcC2P( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveArcC2PEx( lua_State* L) +LuaCreateArcC2PEx( lua_State* L) { // 6 o 7 parametri : ParentId, PtCen, PtStart, nSepS, nIdS, PtNearEnd [, nRefType] int nParentId ; @@ -338,7 +338,7 @@ LuaCreateCurveArcC2PEx( lua_State* L) LuaGetParam( L, 7, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArcC2PEx( nParentId, ptCen, ptStart, nSepS, nIdS, ptNearEnd, nRefType) ; + int nId = ExeCreateArcC2PEx( nParentId, ptCen, ptStart, nSepS, nIdS, ptNearEnd, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -349,7 +349,7 @@ LuaCreateCurveArcC2PEx( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveArc3P( lua_State* L) +LuaCreateArc3P( lua_State* L) { // 4 o 5 parametri : ParentId, PtP1, PtP2, PtP3 [, nRefType] int nParentId ; @@ -364,7 +364,7 @@ LuaCreateCurveArc3P( lua_State* L) LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArc3P( nParentId, ptP1, ptP2, ptP3, nRefType) ; + int nId = ExeCreateArc3P( nParentId, ptP1, ptP2, ptP3, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -375,7 +375,7 @@ LuaCreateCurveArc3P( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveArc2PD( lua_State* L) +LuaCreateArc2PD( lua_State* L) { // 4 o 5 parametri : ParentId, PtStart, PtEnd, dDirSDeg [, nRefType] int nParentId ; @@ -390,7 +390,7 @@ LuaCreateCurveArc2PD( lua_State* L) LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArc2PD( nParentId, ptStart, ptEnd, dDirSDeg, nRefType) ; + int nId = ExeCreateArc2PD( nParentId, ptStart, ptEnd, dDirSDeg, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -401,7 +401,7 @@ LuaCreateCurveArc2PD( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveArc2PDEx( lua_State* L) +LuaCreateArc2PDEx( lua_State* L) { // 6 o 7 parametri : ParentId, PtStart, PtEnd, nSepE, nIdE, dDirSDeg [, nRefType] int nParentId ; @@ -420,8 +420,8 @@ LuaCreateCurveArc2PDEx( lua_State* L) LuaGetParam( L, 7, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArc2PDEx( nParentId, ptStart, ptEnd, nSepE, nIdE, - dDirSDeg, nRefType) ; + int nId = ExeCreateArc2PDEx( nParentId, ptStart, ptEnd, nSepE, nIdE, + dDirSDeg, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -432,7 +432,7 @@ LuaCreateCurveArc2PDEx( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveArc2PV( lua_State* L) +LuaCreateArc2PV( lua_State* L) { // 4 o 5 parametri : ParentId, PtStart, PtEnd, VtDirS [, nRefType] int nParentId ; @@ -447,7 +447,7 @@ LuaCreateCurveArc2PV( lua_State* L) LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArc2PV( nParentId, ptStart, ptEnd, vtDirS, nRefType) ; + int nId = ExeCreateArc2PV( nParentId, ptStart, ptEnd, vtDirS, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -458,7 +458,7 @@ LuaCreateCurveArc2PV( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveBiArc( lua_State* L) +LuaCreateBiArc( lua_State* L) { // 6 o 7 parametri : ParentId, ptStart, ptEnd, dDirSDeg, dDirEDeg, dPar [, nRefType] int nParentId ; @@ -477,7 +477,7 @@ LuaCreateCurveBiArc( lua_State* L) LuaGetParam( L, 7, nRefType) ; LuaClearStack( L) ; // creo l'arco di fillet - int nId = ExeCreateCurveBiArc( nParentId, ptStart, ptEnd, dDirSDeg, dDirEDeg, dPar, nRefType) ; + int nId = ExeCreateBiArc( nParentId, ptStart, ptEnd, dDirSDeg, dDirEDeg, dPar, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -917,23 +917,23 @@ bool LuaInstallGdbCreateCurve( LuaMgr& luaMgr) { bool bOk = ( &luaMgr != nullptr) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtLine", LuaCreateCurveLine) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtLineEx", LuaCreateCurveLineEx) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtLinePDL", LuaCreateCurveLinePDL) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtLinePVL", LuaCreateCurveLinePVL) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtLineMinPointCurve", LuaCreateCurveLineMinPointCurve) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtCircle", LuaCreateCurveCircle) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtCircleCP", LuaCreateCurveCircleCP) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtCircleCPEx", LuaCreateCurveCircleCPEx) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtCircle3P", LuaCreateCurveCircle3P) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtArc", LuaCreateCurveArc) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateCurveArcC2P) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateCurveArcC2PEx) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateCurveArc3P) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateCurveArc2PD) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateCurveArc2PDEx) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PV", LuaCreateCurveArc2PV) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtBiArc", LuaCreateCurveBiArc) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtLine", LuaCreateLine) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtLineEx", LuaCreateLineEx) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtLinePDL", LuaCreateLinePDL) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtLinePVL", LuaCreateLinePVL) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtLineMinPointCurve", LuaCreateLineMinPointCurve) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtCircle", LuaCreateCircle) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtCircleCP", LuaCreateCircleCP) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtCircleCPEx", LuaCreateCircleCPEx) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtCircle3P", LuaCreateCircle3P) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArc", LuaCreateArc) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateArcC2P) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateArcC2PEx) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateArc3P) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateArc2PD) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateArc2PDEx) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PV", LuaCreateArc2PV) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtBiArc", LuaCreateBiArc) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveFillet", LuaCreateCurveFillet) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveChamfer", LuaCreateCurveChamfer) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezier", LuaCreateCurveBezier) ; diff --git a/LUA_GdbModifyCurve.cpp b/LUA_GdbModifyCurve.cpp index aedf223..e145482 100644 --- a/LUA_GdbModifyCurve.cpp +++ b/LUA_GdbModifyCurve.cpp @@ -328,7 +328,7 @@ LuaApproxCurve( lua_State* L) //------------------------------------------------------------------------------- static int -LuaModifyCurveArcRadius( lua_State* L) +LuaModifyArcRadius( lua_State* L) { // 2 parametri : Id, dNewRad int nId ; @@ -337,7 +337,35 @@ LuaModifyCurveArcRadius( lua_State* L) LuaCheckParam( L, 2, dNewRad) LuaClearStack( L) ; // modifica del raggio - bool bOk = ExeModifyCurveArcRadius( nId, dNewRad) ; + bool bOk = ExeModifyArcRadius( nId, dNewRad) ; + LuaSetParam( L, bOk) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaModifyArcToExplementary( lua_State* L) +{ + // 1 parametro : Id + int nId ; + LuaCheckParam( L, 1, nId) + LuaClearStack( L) ; + // modifica del raggio + bool bOk = ExeModifyArcToExplementary( nId) ; + LuaSetParam( L, bOk) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaModifyArcByFlip( lua_State* L) +{ + // 1 parametro : Id + int nId ; + LuaCheckParam( L, 1, nId) + LuaClearStack( L) ; + // modifica del raggio + bool bOk = ExeModifyArcByFlip( nId) ; LuaSetParam( L, bOk) ; return 1 ; } @@ -399,7 +427,9 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtPoint", LuaSplitCurveAtPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtSelfInters", LuaSplitCurveAtSelfInters) ; bOk = bOk && luaMgr.RegisterFunction( "EgtApproxCurve", LuaApproxCurve) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveArcRadius", LuaModifyCurveArcRadius) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcRadius", LuaModifyArcRadius) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcToExplementary", LuaModifyArcToExplementary) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcByFlip", LuaModifyArcByFlip) ; bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeCurveCompo", LuaExplodeCurveCompo) ; bOk = bOk && luaMgr.RegisterFunction( "EgtMergeCurvesInCurveCompo", LuaMergeCurvesInCurveCompo) ; return bOk ; diff --git a/LUA_GeoSnap.cpp b/LUA_GeoSnap.cpp index 8adb86a..8309da8 100644 --- a/LUA_GeoSnap.cpp +++ b/LUA_GeoSnap.cpp @@ -394,7 +394,7 @@ LuaCurveSelfIntersNbr( lua_State* L) //---------------------------------------------------------------------------- static int -LuaCurveArcRadius( lua_State* L) +LuaArcRadius( lua_State* L) { // 1 parametro : Id int nId ; @@ -402,7 +402,7 @@ LuaCurveArcRadius( lua_State* L) LuaClearStack( L) ; // recupero il raggio double dRad ; - if ( ExeCurveArcRadius( nId, &dRad)) + if ( ExeArcRadius( nId, &dRad)) LuaSetParam( L, dRad) ; else LuaSetParam( L) ; @@ -411,7 +411,41 @@ LuaCurveArcRadius( lua_State* L) //---------------------------------------------------------------------------- static int -LuaCurveArcNormVersor( lua_State* L) +LuaArcAngCenter( lua_State* L) +{ + // 1 parametro : Id + int nId ; + LuaCheckParam( L, 1, nId) + LuaClearStack( L) ; + // recupero l'angolo al centro in gradi + double pdAngDeg ; + if ( ExeArcAngCenter( nId, &pdAngDeg)) + LuaSetParam( L, pdAngDeg) ; + else + LuaSetParam( L) ; + return 1 ; +} + +//---------------------------------------------------------------------------- +static int +LuaArcDeltaN( lua_State* L) +{ + // 1 parametro : Id + int nId ; + LuaCheckParam( L, 1, nId) + LuaClearStack( L) ; + // recupero il delta su normale al suo piano + double dDeltaN ; + if ( ExeArcDeltaN( nId, &dDeltaN)) + LuaSetParam( L, dDeltaN) ; + else + LuaSetParam( L) ; + return 1 ; +} + +//---------------------------------------------------------------------------- +static int +LuaArcNormVersor( lua_State* L) { // 1 o 2 parametri : Id [, nRefId] int nId ; @@ -421,7 +455,7 @@ LuaCurveArcNormVersor( lua_State* L) LuaClearStack( L) ; // recupero il versore Vector3d vtNorm ; - if ( ExeCurveArcNormVersor( nId, nRefId, vtNorm)) + if ( ExeArcNormVersor( nId, nRefId, vtNorm)) LuaSetParam( L, vtNorm) ; else LuaSetParam( L) ; @@ -568,7 +602,7 @@ LuaSurfTmFacetNormVersor( lua_State* L) //---------------------------------------------------------------------------- static int -LuaExtTextNormVersor( lua_State* L) +LuaTextNormVersor( lua_State* L) { // 1 o 2 parametri : Id [, nRefId] int nId ; @@ -578,7 +612,7 @@ LuaExtTextNormVersor( lua_State* L) LuaClearStack( L) ; // recupero il versore Vector3d vtNorm ; - if ( ExeExtTextNormVersor( nId, nRefId, vtNorm)) + if ( ExeTextNormVersor( nId, nRefId, vtNorm)) LuaSetParam( L, vtNorm) ; else LuaSetParam( L) ; @@ -609,14 +643,16 @@ LuaInstallGeoSnap( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtCurveExtrusion", LuaCurveExtrusion) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveThickness", LuaCurveThickness) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveSelfIntersNbr", LuaCurveSelfIntersNbr) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtCurveArcRadius", LuaCurveArcRadius) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtCurveArcNormVersor", LuaCurveArcNormVersor) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArcRadius", LuaArcRadius) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArcAngCenter", LuaArcAngCenter) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArcDeltaN", LuaArcDeltaN) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArcNormVersor", LuaArcNormVersor) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoCenter", LuaCurveCompoCenter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNbr", LuaSurfTmFacetNbr) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestEndPoint", LuaSurfTmFacetNearestEndPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestMidPoint", LuaSurfTmFacetNearestMidPoint) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCenter", LuaSurfTmFacetCenter) ; bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNormVersor", LuaSurfTmFacetNormVersor) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtExtTextNormVersor", LuaExtTextNormVersor) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtTextNormVersor", LuaTextNormVersor) ; return bOk ; }