diff --git a/AuxTools.cpp b/AuxTools.cpp index 17e1a66..8c18763 100644 --- a/AuxTools.cpp +++ b/AuxTools.cpp @@ -12,6 +12,8 @@ //---------------------------------------------------------------------------- #include "stdafx.h" +#include "EXE.h" +#include "EXE_Macro.h" #include "AuxTools.h" #include "/EgtDev/Include/EGkExtText.h" #include "/EgtDev/Include/EMkDispositionConst.h" @@ -20,6 +22,29 @@ using namespace std ; +//---------------------------------------------------------------------------- +const string +IdToString( int nId) +{ + GseContext* pCtx = GetCurrGseContext() ; + VERIFY_CTX( pCtx, "GDB_ID.NULL") + switch ( nId) { + case GDB_ID_ROOT : return "GDB_ID.ROOT" ; + case GDB_ID_NULL : return "GDB_ID.NULL" ; + case GDB_ID_SEL : return "GDB_ID.SEL" ; + case GDB_ID_GRID : return "GDB_ID.GRID" ; + case GDB_ID_CURRPART : return "GDB_ID.CP" ; + case GDB_ID_CURRLAYER : return "GDB_ID.CL" ; + default : + if ( nId == pCtx->m_nCurrPart) + return "GDB_ID.CP" ; + else if ( nId == pCtx->m_nCurrLayer) + return "GDB_ID.CL" ; + else + return ToString( nId) ; + } +} + //---------------------------------------------------------------------------- const string IdListToString( const INTVECTOR& vIds) @@ -113,6 +138,18 @@ OffsTypeToString( int nOffsType) } } +//---------------------------------------------------------------------------- +const char* +InterpTypeToString( int nIntpType) +{ + switch ( nIntpType) { + case ITT_AKIMA : return "GDB_PI.AKIMA" ; + default : + case ITT_AKIMA_CORNER : return "GDB_PI.AKIMA_CORNER" ; + case ITT_BESSEL : return "GDB_PI.BESSEL" ; + } +} + //---------------------------------------------------------------------------- const char* ApproxTypeToString( int nApprType) diff --git a/AuxTools.h b/AuxTools.h index ee25966..cc6326c 100644 --- a/AuxTools.h +++ b/AuxTools.h @@ -17,6 +17,8 @@ class IGeomDB ; //---------------------------------------------------------------------------- +// Id con gestione delle relative costanti +const std::string IdToString( int nId) ; // Lista di Id completa (parametro per lua) const std::string IdListToString( const INTVECTOR& vIds) ; // Tipo del file Nge @@ -31,6 +33,8 @@ const char* RefTypeToString( int nRefType) ; const char* ETxtInsPosToString( int nETxtInsPos) ; // Tipo di offset di curva const char* OffsTypeToString( int nOffsType) ; +// Tipo di interpolazione di punti +const char* InterpTypeToString( int nIntpType) ; // Tipo di approssimazione di curva const char* ApproxTypeToString( int nApprType) ; // Flag per posizione corner rispetto a grezzo diff --git a/EXE_GdbCreate.cpp b/EXE_GdbCreate.cpp index 33f9647..af3b949 100644 --- a/EXE_GdbCreate.cpp +++ b/EXE_GdbCreate.cpp @@ -34,6 +34,7 @@ ExeCreateGroup( int nParentId, const Frame3d& frFrame, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -52,12 +53,17 @@ ExeCreateGroup( int nParentId, const Frame3d& frFrame, int nRefType) // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua ; - if ( AreSameFrame( frFrame, GLOB_FRM)) - sLua = "EgtGroup(" + ToString( nParentId) + "," + - RefTypeToString( nRefType) + ")" + - " -- Id=" + ToString( nId) ; + if ( AreSameFrame( frFrame, GLOB_FRM)) { + if ( nRefType == RTY_LOC) + sLua = "EgtGroup(" + IdToString( nParentId) + ")" + + " -- Id=" + ToString( nId) ; + else + sLua = "EgtGroup(" + IdToString( nParentId) + "," + + RefTypeToString( nRefType) + ")" + + " -- Id=" + ToString( nId) ; + } else - sLua = "EgtGroup(" + ToString( nParentId) + ",{{" + + sLua = "EgtGroup(" + IdToString( nParentId) + ",{{" + ToString( frFrame.Orig()) + "},{" + ToString( frFrame.VersX()) + "},{" + ToString( frFrame.VersY()) + "},{" + @@ -76,12 +82,13 @@ ExeCreateGeoPoint( int nParentId, const Point3d& ptP, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; // porto in locale il punto - Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; ; + Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; // creo il punto PtrOwner pGeoPnt( CreateGeoPoint3d()) ; bOk = bOk && ! IsNull( pGeoPnt) ; @@ -92,7 +99,7 @@ ExeCreateGeoPoint( int nParentId, const Point3d& ptP, int nRefType) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtPoint(" + ToString( nParentId) + ",{" + + string sLua = "EgtPoint(" + IdToString( nParentId) + ",{" + ToString( ptP) + "}," + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; @@ -108,13 +115,14 @@ ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; // porto in locale il vettore e il punto - Vector3d vtVL = GetVectorLocal( pGeomDB, vtV, nRefType, frLoc) ; ; - Point3d ptBL = GetPointLocal( pGeomDB, ptB, nRefType, frLoc) ; ; + Vector3d vtVL = GetVectorLocal( pGeomDB, vtV, nRefType, frLoc) ; + Point3d ptBL = GetPointLocal( pGeomDB, ptB, nRefType, frLoc) ; // creo il vettore PtrOwner pGeoVct( CreateGeoVector3d()) ; bOk = bOk && ! IsNull( pGeoVct) ; @@ -127,12 +135,12 @@ ExeCreateGeoVector( int nParentId, const Vector3d& vtV, const Point3d& ptB, int if ( IsCmdLog()) { string sLua ; if ( ptB.IsSmall()) - sLua = "EgtVector(" + ToString( nParentId) + ",{" + + sLua = "EgtVector(" + IdToString( nParentId) + ",{" + ToString( vtV) + "}," + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; else - sLua = "EgtVector(" + ToString( nParentId) + ",{" + + sLua = "EgtVector(" + IdToString( nParentId) + ",{" + ToString( vtV) + "},{" + ToString( ptB) + "}," + RefTypeToString( nRefType) + ")" + @@ -149,15 +157,16 @@ ExeCreateGeoFrame( int nParentId, const Frame3d& frFrame, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; // porto in locale l'origine e i versori - Point3d ptOrigL = GetPointLocal( pGeomDB, frFrame.Orig(), nRefType, frLoc) ; ; - Vector3d vtXL = GetVectorLocal( pGeomDB, frFrame.VersX(), nRefType, frLoc) ; ; - Vector3d vtYL = GetVectorLocal( pGeomDB, frFrame.VersY(), nRefType, frLoc) ; ; - Vector3d vtZL = GetVectorLocal( pGeomDB, frFrame.VersZ(), nRefType, frLoc) ; ; + Point3d ptOrigL = GetPointLocal( pGeomDB, frFrame.Orig(), nRefType, frLoc) ; + Vector3d vtXL = GetVectorLocal( pGeomDB, frFrame.VersX(), nRefType, frLoc) ; + Vector3d vtYL = GetVectorLocal( pGeomDB, frFrame.VersY(), nRefType, frLoc) ; + Vector3d vtZL = GetVectorLocal( pGeomDB, frFrame.VersZ(), nRefType, frLoc) ; // creo e setto il riferimento PtrOwner pGeoFrm( CreateGeoFrame3d()) ; bOk = bOk && ! IsNull( pGeoFrm) ; @@ -167,7 +176,7 @@ ExeCreateGeoFrame( int nParentId, const Frame3d& frFrame, int nRefType) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtFrame(" + ToString( nParentId) + ",{{" + + string sLua = "EgtFrame(" + IdToString( nParentId) + ",{{" + ToString( frFrame.Orig()) + "},{" + ToString( frFrame.VersX()) + "},{" + ToString( frFrame.VersY()) + "},{" + @@ -182,19 +191,20 @@ ExeCreateGeoFrame( int nParentId, const Frame3d& frFrame, int nRefType) //------------------------------------------------------------------------------- int -ExeCreateText( int nParentId, const Point3d& ptP, double dAngRotDeg, +ExeCreateText( int nParentId, const Point3d& ptP, const string& sText, double dH, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; // porto in locale l'origine e i versori - Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; ; - Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; ; - Vector3d vtDL = GetVectorLocal( pGeomDB, X_AX, nRefType, frLoc) ; ; + Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; + Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; + Vector3d vtDL = GetVectorLocal( pGeomDB, X_AX, nRefType, frLoc) ; // creo il testo e lo riempio PtrOwner pTXT( CreateExtText()) ; bOk = bOk && ! IsNull( pTXT) ; @@ -204,10 +214,11 @@ ExeCreateText( int nParentId, const Point3d& ptP, double dAngRotDeg, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtText(" + ToString( nParentId) + ",{" + - ToString( ptP) + "}," + - ToString( dAngRotDeg) + ",'" + - sText + "','" + + string sLuaText = sText ; + ReplaceString( sLuaText, "'", "\\'") ; + string sLua = "EgtText(" + IdToString( nParentId) + ",{" + + ToString( ptP) + "},'" + + sLuaText + "'," + ToString( dH) + "," + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; @@ -219,19 +230,20 @@ ExeCreateText( int nParentId, const Point3d& ptP, double dAngRotDeg, //------------------------------------------------------------------------------- int -ExeCreateTextEx( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD, +ExeCreateTextEx( int nParentId, const Point3d& ptP, double dAngRotDeg, const string& sText, const string& sFont, bool bItalic, double dH, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; // porto in locale l'origine e i versori - Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; ; - Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; ; - Vector3d vtDL = GetVectorLocal( pGeomDB, vtD, nRefType, frLoc) ; ; + Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; + Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; + Vector3d vtDL = GetVectorLocal( pGeomDB, FromPolar(1, dAngRotDeg), nRefType, frLoc) ; // creo il testo e lo riempio PtrOwner pTXT( CreateExtText()) ; bOk = bOk && ! IsNull( pTXT) ; @@ -241,12 +253,15 @@ ExeCreateTextEx( int nParentId, const Point3d& ptP, const Vector3d& vtN, const V ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtTextEx(" + ToString( nParentId) + ",{" + - ToString( ptP) + "},{" + - ToString( vtN) + "},{" + - ToString( vtD) + "},'" + - sText + "','" + - sFont + "'," + + string sLuaText = sText ; + ReplaceString( sLuaText, "'", "\\'") ; + string sLuaFont = sFont ; + ReplaceString( sLuaFont, "'", "\\'") ; + string sLua = "EgtTextEx(" + IdToString( nParentId) + ",{" + + ToString( ptP) + "}," + + ToString( dAngRotDeg) + ",'" + + sLuaText + "','" + + sLuaFont + "'," + ( bItalic ? "'I'" : "'S'") + "," + ToString( dH) + "," + RefTypeToString( nRefType) + ")" + @@ -259,20 +274,21 @@ ExeCreateTextEx( int nParentId, const Point3d& ptP, const Vector3d& vtN, const V //------------------------------------------------------------------------------- int -ExeCreateTextAdv( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD, +ExeCreateTextAdv( int nParentId, const Point3d& ptP, double dAngRotDeg, const string& sText, const string& sFont, int nW, bool bItalic, double dH, double dRat, double dAddAdv, int nInsPos, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; // porto in locale l'origine e i versori - Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; ; - Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; ; - Vector3d vtDL = GetVectorLocal( pGeomDB, vtD, nRefType, frLoc) ; ; + Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; + Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; + Vector3d vtDL = GetVectorLocal( pGeomDB, FromPolar(1, dAngRotDeg), nRefType, frLoc) ; // creo il testo e lo imposto PtrOwner pTXT( CreateExtText()) ; bOk = bOk && ! IsNull( pTXT) ; @@ -282,12 +298,15 @@ ExeCreateTextAdv( int nParentId, const Point3d& ptP, const Vector3d& vtN, const ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtTextAdv(" + ToString( nParentId) + ",{" + - ToString( ptP) + "},{" + - ToString( vtN) + "},{" + - ToString( vtD) + "},'" + - sText + "','" + - sFont + "'," + + string sLuaText = sText ; + ReplaceString( sLuaText, "'", "\\'") ; + string sLuaFont = sFont ; + ReplaceString( sLuaFont, "'", "\\'") ; + string sLua = "EgtTextAdv(" + IdToString( nParentId) + ",{" + + ToString( ptP) + "}," + + ToString( dAngRotDeg) + ",'" + + sLuaText + "','" + + sLuaFont + "'," + ToString( nW) + "," + ( bItalic ? "'I'" : "'S'") + "," + ToString( dH) + "," + diff --git a/EXE_GdbCreateCurve.cpp b/EXE_GdbCreateCurve.cpp index 8f82a0c..eede9d3 100644 --- a/EXE_GdbCreateCurve.cpp +++ b/EXE_GdbCreateCurve.cpp @@ -31,10 +31,12 @@ #include "/EgtDev/Include/EgkArcSpecial.h" #include "/EgtDev/Include/EgkArcPntDirTgCurve.h" #include "/EgtDev/Include/EgkArcCenTgCurvePnt.h" +#include "/EgtDev/Include/EGkBiArcs.h" #include "/EgtDev/Include/EgkFilletChamfer.h" #include "/EgtDev/Include/EgkCurveBezier.h" #include "/EgtDev/Include/EgkCurveComposite.h" #include "/EgtDev/Include/EgkChainCurves.h" +#include "/EgtDev/Include/EGkCurveByInterp.h" #include "/EgtDev/Include/EgkSurfTriMesh.h" #include "/EgtDev/Include/EGkDistPointCurve.h" #include "/EgtDev/Include/EGkStringUtils3d.h" @@ -65,6 +67,7 @@ ExeCreateCurveLine( int nParentId, const Point3d& ptIni, const Point3d& ptFin, i { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo la linea PtrOwner pCrvLine( CreateCurveLine()) ; if ( IsNull( pCrvLine)) @@ -87,7 +90,7 @@ ExeCreateCurveLine( int nParentId, const Point3d& ptIni, const Point3d& ptFin, i ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtLine(" + ToString( nParentId) + ",{" + + string sLua = "EgtLine(" + IdToString( nParentId) + ",{" + ToString( ptIni) + "},{" + ToString( ptFin) + "}," + RefTypeToString( nRefType) + ")" + @@ -105,6 +108,7 @@ ExeCreateCurveLineEx( int nParentId, const Point3d& ptIni, int nSepI, int nIdI, { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // puntatore alla linea PtrOwner pCrvLine ; // recupero il riferimento locale @@ -190,13 +194,13 @@ ExeCreateCurveLineEx( int nParentId, const Point3d& ptIni, int nSepI, int nIdI, if ( IsCmdLog()) { string sLua ; if ( nSepI == SEP_STD && nSepF == SEP_STD) - sLua = "EgtLine(" + ToString( nParentId) + ",{" + + sLua = "EgtLine(" + IdToString( nParentId) + ",{" + ToString( ptIni) + "},{" + ToString( ptFin) + "}," + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; else - sLua = "EgtLineEx(" + ToString( nParentId) + ",{" + + sLua = "EgtLineEx(" + IdToString( nParentId) + ",{" + ToString( ptIni) + "}," + SepToString( nSepI) + "," + ToString( nIdI) + ",{" + @@ -474,11 +478,54 @@ CreateLineTgCurvePerpCurve( IGeomDB* pGeomDB, int nParentId, //------------------------------------------------------------------------------- int -ExeCreateCurveLinePVL( int nParentId, const Point3d& ptIni, - const Vector3d& vtDir, double dLen, int nRefType) +ExeCreateCurveLinePDL( int nParentId, const Point3d& ptIni, + double dDirDeg, double dLen, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; + // recupero il riferimento locale + Frame3d frLoc ; + if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc)) + return GDB_ID_NULL ; + // porto in locale il punto e i versori + Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ; + Vector3d vtDirL = GetVectorLocal( pGeomDB, FromPolar( 1, dDirDeg), nRefType, frLoc) ; + Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; + // creo la linea + PtrOwner pCrvLine( CreateCurveLine()) ; + if ( IsNull( pCrvLine)) + return GDB_ID_NULL ; + // setto la linea + if ( ! pCrvLine->SetPVL( ptIniL, vtDirL, dLen)) + return GDB_ID_NULL ; + // assegno il versore estrusione + pCrvLine->SetExtrusion( vtExtrL) ; + // inserisco la linea nel DB + int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvLine)) ; + ExeSetModified() ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtLinePDL(" + IdToString( nParentId) + ",{" + + ToString( ptIni) + "}," + + ToString( dDirDeg) + "," + + ToString( dLen) + "," + + RefTypeToString( nRefType) + ")" + + " -- Id=" + ToString( nId) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco l'identificativo della nuova entità + return nId ; +} + +//------------------------------------------------------------------------------- +int +ExeCreateCurveLinePVL( int nParentId, const Point3d& ptIni, + const Vector3d& vtDir, double dLen, int nRefType) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // recupero il riferimento locale Frame3d frLoc ; if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc)) @@ -501,7 +548,7 @@ ExeCreateCurveLinePVL( int nParentId, const Point3d& ptIni, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtLinePVL(" + ToString( nParentId) + ",{" + + string sLua = "EgtLinePVL(" + IdToString( nParentId) + ",{" + ToString( ptIni) + "},{" + ToString( vtDir) + "}," + ToString( dLen) + "," + @@ -520,6 +567,7 @@ ExeCreateCurveLineMinPointCurve( int nParentId, { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // recupero il riferimento locale Frame3d frLoc ; if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc)) @@ -560,7 +608,7 @@ ExeCreateCurveLineMinPointCurve( int nParentId, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtLineMinPointCurve(" + ToString( nParentId) + ",{" + + string sLua = "EgtLineMinPointCurve(" + IdToString( nParentId) + ",{" + ToString( ptStart) + "}," + ToString( nCrvId) + "," + ToString( dNearPar) + "," + @@ -574,11 +622,11 @@ ExeCreateCurveLineMinPointCurve( int nParentId, //------------------------------------------------------------------------------- int -ExeCreateCurveCircle( int nParentId, const Point3d& ptCen, - const Vector3d& vtN, double dRad, int nRefType) +ExeCreateCurveCircle( int nParentId, const Point3d& ptCen, double dRad, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo l'arco PtrOwner pCrvArc( CreateCurveArc()) ; if ( IsNull( pCrvArc)) @@ -589,7 +637,7 @@ ExeCreateCurveCircle( int nParentId, const Point3d& ptCen, return GDB_ID_NULL ; // porto in locale i punti e i versori Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ; - Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; + Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // setto la circonferenza if ( ! pCrvArc->Set( ptCenL, vtNL, dRad)) @@ -601,9 +649,8 @@ ExeCreateCurveCircle( int nParentId, const Point3d& ptCen, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtCircle(" + ToString( nParentId) + ",{" + - ToString( ptCen) + "},{" + - ToString( vtN) + "}," + + string sLua = "EgtCircle(" + IdToString( nParentId) + ",{" + + ToString( ptCen) + "}," + ToString( dRad) + "," + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; @@ -615,11 +662,12 @@ ExeCreateCurveCircle( int nParentId, const Point3d& ptCen, //------------------------------------------------------------------------------- int -ExeCreateCurveCircleCPN( int nParentId, const Point3d& ptCen, - const Point3d& ptOn, const Vector3d& vtN, int nRefType) +ExeCreateCurveCircleCP( int nParentId, const Point3d& ptCen, + const Point3d& ptOn, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo l'arco PtrOwner pCrvArc( CreateCurveArc()) ; bool bOk = ! IsNull( pCrvArc) ; @@ -629,7 +677,7 @@ ExeCreateCurveCircleCPN( int nParentId, const Point3d& ptCen, // porto in locale i punti e i versori Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ; Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ; - Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; + Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // calcolo il raggio double dRad = (( ptOnL - ptCenL) ^ vtNL).Len() ; @@ -642,11 +690,10 @@ ExeCreateCurveCircleCPN( int nParentId, const Point3d& ptCen, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtCircleCPN(" + ToString( nParentId) + ",{" + - ToString( ptCen) + "},{" + - ToString( ptOn) + "},{" + - ToString( vtN) + "}," + - RefTypeToString( nRefType) + ")" + + string sLua = "EgtCircleCP(" + IdToString( nParentId) + ",{" + + ToString( ptCen) + "},{" + + ToString( ptOn) + "}," + + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } @@ -656,11 +703,12 @@ ExeCreateCurveCircleCPN( int nParentId, const Point3d& ptCen, //------------------------------------------------------------------------------- int -ExeCreateCurveCircleCPNEx( int nParentId, const Point3d& ptCen, - const Point3d& ptOn, int nSepO, int nIdO, const Vector3d& vtN, int nRefType) +ExeCreateCurveCircleCPEx( int nParentId, const Point3d& ptCen, + const Point3d& ptOn, int nSepO, int nIdO, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo l'arco PtrOwner pCrvArc ; bool bOk = true ; @@ -670,7 +718,7 @@ ExeCreateCurveCircleCPNEx( int nParentId, const Point3d& ptCen, // porto in locale i punti e i versori Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ; Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ; - Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; + Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // se punto standard if ( nSepO == SEP_STD) { @@ -699,13 +747,12 @@ ExeCreateCurveCircleCPNEx( int nParentId, const Point3d& ptCen, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtCircleCPNEx(" + ToString( nParentId) + ",{" + - ToString( ptCen) + "},{" + - ToString( ptOn) + "}," + - SepToString( nSepO) + "," + - ToString( nIdO) + ",{" + - ToString( vtN) + "}," + - RefTypeToString( nRefType) + ")" + + string sLua = "EgtCircleCPEx(" + IdToString( nParentId) + ",{" + + ToString( ptCen) + "},{" + + ToString( ptOn) + "}," + + SepToString( nSepO) + "," + + ToString( nIdO) + "," + + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } @@ -720,6 +767,7 @@ ExeCreateCurveCircle3P( int nParentId, const Point3d& ptP1, { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo l'arco PtrOwner pCrvArc( CreateCurveArc()) ; if ( IsNull( pCrvArc)) @@ -743,7 +791,7 @@ ExeCreateCurveCircle3P( int nParentId, const Point3d& ptP1, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtCircle3P(" + ToString( nParentId) + ",{" + + string sLua = "EgtCircle3P(" + IdToString( nParentId) + ",{" + ToString( ptP1) + "},{" + ToString( ptP2) + "},{" + ToString( ptP3) + "}," + @@ -757,12 +805,12 @@ ExeCreateCurveCircle3P( int nParentId, const Point3d& ptP1, //------------------------------------------------------------------------------- int -ExeCreateCurveArc( int nParentId, - const Point3d& ptCen, const Vector3d& vtN, double dRad, - const Vector3d& vtS, double dAngCenDeg, double dDeltaN, int nRefType) +ExeCreateCurveArc( int nParentId, const Point3d& ptCen, double dRad, + double dAngIniDeg, double dAngCenDeg, double dDeltaN, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo l'arco PtrOwner pCrvArc( CreateCurveArc()) ; if ( IsNull( pCrvArc)) @@ -773,8 +821,8 @@ ExeCreateCurveArc( int nParentId, return GDB_ID_NULL ; // porto in locale i punti, i versori e il versore estrusione Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ; - Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; - Vector3d vtSL = GetVectorLocal( pGeomDB, vtS, nRefType, frLoc) ; + Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; + Vector3d vtSL = GetVectorLocal( pGeomDB, FromPolar( 1, dAngIniDeg), nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // setto l'arco if ( ! pCrvArc->Set( ptCenL, vtNL, dRad, vtSL, dAngCenDeg, dDeltaN)) @@ -786,11 +834,10 @@ ExeCreateCurveArc( int nParentId, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtArc(" + ToString( nParentId) + ",{" + - ToString( ptCen) + "},{" + - ToString( vtN) + "}," + - ToString( dRad) + ",{" + - ToString( vtS) + "}," + + string sLua = "EgtArc(" + IdToString( nParentId) + ",{" + + ToString( ptCen) + "}," + + ToString( dRad) + "," + + ToString( dAngIniDeg) + "," + ToString( dAngCenDeg) + "," + ToString( dDeltaN) + "," + RefTypeToString( nRefType) + ")" + @@ -803,11 +850,12 @@ ExeCreateCurveArc( int nParentId, //------------------------------------------------------------------------------- int -ExeCreateCurveArcC2PN( int nParentId, const Point3d& ptCen, const Point3d& ptStart, - const Point3d& ptNearEnd, const Vector3d& vtNorm, int nRefType) +ExeCreateCurveArcC2P( int nParentId, const Point3d& ptCen, const Point3d& ptStart, + const Point3d& ptNearEnd, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo l'arco PtrOwner pCrvArc( CreateCurveArc()) ; if ( IsNull( pCrvArc)) @@ -820,7 +868,7 @@ ExeCreateCurveArcC2PN( int nParentId, const Point3d& ptCen, const Point3d& ptSta Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ; Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ; Point3d ptNearEndL = GetPointLocal( pGeomDB, ptNearEnd, nRefType, frLoc) ; - Vector3d vtNormL = GetVectorLocal( pGeomDB, vtNorm, nRefType, frLoc) ; + Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // setto l'arco if ( ! pCrvArc->SetC2PN( ptCenL, ptStartL, ptNearEndL, vtNormL)) @@ -832,12 +880,11 @@ ExeCreateCurveArcC2PN( int nParentId, const Point3d& ptCen, const Point3d& ptSta ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtArcC2PN(" + ToString( nParentId) + ",{" + - ToString( ptCen) + "},{" + - ToString( ptStart) + "},{" + - ToString( ptNearEnd) + "},{" + - ToString( vtNorm) + "}," + - RefTypeToString( nRefType) + ")" + + string sLua = "EgtArcC2P(" + IdToString( nParentId) + ",{" + + ToString( ptCen) + "},{" + + ToString( ptStart) + "},{" + + ToString( ptNearEnd) + "}," + + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } @@ -847,12 +894,13 @@ ExeCreateCurveArcC2PN( int nParentId, const Point3d& ptCen, const Point3d& ptSta //------------------------------------------------------------------------------- int -ExeCreateCurveArcC2PNEx( int nParentId, const Point3d& ptCen, - const Point3d& ptStart, int nSepS, int nIdS, - const Point3d& ptNearEnd, const Vector3d& vtNorm, int nRefType) +ExeCreateCurveArcC2PEx( 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) + nParentId = AdjustId( nParentId) ; // creo l'arco PtrOwner pCrvArc ; bool bOk = true ; @@ -863,7 +911,7 @@ ExeCreateCurveArcC2PNEx( int nParentId, const Point3d& ptCen, Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ; Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ; Point3d ptNearEndL = GetPointLocal( pGeomDB, ptNearEnd, nRefType, frLoc) ; - Vector3d vtNormL = GetVectorLocal( pGeomDB, vtNorm, nRefType, frLoc) ; + Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // se punto standard if ( nSepS == SEP_STD) { @@ -891,14 +939,13 @@ ExeCreateCurveArcC2PNEx( int nParentId, const Point3d& ptCen, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtArcC2PNEx(" + ToString( nParentId) + ",{" + - ToString( ptCen) + "},{" + - ToString( ptStart) + "}," + - SepToString( nSepS) + "," + - ToString( nIdS) + ",{" + - ToString( ptNearEnd) + "},{" + - ToString( vtNorm) + "}," + - RefTypeToString( nRefType) + ")" + + string sLua = "EgtArcC2PEx(" + IdToString( nParentId) + ",{" + + ToString( ptCen) + "},{" + + ToString( ptStart) + "}," + + SepToString( nSepS) + "," + + ToString( nIdS) + ",{" + + ToString( ptNearEnd) + "}," + + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } @@ -913,6 +960,7 @@ ExeCreateCurveArc3P( int nParentId, const Point3d& ptP1, { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo l'arco PtrOwner pCrv ; bool bOk = true ; @@ -940,7 +988,7 @@ ExeCreateCurveArc3P( int nParentId, const Point3d& ptP1, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtArc3P(" + ToString( nParentId) + ",{" + + string sLua = "EgtArc3P(" + IdToString( nParentId) + ",{" + ToString( ptP1) + "},{" + ToString( ptP2) + "},{" + ToString( ptP3) + "}," + @@ -954,22 +1002,23 @@ ExeCreateCurveArc3P( int nParentId, const Point3d& ptP1, //------------------------------------------------------------------------------- int -ExeCreateCurveArc2PVN( int nParentId, const Point3d& ptStart, const Point3d& ptEnd, - const Vector3d& vtDirS, const Vector3d& vtNorm, int nRefType) +ExeCreateCurveArc2PD( int nParentId, const Point3d& ptStart, const Point3d& ptEnd, + double dDirSDeg, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo l'arco (in casi particolari retta) PtrOwner pCrv ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; - // porto in locale i punti, i versori e il versore estrusione + // porto in locale i punti, il versore iniziale, quello normale e il versore estrusione Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ; Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ; - Vector3d vtDirSL = GetVectorLocal( pGeomDB, vtDirS, nRefType, frLoc) ; - Vector3d vtNormL = GetVectorLocal( pGeomDB, vtNorm, nRefType, frLoc) ; + Vector3d vtDirSL = GetVectorLocal( pGeomDB, FromPolar( 1, dDirSDeg), nRefType, frLoc) ; + Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // setto l'arco pCrv.Set( GetArc2PVN( ptStartL, ptEndL, vtDirSL, vtNormL)) ; @@ -981,12 +1030,11 @@ ExeCreateCurveArc2PVN( int nParentId, const Point3d& ptStart, const Point3d& ptE ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtArc2PVN(" + ToString( nParentId) + ",{" + - ToString( ptStart) + "},{" + - ToString( ptEnd) + "},{" + - ToString( vtDirS) + "},{" + - ToString( vtNorm) + "}," + - RefTypeToString( nRefType) + ")" + + string sLua = "EgtArc2PD(" + IdToString( nParentId) + ",{" + + ToString( ptStart) + "},{" + + ToString( ptEnd) + "}," + + ToString( dDirSDeg) + "," + + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } @@ -996,12 +1044,13 @@ ExeCreateCurveArc2PVN( int nParentId, const Point3d& ptStart, const Point3d& ptE //------------------------------------------------------------------------------- int -ExeCreateCurveArc2PVNEx( int nParentId, const Point3d& ptStart, - const Point3d& ptEnd, int nSep, int nId, - const Vector3d& vtDirS, const Vector3d& vtNorm, int nRefType) +ExeCreateCurveArc2PDEx( 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) + nParentId = AdjustId( nParentId) ; // creo la curva ( in casi particolari potrebbe essere una retta) PtrOwner pCrv ; bool bOk = true ; @@ -1011,8 +1060,8 @@ ExeCreateCurveArc2PVNEx( int nParentId, const Point3d& ptStart, // porto in locale i punti, i versori e il versore estrusione Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ; Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ; - Vector3d vtDirSL = GetVectorLocal( pGeomDB, vtDirS, nRefType, frLoc) ; - Vector3d vtNormL = GetVectorLocal( pGeomDB, vtNorm, nRefType, frLoc) ; + Vector3d vtDirSL = GetVectorLocal( pGeomDB, FromPolar( 1, dDirSDeg), nRefType, frLoc) ; + Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // se punto standard if ( nSep == SEP_STD) { @@ -1053,14 +1102,13 @@ ExeCreateCurveArc2PVNEx( int nParentId, const Point3d& ptStart, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtArc2PVNEx(" + ToString( nParentId) + ",{" + - ToString( ptStart) + "},{" + - ToString( ptEnd) + "}," + - SepToString( nSep) + "," + - ToString( nId) + ",{" + - ToString( vtDirS) + "},{" + - ToString( vtNorm) + "}," + - RefTypeToString( nRefType) + ")" + + string sLua = "EgtArc2PDEx(" + IdToString( nParentId) + ",{" + + ToString( ptStart) + "},{" + + ToString( ptEnd) + "}," + + SepToString( nSep) + "," + + ToString( nId) + "," + + ToString( dDirSDeg) + "," + + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nNewId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } @@ -1070,12 +1118,103 @@ ExeCreateCurveArc2PVNEx( int nParentId, const Point3d& ptStart, //------------------------------------------------------------------------------- int -ExeCreateCurveFillet( int nParentId, int nCrv1, const Point3d& ptNear1, - int nCrv2, const Point3d& ptNear2, - const Vector3d& vtNorm, double dRad, bool bTrim, int nRefType) +ExeCreateCurveArc2PV( int nParentId, const Point3d& ptStart, const Point3d& ptEnd, + const Vector3d& vtDirS, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; + // creo l'arco (in casi particolari retta) + PtrOwner pCrv ; + bool bOk = true ; + // recupero il riferimento locale + Frame3d frLoc ; + bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; + // porto in locale i punti, il versore iniziale e il versore estrusione + Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ; + Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ; + Vector3d vtDirSL = GetVectorLocal( pGeomDB, vtDirS, nRefType, frLoc) ; + Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; + // calcolo la normale locale + Vector3d vtNormL = vtDirSL ^ ( ptEndL - ptStartL) ; + if ( vtNormL.Normalize()) { + if ( vtNormL.z < 0) + vtNormL.Invert() ; + } + else + vtNormL = Z_AX ; + // setto l'arco + pCrv.Set( GetArc2PVN( ptStartL, ptEndL, vtDirSL, vtNormL)) ; + bOk = bOk && ! IsNull( pCrv) ; + // assegno il versore estrusione + bOk = bOk && pCrv->SetExtrusion( vtExtrL) ; + // inserisco l'arco nel DB + int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrv)) : GDB_ID_NULL) ; + ExeSetModified() ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtArc2PV(" + IdToString( nParentId) + ",{" + + ToString( ptStart) + "},{" + + ToString( ptEnd) + "},{" + + ToString( vtDirS) + "}," + + RefTypeToString( nRefType) + ")" + + " -- Id=" + ToString( nId) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco l'identificativo della nuova entità + return nId ; +} + +//------------------------------------------------------------------------------- +int +ExeCreateCurveBiArc( 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) + nParentId = AdjustId( nParentId) ; + // costruisco il biarco direttamente nel piano specificato + PtrOwner pBiArc( GetBiArc( ptStart, dDirSDeg, ptEnd, dDirEDeg, dPar)) ; + bool bOk = ! IsNull( pBiArc) ; + // recupero il riferimento locale + Frame3d frLoc ; + bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; + // se necessario, porto il biarco nel riferimento locale + if ( nRefType == RTY_GLOB) + bOk = bOk && pBiArc->ToLoc( frLoc) ; + else if ( nRefType == RTY_GRID) + bOk = bOk && pBiArc->LocToLoc( pGeomDB->GetGridFrame(), frLoc) ; + // assegno il versore estrusione + Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; + bOk = bOk && pBiArc->SetExtrusion( vtExtrL) ; + // inserisco l'arco nel DB + int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pBiArc)) : GDB_ID_NULL) ; + ExeSetModified() ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtBiArc(" + IdToString( nParentId) + ",{" + + ToString( ptStart) + "},{" + + ToString( ptEnd) + "}," + + ToString( dDirSDeg) + "," + + ToString( dDirEDeg) + "," + + ToString( dPar) + "," + + RefTypeToString( nRefType) + ")" + + " -- Id=" + ToString( nId) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco l'identificativo della nuova entità + return nId ; +} + +//------------------------------------------------------------------------------- +int +ExeCreateCurveFillet( int nParentId, int nCrv1, const Point3d& ptNear1, + int nCrv2, const Point3d& ptNear2, + double dRad, bool bTrim, int nRefType) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo l'arco PtrOwner pArc ; bool bOk = true ; @@ -1085,7 +1224,7 @@ ExeCreateCurveFillet( int nParentId, int nCrv1, const Point3d& ptNear1, // porto in locale i punti, i versori e il versore estrusione Point3d ptNear1L = GetPointLocal( pGeomDB, ptNear1, nRefType, frLoc) ; Point3d ptNear2L = GetPointLocal( pGeomDB, ptNear2, nRefType, frLoc) ; - Vector3d vtNormL = GetVectorLocal( pGeomDB, vtNorm, nRefType, frLoc) ; + Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // recupero la copia locale delle curve CurveLocal CrvLoc1( pGeomDB, nCrv1, frLoc) ; @@ -1116,12 +1255,11 @@ ExeCreateCurveFillet( int nParentId, int nCrv1, const Point3d& ptNear1, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtCurveFillet(" + ToString( nParentId) + "," + + string sLua = "EgtCurveFillet(" + IdToString( nParentId) + "," + ToString( nCrv1) + ",{" + ToString( ptNear1) + "}," + ToString( nCrv2) + ",{" + - ToString( ptNear2) + "},{" + - ToString( vtNorm) + "}," + + ToString( ptNear2) + "}," + ToString( dRad) + "," + ( bTrim ? "true" : "false") + "," + RefTypeToString( nRefType) + ")" + @@ -1135,10 +1273,11 @@ ExeCreateCurveFillet( int nParentId, int nCrv1, const Point3d& ptNear1, int ExeCreateCurveChamfer( int nParentId, int nCrv1, const Point3d& ptNear1, int nCrv2, const Point3d& ptNear2, - const Vector3d& vtNorm, double dDist, bool bTrim, int nRefType) + double dDist, bool bTrim, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo la linea PtrOwner pLine ; bool bOk = true ; @@ -1148,7 +1287,7 @@ ExeCreateCurveChamfer( int nParentId, int nCrv1, const Point3d& ptNear1, // porto in locale i punti, i versori e il versore estrusione Point3d ptNear1L = GetPointLocal( pGeomDB, ptNear1, nRefType, frLoc) ; Point3d ptNear2L = GetPointLocal( pGeomDB, ptNear2, nRefType, frLoc) ; - Vector3d vtNormL = GetVectorLocal( pGeomDB, vtNorm, nRefType, frLoc) ; + Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // recupero la copia locale delle curve CurveLocal CrvLoc1( pGeomDB, nCrv1, frLoc) ; @@ -1179,12 +1318,11 @@ ExeCreateCurveChamfer( int nParentId, int nCrv1, const Point3d& ptNear1, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtCurveChamfer(" + ToString( nParentId) + "," + + string sLua = "EgtCurveChamfer(" + IdToString( nParentId) + "," + ToString( nCrv1) + ",{" + ToString( ptNear1) + "}," + ToString( nCrv2) + ",{" + - ToString( ptNear2) + "},{" + - ToString( vtNorm) + "}," + + ToString( ptNear2) + "}," + ToString( dDist) + "," + ( bTrim ? "true" : "false") + "," + RefTypeToString( nRefType) + ")" + @@ -1200,6 +1338,7 @@ ExeCreateCurveBezier( int nParentId, int nDegree, const PNTVECTOR& vPnt, int nRe { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // il numero dei punti deve essere pari al grado + 1 bOk = bOk && ( vPnt.size() == nDegree + 1) ; @@ -1235,7 +1374,7 @@ ExeCreateCurveBezier( int nParentId, int nDegree, const PNTVECTOR& vPnt, int nRe sPC += "," ; sPC += "{" + ToString( vPnt[i]) + "}" ; } - string sLua = "EgtCurveBezier(" + ToString( nParentId) + "," + + string sLua = "EgtCurveBezier(" + IdToString( nParentId) + "," + ToString( nDegree) + ",{" + sPC + "}," + RefTypeToString( nRefType) + ")" + @@ -1252,6 +1391,7 @@ ExeCreateCurveBezierRational( int nParentId, int nDegree, const PNTUVECTOR& vPnt { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // il numero dei punti deve essere pari al grado + 1 bOk = bOk && ( vPntW.size() == nDegree + 1) ; @@ -1287,7 +1427,7 @@ ExeCreateCurveBezierRational( int nParentId, int nDegree, const PNTUVECTOR& vPnt sPC += "," ; sPC += "{" + ToString( vPntW[i].first, vPntW[i].second) + "}" ; } - string sLua = "EgtCurveBezierRat(" + ToString( nParentId) + "," + + string sLua = "EgtCurveBezierRat(" + IdToString( nParentId) + "," + ToString( nDegree) + ",{" + sPC + "}," + RefTypeToString( nRefType) + ")" + @@ -1304,6 +1444,7 @@ ExeCreateCurveBezierFromArc( int nParentId, int nArcId, bool bErase) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // creo la curva di Bezier PtrOwner pCrvBez( CreateCurveBezier()) ; @@ -1336,7 +1477,7 @@ ExeCreateCurveBezierFromArc( int nParentId, int nArcId, bool bErase) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtCurveBezierFromArc(" + ToString( nParentId) + "," + + string sLua = "EgtCurveBezierFromArc(" + IdToString( nParentId) + "," + ToString( nArcId) + "," + ( bErase ? "true" : "false") + ")" + " -- Id=" + ToString( nId) ; @@ -1352,6 +1493,7 @@ MyCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // creo la curva composita PtrOwner pCrvCompo( CreateCurveComposite()) ; if ( IsNull( pCrvCompo)) @@ -1419,7 +1561,7 @@ ExeCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase) int nId = MyCreateCurveCompo( nParentId, vIds, bErase) ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtCurveCompo(" + ToString( nParentId) + ",{" + + string sLua = "EgtCurveCompo(" + IdToString( nParentId) + ",{" + IdListToString( vIds) + "}," + ( bErase ? "true" : "false") + ")" + " -- Id=" + ToString( nId) ; @@ -1436,6 +1578,7 @@ 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)) @@ -1522,6 +1665,15 @@ MyCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, // se non sono state inserite curve, vado oltre if ( pCrvCompo->GetCurveNumber() == 0) continue ; + // se curva chiusa entro la tolleranza di concatenamento ma considerata aperta, la chiudo bene + Point3d ptStart, ptEnd ; + if ( pCrvCompo->GetStartPoint( ptStart) && + pCrvCompo->GetEndPoint( ptEnd) && + AreSamePointEpsilon( ptStart, ptEnd, dToler) && + ! AreSamePointApprox( ptStart, ptEnd)) { + // porto il punto finale a coincidere esattamente con l'inizio + pCrvCompo->ModifyEnd( ptStart) ; + } // imposto estrusione e spessore pCrvCompo->SetExtrusion( vtExtr) ; pCrvCompo->SetThickness( dThick) ; @@ -1565,7 +1717,7 @@ ExeCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtCurveCompoByChain(" + ToString( nParentId) + ",{" + + string sLua = "EgtCurveCompoByChain(" + IdToString( nParentId) + ",{" + IdListToString( vIds) + "},{" + ToString( ptNear) + "}," + ( bErase ? "true" : "false") + "," + @@ -1577,12 +1729,75 @@ ExeCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, return nFirstId ; } +//------------------------------------------------------------------------------- +int +ExeCreateCurveCompoByInterpolation( int nParentId, const PolyLine& PL, int nType, int nRefType) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; + bool bOk = true ; + // recupero il riferimento del gruppo destinazione + Frame3d frDest ; + bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frDest) ; + // assegno metodo di interpolazione e tipo del risultato + int nMethod = CurveByInterp::AKIMA_CORNER ; + int nCrvType = CurveByInterp::BIARCS ; + if ( nType == ITT_AKIMA) { + nMethod = CurveByInterp::AKIMA ; + nCrvType = CurveByInterp::BIARCS ; + } + else if ( nType == ITT_BESSEL) { + nMethod = CurveByInterp::BESSEL ; + nCrvType = CurveByInterp::CUBIC_BEZIERS ; + } + // oggetto interpolatore + CurveByInterp crvByInterp ; + crvByInterp.Start() ; + Point3d ptP ; + for ( bool bFound = PL.GetFirstPoint( ptP) ; + bFound ; + bFound = PL.GetNextPoint( ptP)) + crvByInterp.AddPoint( ptP) ; + crvByInterp.End() ; + PtrOwner pCrvCompo( crvByInterp.GetCurve( nMethod, nType)) ; + bOk = bOk && ! IsNull( pCrvCompo) ; + // assegno il versore estrusione + bOk = bOk && pCrvCompo->SetExtrusion( Z_AX) ; + // eventuale trasformazione per riferimento di espressione dei punti + if ( bOk && nRefType == RTY_GLOB) + pCrvCompo->ToLoc( frDest) ; + else if ( bOk && nRefType == RTY_GRID) + pCrvCompo->LocToLoc( pGeomDB->GetGridFrame(), frDest) ; + // inserisco la curva composita nel DB + int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) : GDB_ID_NULL) ; + ExeSetModified() ; + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sPnt ; + Point3d ptP ; + if ( PL.GetFirstPoint( ptP)) + sPnt += "{" + ToString( ptP) + "}" ; + while ( PL.GetNextPoint( ptP)) + sPnt += ",{" + ToString( ptP) + "}" ; + string sLua = "EgtCurveCompoByInterpolation(" + IdToString( nParentId) + ",{" + + sPnt + "}," + + InterpTypeToString( nType) +"," + + RefTypeToString( nRefType) + ")" + + " -- Id=" + ToString( nId) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco l'identificativo della nuova entità + return nId ; +} + //------------------------------------------------------------------------------- int ExeCreateCurveCompoFromPoints( int nParentId, const PolyLine& PL, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento del gruppo destinazione Frame3d frDest ; @@ -1610,7 +1825,7 @@ ExeCreateCurveCompoFromPoints( int nParentId, const PolyLine& PL, int nRefType) sPnt += "{" + ToString( ptP) + "}" ; while ( PL.GetNextPoint( ptP)) sPnt += ",{" + ToString( ptP) + "}" ; - string sLua = "EgtCurveCompoFromPoints(" + ToString( nParentId) + ",{" + + string sLua = "EgtCurveCompoFromPoints(" + IdToString( nParentId) + ",{" + sPnt + "}," + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; @@ -1626,6 +1841,7 @@ ExeCreateCurveCompoFromPointBulges( int nParentId, const PolyArc& PA, int nRefTy { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento del gruppo destinazione Frame3d frDest ; @@ -1654,7 +1870,7 @@ ExeCreateCurveCompoFromPointBulges( int nParentId, const PolyArc& PA, int nRefTy sPnt += "{" + ToString( ptP) + "," + ToString( dB) + "}" ; while ( PA.GetNextPoint( ptP, dB)) sPnt += ",{" + ToString( ptP) + "," + ToString( dB) + "}" ; - string sLua = "EgtCurveCompoFromPointBulges(" + ToString( nParentId) + ",{" + + string sLua = "EgtCurveCompoFromPointBulges(" + IdToString( nParentId) + ",{" + sPnt + "}," + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; @@ -1664,6 +1880,60 @@ ExeCreateCurveCompoFromPointBulges( int nParentId, const PolyArc& PA, int nRefTy return nId ; } +//------------------------------------------------------------------------------- +int +ExeCreateRectangle2P( int nParentId, const Point3d& ptIni, + const Point3d& ptCross, int nRefType) +{ + IGeomDB* pGeomDB = GetCurrGeomDB() ; + VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; + bool bOk = true ; + // recupero il riferimento locale + Frame3d frLoc ; + if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc)) + return GDB_ID_NULL ; + // porto in locale i punti e il versore estrusione + Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ; + Point3d ptCrossL = GetPointLocal( pGeomDB, ptCross, nRefType, frLoc) ; + Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; + // calcolo il lato X + Vector3d vtDirX = X_AX ; + bOk = bOk && vtDirX.Normalize() ; + Vector3d vtLatoX = bOk ? (( ptCrossL - ptIniL) * vtDirX) * vtDirX : V_NULL ; + // creo la polilinea con i punti + int nId = GDB_ID_NULL ; + if ( bOk) { + PolyLine PL ; + PL.AddUPoint( 0, ptIniL) ; + PL.AddUPoint( 1, Point3d( ptIniL) + vtLatoX) ; + PL.AddUPoint( 2, ptCrossL) ; + PL.AddUPoint( 3, Point3d( ptCrossL) - vtLatoX) ; + PL.AddUPoint( 4, ptIniL) ; + // disabilito log dei comandi e salvo stato precedente + bool bPrevCmdLog = SetCmdLog( false) ; + // creo la curva e la inserisco nel GDB + nId = ExeCreateCurveCompoFromPoints( nParentId, PL, RTY_LOC) ; + // ripristino precedente stato dei comandi + SetCmdLog( bPrevCmdLog) ; + // ne sistemo il vettore estrusione + ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ; + if ( pCurve != nullptr) + pCurve->SetExtrusion( vtExtrL) ; + } + // se richiesto, salvo il comando Lua equivalente + if ( IsCmdLog()) { + string sLua = "EgtRectangle2P(" + IdToString( nParentId) + ",{" + + ToString( ptIni) + "},{" + + ToString( ptCross) + "}," + + RefTypeToString( nRefType) + ")" + + " -- Id=" + ToString( nId) ; + LOG_INFO( GetCmdLogger(), sLua.c_str()) ; + } + // restituisco l'identificativo della nuova entità + return nId ; +} + //------------------------------------------------------------------------------- int ExeCreateRectangle3P( int nParentId, const Point3d& ptIni, @@ -1671,6 +1941,7 @@ ExeCreateRectangle3P( int nParentId, const Point3d& ptIni, { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -1707,7 +1978,7 @@ ExeCreateRectangle3P( int nParentId, const Point3d& ptIni, } // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtRectangle3P(" + ToString( nParentId) + ",{" + + string sLua = "EgtRectangle3P(" + IdToString( nParentId) + ",{" + ToString( ptIni) + "},{" + ToString( ptCross) + "},{" + ToString( ptDir) + "}," + @@ -1722,10 +1993,11 @@ ExeCreateRectangle3P( int nParentId, const Point3d& ptIni, //------------------------------------------------------------------------------- int ExeCreatePolygonFromRadius( int nParentId, int nNumSides, const Point3d& ptCen, - const Point3d& ptCorn, const Vector3d& vtN, int nRefType) + const Point3d& ptCorn, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -1734,7 +2006,7 @@ ExeCreatePolygonFromRadius( int nParentId, int nNumSides, const Point3d& ptCen, // porto in locale i punti, la normale e il versore estrusione Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ; Point3d ptCornL = GetPointLocal( pGeomDB, ptCorn, nRefType, frLoc) ; - Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; + Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // creo la curva composita PtrOwner pCrvCompo( CreateCurveComposite()) ; @@ -1748,11 +2020,10 @@ ExeCreatePolygonFromRadius( int nParentId, int nNumSides, const Point3d& ptCen, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtPolygonFromRadius(" + ToString( nParentId) + "," + + string sLua = "EgtPolygonFromRadius(" + IdToString( nParentId) + "," + ToString( nNumSides) + ",{" + ToString( ptCen) + "},{" + - ToString( ptCorn) + "},{" + - ToString( vtN) + "}," + + ToString( ptCorn) + "}," + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; @@ -1764,10 +2035,11 @@ ExeCreatePolygonFromRadius( int nParentId, int nNumSides, const Point3d& ptCen, //------------------------------------------------------------------------------- int ExeCreatePolygonFromApothem( int nParentId, int nNumSides, const Point3d& ptCen, - const Point3d& ptMid, const Vector3d& vtN, int nRefType) + const Point3d& ptMid, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -1776,7 +2048,7 @@ ExeCreatePolygonFromApothem( int nParentId, int nNumSides, const Point3d& ptCen, // porto in locale i punti, la normale e il versore estrusione Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ; Point3d ptMidL = GetPointLocal( pGeomDB, ptMid, nRefType, frLoc) ; - Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; + Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // creo la curva composita PtrOwner pCrvCompo( CreateCurveComposite()) ; @@ -1790,11 +2062,10 @@ ExeCreatePolygonFromApothem( int nParentId, int nNumSides, const Point3d& ptCen, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtPolygonFromApothem(" + ToString( nParentId) + "," + + string sLua = "EgtPolygonFromApothem(" + IdToString( nParentId) + "," + ToString( nNumSides) + ",{" + ToString( ptCen) + "},{" + - ToString( ptMid) + "},{" + - ToString( vtN) + "}," + + ToString( ptMid) + "}," + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; @@ -1806,10 +2077,11 @@ ExeCreatePolygonFromApothem( int nParentId, int nNumSides, const Point3d& ptCen, //------------------------------------------------------------------------------- int ExeCreatePolygonFromSide( int nParentId, int nNumSides, const Point3d& ptIni, - const Point3d& ptFin, const Vector3d& vtN, int nRefType) + const Point3d& ptFin, int nRefType) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -1818,7 +2090,7 @@ ExeCreatePolygonFromSide( int nParentId, int nNumSides, const Point3d& ptIni, // porto in locale i punti, la normale e il versore estrusione Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ; Point3d ptFinL = GetPointLocal( pGeomDB, ptFin, nRefType, frLoc) ; - Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ; + Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ; // creo la curva composita PtrOwner pCrvCompo( CreateCurveComposite()) ; @@ -1832,11 +2104,10 @@ ExeCreatePolygonFromSide( int nParentId, int nNumSides, const Point3d& ptIni, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtPolygonFromSide(" + ToString( nParentId) + "," + + string sLua = "EgtPolygonFromSide(" + IdToString( nParentId) + "," + ToString( nNumSides) + ",{" + ToString( ptIni) + "},{" + - ToString( ptFin) + "},{" + - ToString( vtN) + "}," + + ToString( ptFin) + "}," + RefTypeToString( nRefType) + ")" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; diff --git a/EXE_GdbCreateSurf.cpp b/EXE_GdbCreateSurf.cpp index addffb5..e29c1cf 100644 --- a/EXE_GdbCreateSurf.cpp +++ b/EXE_GdbCreateSurf.cpp @@ -36,6 +36,7 @@ ExeCreateSurfTmBBox( int nParentId, const BBox3d& b3Box, int nRefType) // bounding box orientato come gli assi del riferimento IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // recupero il riferimento locale Frame3d frLoc ; bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; @@ -65,7 +66,7 @@ ExeCreateSurfTmBBox( int nParentId, const BBox3d& b3Box, int nRefType) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmBBox(" + ToString( nParentId) + ",{{" + + string sLua = "EgtSurfTmBBox(" + IdToString( nParentId) + ",{{" + ToString( b3Box.GetMin()) + "},{" + ToString( b3Box.GetMax()) + "}}," + RefTypeToString( nRefType) + ")" + @@ -83,6 +84,7 @@ ExeCreateSurfTmBox( int nParentId, const Point3d& ptIni, const Point3d& ptCross, { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // recupero il riferimento locale Frame3d frLoc ; bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ; @@ -111,7 +113,7 @@ ExeCreateSurfTmBox( int nParentId, const Point3d& ptIni, const Point3d& ptCross, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmBox(" + ToString( nParentId) + ",{" + + string sLua = "EgtSurfTmBox(" + IdToString( nParentId) + ",{" + ToString( ptIni) + "},{" + ToString( ptCross) + "},{" + ToString( ptDir) + "}," + @@ -131,6 +133,7 @@ ExeCreateSurfTmPyramid( int nParentId, const Point3d& ptIni, const Point3d& ptCr { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -161,7 +164,7 @@ ExeCreateSurfTmPyramid( int nParentId, const Point3d& ptIni, const Point3d& ptCr ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmPyramid(" + ToString( nParentId) + ",{" + + string sLua = "EgtSurfTmPyramid(" + IdToString( nParentId) + ",{" + ToString( ptIni) + "},{" + ToString( ptCross) + "},{" + ToString( ptDir) + "}," + @@ -181,6 +184,7 @@ ExeCreateSurfTmCylinder( int nParentId, const Point3d& ptOrig, const Vector3d& v { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -201,7 +205,7 @@ ExeCreateSurfTmCylinder( int nParentId, const Point3d& ptOrig, const Vector3d& v ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmCylinder(" + ToString( nParentId) + ",{" + + string sLua = "EgtSurfTmCylinder(" + IdToString( nParentId) + ",{" + ToString( ptOrig) + "},{" + ToString( vtN) + "}," + ToString( dRad) + "," + @@ -222,6 +226,7 @@ ExeCreateSurfTmCone( int nParentId, const Point3d& ptOrig, const Vector3d& vtN, { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -242,7 +247,7 @@ ExeCreateSurfTmCone( int nParentId, const Point3d& ptOrig, const Vector3d& vtN, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmCone(" + ToString( nParentId) + ",{" + + string sLua = "EgtSurfTmCone(" + IdToString( nParentId) + ",{" + ToString( ptOrig) + "},{" + ToString( vtN) + "}," + ToString( dRad) + "," + @@ -263,6 +268,7 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig, { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -279,7 +285,7 @@ ExeCreateSurfTmSphere( int nParentId, const Point3d& ptOrig, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmSphere(" + ToString( nParentId) + ",{" + + string sLua = "EgtSurfTmSphere(" + IdToString( nParentId) + ",{" + ToString( ptOrig) + "}," + ToString( dRad) + "," + ToString( dLinTol) + "," + @@ -297,6 +303,7 @@ ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -311,7 +318,7 @@ ExeCreateSurfTmByFlatContour( int nParentId, int nCrvId, double dLinTol) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmByFlatContour(" + ToString( nParentId) + "," + + string sLua = "EgtSurfTmByFlatContour(" + IdToString( nParentId) + "," + ToString( nCrvId) + "," + ToString( dLinTol) + ")" + " -- Id=" + ToString( nNewId) ; @@ -327,6 +334,7 @@ ExeCreateSurfTmByRegion( int nParentId, INTVECTOR& vCrvIds, double dLinTol) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -355,7 +363,7 @@ ExeCreateSurfTmByRegion( int nParentId, INTVECTOR& vCrvIds, double dLinTol) for ( size_t i = 0 ; i < vCrvIds.size() ; ++ i) sIds += ToString( vCrvIds[i]) + "," ; sIds.pop_back() ; - string sLua = "EgtSurfTmByRegion(" + ToString( nParentId) + ",{" + + string sLua = "EgtSurfTmByRegion(" + IdToString( nParentId) + ",{" + sIds + "}," + ToString( dLinTol) + ")" + " -- Id=" + ToString( nNewId) ; @@ -372,6 +380,7 @@ ExeCreateSurfTmByExtrusion( int nParentId, INTVECTOR& vCrvIds, const Vector3d& v { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -406,7 +415,7 @@ ExeCreateSurfTmByExtrusion( int nParentId, INTVECTOR& vCrvIds, const Vector3d& v for ( size_t i = 0 ; i < vCrvIds.size() ; ++ i) sIds += ToString( vCrvIds[i]) + "," ; sIds.pop_back() ; - string sLua = "EgtSurfTmByExtrusion(" + ToString( nParentId) + ",{" + + string sLua = "EgtSurfTmByExtrusion(" + IdToString( nParentId) + ",{" + sIds + "},{" + ToString( vtExtr) + "}," + ToString( dLinTol) + "," + @@ -425,6 +434,7 @@ ExeCreateSurfTmByRegionExtrusion( int nParentId, INTVECTOR& vCrvIds, const Vecto { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -453,7 +463,7 @@ ExeCreateSurfTmByRegionExtrusion( int nParentId, INTVECTOR& vCrvIds, const Vecto for ( size_t i = 0 ; i < vCrvIds.size() ; ++ i) sIds += ToString( vCrvIds[i]) + "," ; sIds.pop_back() ; - string sLua = "EgtSurfTmByRegionExtrusion(" + ToString( nParentId) + ",{" + + string sLua = "EgtSurfTmByRegionExtrusion(" + IdToString( nParentId) + ",{" + sIds + "},{" + ToString( vtExtr) + "}," + ToString( dLinTol) + "," + @@ -473,6 +483,7 @@ ExeCreateSurfTmByRevolve( int nParentId, int nCrvId, { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -490,7 +501,7 @@ ExeCreateSurfTmByRevolve( int nParentId, int nCrvId, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmByRevolve(" + ToString( nParentId) + "," + + string sLua = "EgtSurfTmByRevolve(" + IdToString( nParentId) + "," + ToString( nCrvId) + ",{" + ToString( ptAx) + "},{" + ToString( vtAx) + "}," + @@ -512,6 +523,7 @@ ExeCreateSurfTmByScrewing( int nParentId, int nCrvId, { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -529,7 +541,7 @@ ExeCreateSurfTmByScrewing( int nParentId, int nCrvId, ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmByScrewing(" + ToString( nParentId) + "," + + string sLua = "EgtSurfTmByScrewing(" + IdToString( nParentId) + "," + ToString( nCrvId) + ",{" + ToString( ptAx) + "},{" + ToString( vtAx) + "}," + @@ -550,6 +562,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, double dL { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; bool bOk = true ; // recupero il riferimento locale Frame3d frLoc ; @@ -608,7 +621,7 @@ ExeCreateSurfTmRuled( int nParentId, int nPtOrCrvId1, int nPtOrCrvId2, double dL ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmRuled(" + ToString( nParentId) + "," + + string sLua = "EgtSurfTmRuled(" + IdToString( nParentId) + "," + ToString( nPtOrCrvId1) + "," + ToString( nPtOrCrvId2) + "," + ToString( dLinTol) + ")" + @@ -625,6 +638,7 @@ ExeCreateSurfTmByTriangles( int nParentId, const INTVECTOR& vIds, bool bErase) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // almeno un oggetto nell'elenco bool bOk = ( vIds.size() > 0) ; // recupero il riferimento locale @@ -678,7 +692,7 @@ ExeCreateSurfTmByTriangles( int nParentId, const INTVECTOR& vIds, bool bErase) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmByTriangles(" + ToString( nParentId) + ",{" + + string sLua = "EgtSurfTmByTriangles(" + IdToString( nParentId) + ",{" + IdListToString( vIds) + "}," + ( bErase ? "true" : "false") + ")" + " -- Id=" + ToString( nNewId) ; @@ -694,6 +708,7 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase) { IGeomDB* pGeomDB = GetCurrGeomDB() ; VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL) + nParentId = AdjustId( nParentId) ; // almeno un oggetto nell'elenco bool bOk = ( vIds.size() > 0) ; // recupero il riferimento locale @@ -746,7 +761,7 @@ ExeCreateSurfTmBySewing( int nParentId, const INTVECTOR& vIds, bool bErase) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { - string sLua = "EgtSurfTmBySewing(" + ToString( nParentId) + ",{" + + string sLua = "EgtSurfTmBySewing(" + IdToString( nParentId) + ",{" + IdListToString( vIds) + "}," + ( bErase ? "true" : "false") + ")" + " -- Id=" + ToString( nNewId) ; diff --git a/EXE_GdbObjAttribs.cpp b/EXE_GdbObjAttribs.cpp index 71ad664..fb22e50 100644 --- a/EXE_GdbObjAttribs.cpp +++ b/EXE_GdbObjAttribs.cpp @@ -406,8 +406,10 @@ ExeSetName( int nId, const string& sName) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { + string sLuaName = sName ; + ReplaceString( sLuaName, "'", "\\'") ; string sLua = "EgtSetName(" + ToString( nId) + ",'" + - sName + "')" + + sLuaName + "')" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } @@ -465,9 +467,13 @@ ExeSetInfo( int nId, const string& sKey, const string& sInfo) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { + string sLuaKey = sKey ; + ReplaceString( sLuaKey, "'", "\\'") ; + string sLuaInfo = sInfo ; + ReplaceString( sLuaInfo, "'", "\\'") ; string sLua = "EgtSetInfo(" + ToString( nId) + ",'" + - sKey + "','" + - sInfo + "')" + + sLuaKey + "','" + + sLuaInfo + "')" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } @@ -528,8 +534,10 @@ ExeRemoveInfo( int nId, const string& sKey) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { + string sLuaKey = sKey ; + ReplaceString( sLuaKey, "'", "\\'") ; string sLua = "EgtRemoveInfo(" + ToString( nId) + ",'" + - sKey + "')" + + sLuaKey + "')" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } diff --git a/EXE_Lua.cpp b/EXE_Lua.cpp index da0aeaf..5a08ffb 100644 --- a/EXE_Lua.cpp +++ b/EXE_Lua.cpp @@ -206,6 +206,7 @@ ExeLuaExecFile( const string& sFilePath) if ( IsCmdLog()) { string sLuaPath = sFilePath ; ReplaceString( sLuaPath, "\\", "\\\\") ; + ReplaceString( sLuaPath, "'", "\\'") ; string sLua = "dofile('" + sLuaPath + "')" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; diff --git a/EgtExecutor.rc b/EgtExecutor.rc index c91b0e5..9939d41 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ diff --git a/GeoTools.cpp b/GeoTools.cpp index ebfa276..d6e9391 100644 --- a/GeoTools.cpp +++ b/GeoTools.cpp @@ -12,10 +12,28 @@ //---------------------------------------------------------------------------- #include "stdafx.h" +#include "EXE.h" +#include "EXE_Macro.h" #include "GeoTools.h" #include "/EgtDev/Include/EGkGeomDB.h" #include "/EgtDev/Include/EXeConst.h" +//---------------------------------------------------------------------------- +int +AdjustId( int nId) +{ + GseContext* pCtx = GetCurrGseContext() ; + VERIFY_CTX( pCtx, GDB_ID_NULL) + if ( nId == GDB_ID_CURRPART) + return pCtx->m_nCurrPart ; + else if ( nId == GDB_ID_CURRLAYER) + return pCtx->m_nCurrLayer ; + else if ( nId <= GDB_ID_NULL) + return GDB_ID_NULL ; + else + return nId ; +} + //---------------------------------------------------------------------------- Vector3d GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc) diff --git a/GeoTools.h b/GeoTools.h index 6e20640..2913447 100644 --- a/GeoTools.h +++ b/GeoTools.h @@ -17,6 +17,8 @@ class IGeomDB ; //---------------------------------------------------------------------------- +// Sistemo Id per pezzo o layer correnti +int AdjustId( int nId) ; // Vettore espresso nel riferimento desiderato partendo da vettore nel riferimento RefType Vector3d GetVectorLocal( IGeomDB* pGeomDB, const Vector3d& vtV, int nRefType, const Frame3d& frLoc) ; // Punto espresso nel riferimento desiderato partendo da punto nel riferimento RefType diff --git a/LUA_GdbCreate.cpp b/LUA_GdbCreate.cpp index fc13a0f..3ed9f06 100644 --- a/LUA_GdbCreate.cpp +++ b/LUA_GdbCreate.cpp @@ -121,22 +121,20 @@ LuaCreateGeoFrame( lua_State* L) static int LuaCreateText( lua_State* L) { - // 5 o 6 parametri : ParentId, ptP, AngRotDeg, Text, H [, nRefType] + // 4 o 5 parametri : ParentId, ptP, Text, H [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) Point3d ptP ; LuaCheckParam( L, 2, ptP) ; - double dAngRotDeg ; - LuaCheckParam( L, 3, dAngRotDeg) ; string sText ; - LuaCheckParam( L, 4, sText) + LuaCheckParam( L, 3, sText) double dH ; - LuaCheckParam( L, 5, dH) ; + LuaCheckParam( L, 4, dH) ; int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 6, nRefType) ; + LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo il testo - int nId = ExeCreateText( nParentId, ptP, dAngRotDeg, sText, dH, nRefType) ; + int nId = ExeCreateText( nParentId, ptP, sText, dH, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -149,30 +147,28 @@ LuaCreateText( lua_State* L) static int LuaCreateTextEx( lua_State* L) { - // 8 o 9 parametri : ParentId, ptP, vtN, vtD, Text, Font, bItalic, H [, nRefType] + // 7 o 8 parametri : ParentId, ptP, dAngRotDeg, Text, Font, bItalic, H [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) Point3d ptP ; LuaCheckParam( L, 2, ptP) ; - Vector3d vtN ; - LuaCheckParam( L, 3, vtN) ; - Vector3d vtD ; - LuaCheckParam( L, 4, vtD) ; + double dAngRotDeg ; + LuaCheckParam( L, 3, dAngRotDeg) ; string sText ; - LuaCheckParam( L, 5, sText) + LuaCheckParam( L, 4, sText) string sFont ; - LuaCheckParam( L, 6, sFont) ; + LuaCheckParam( L, 5, sFont) ; string sItalic ; - LuaCheckParam( L, 7, sItalic) + LuaCheckParam( L, 6, sItalic) ToUpper( sItalic) ; bool bItalic = ( sItalic == "I") ; double dH ; - LuaCheckParam( L, 8, dH) ; + LuaCheckParam( L, 7, dH) ; int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 9, nRefType) ; + LuaGetParam( L, 8, nRefType) ; LuaClearStack( L) ; // creo il testo in modo esteso - int nId = ExeCreateTextEx( nParentId, ptP, vtN, vtD, sText, sFont, bItalic, dH, nRefType) ; + int nId = ExeCreateTextEx( nParentId, ptP, dAngRotDeg, sText, sFont, bItalic, dH, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -185,38 +181,36 @@ LuaCreateTextEx( lua_State* L) static int LuaCreateTextAdv( lua_State* L) { - // 12 o 13 parametri : ParentId, ptP, vtN, vtD, Text, Font, W, sItalic, H, Rat, AddAdv, InsPos [, nRefType] + // 11 o 12 parametri : ParentId, ptP, dAngRotDeg, Text, Font, W, sItalic, H, Rat, AddAdv, InsPos [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) Point3d ptP ; LuaCheckParam( L, 2, ptP) ; - Vector3d vtN ; - LuaCheckParam( L, 3, vtN) ; - Vector3d vtD ; - LuaCheckParam( L, 4, vtD) ; + double dAngRotDeg ; + LuaCheckParam( L, 3, dAngRotDeg) ; string sText ; - LuaCheckParam( L, 5, sText) + LuaCheckParam( L, 4, sText) string sFont ; - LuaCheckParam( L, 6, sFont) + LuaCheckParam( L, 5, sFont) int nW ; - LuaCheckParam( L, 7, nW) + LuaCheckParam( L, 6, nW) string sItalic ; - LuaCheckParam( L, 8, sItalic) + LuaCheckParam( L, 7, sItalic) ToUpper( sItalic) ; bool bItalic = ( sItalic == "I") ; double dH ; - LuaCheckParam( L, 9, dH) + LuaCheckParam( L, 8, dH) double dRat ; - LuaCheckParam( L, 10, dRat) + LuaCheckParam( L, 9, dRat) double dAddAdv ; - LuaCheckParam( L, 11, dAddAdv) + LuaCheckParam( L, 10, dAddAdv) int nInsPos ; - LuaCheckParam( L, 12, nInsPos) + LuaCheckParam( L, 11, nInsPos) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 13, nRefType) ; + LuaGetParam( L, 12, nRefType) ; LuaClearStack( L) ; // creo il testo in modo avanzato - int nId = ExeCreateTextAdv( nParentId, ptP, vtN, vtD, + int nId = ExeCreateTextAdv( nParentId, ptP, dAngRotDeg, sText, sFont, nW, bItalic, dH, dRat, dAddAdv, nInsPos, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) diff --git a/LUA_GdbCreateCurve.cpp b/LUA_GdbCreateCurve.cpp index 04e1f3a..7cd248e 100644 --- a/LUA_GdbCreateCurve.cpp +++ b/LUA_GdbCreateCurve.cpp @@ -79,6 +79,32 @@ LuaCreateCurveLineEx( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaCreateCurveLinePDL( lua_State* L) +{ + // 4 o 5 parametri : ParentId, PtIni, dDirDeg, dLen [, nRefType] + int nParentId ; + LuaCheckParam( L, 1, nParentId) + Point3d ptIni ; + LuaCheckParam( L, 2, ptIni) + double dDirDeg ; + LuaCheckParam( L, 3, dDirDeg) + double dLen ; + LuaCheckParam( L, 4, dLen) + int nRefType = RTY_DEFAULT ; + LuaGetParam( L, 5, nRefType) ; + LuaClearStack( L) ; + // creo il segmento di retta + int nId = ExeCreateCurveLinePDL( nParentId, ptIni, dDirDeg, dLen, nRefType) ; + // restituisco il risultato + if ( nId != GDB_ID_NULL) + LuaSetParam( L, nId) ; + else + LuaSetParam( L) ; + return 1 ; +} + //------------------------------------------------------------------------------- static int LuaCreateCurveLinePVL( lua_State* L) @@ -137,20 +163,18 @@ LuaCreateCurveLineMinPointCurve( lua_State* L) static int LuaCreateCurveCircle( lua_State* L) { - // 4 o 5 parametri : ParentId, PtCen, VtN, Rad [, nRefType] + // 3 o 4 parametri : ParentId, PtCen, Rad [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) Point3d ptCen ; LuaCheckParam( L, 2, ptCen) - Vector3d vtN ; - LuaCheckParam( L, 3, vtN) double dRad ; - LuaCheckParam( L, 4, dRad) + LuaCheckParam( L, 3, dRad) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 5, nRefType) ; + LuaGetParam( L, 4, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveCircle( nParentId, ptCen, vtN, dRad, nRefType) ; + int nId = ExeCreateCurveCircle( nParentId, ptCen, dRad, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -161,22 +185,20 @@ LuaCreateCurveCircle( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveCircleCPN( lua_State* L) +LuaCreateCurveCircleCP( lua_State* L) { - // 4 o 5 parametri : ParentId, PtCen, PtOn, VtN [, nRefType] + // 3 o 4 parametri : ParentId, PtCen, PtOn [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) Point3d ptCen ; LuaCheckParam( L, 2, ptCen) Point3d ptOn ; LuaCheckParam( L, 3, ptOn) - Vector3d vtN ; - LuaCheckParam( L, 4, vtN) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 5, nRefType) ; + LuaGetParam( L, 4, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveCircleCPN( nParentId, ptCen, ptOn, vtN, nRefType) ; + int nId = ExeCreateCurveCircleCP( nParentId, ptCen, ptOn, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -187,9 +209,9 @@ LuaCreateCurveCircleCPN( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveCircleCPNEx( lua_State* L) +LuaCreateCurveCircleCPEx( lua_State* L) { - // 6 o 7 parametri : ParentId, PtCen, PtOn, nSepO, nIdO, VtN [, nRefType] + // 5 o 6 parametri : ParentId, PtCen, PtOn, nSepO, nIdO [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) Point3d ptCen ; @@ -200,13 +222,11 @@ LuaCreateCurveCircleCPNEx( lua_State* L) LuaCheckParam( L, 4, nSepO) int nIdO ; LuaCheckParam( L, 5, nIdO) - Vector3d vtN ; - LuaCheckParam( L, 6, vtN) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 7, nRefType) ; + LuaGetParam( L, 6, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveCircleCPNEx( nParentId, ptCen, ptOn, nSepO, nIdO, vtN, nRefType) ; + int nId = ExeCreateCurveCircleCPEx( nParentId, ptCen, ptOn, nSepO, nIdO, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -245,26 +265,24 @@ LuaCreateCurveCircle3P( lua_State* L) static int LuaCreateCurveArc( lua_State* L) { - // 7 o 8 parametri : ParentId, PtCen, VtN, Rad, VtS, AngCenDeg, DeltaN [, nRefType] + // 6 o 7 parametri : ParentId, PtCen, Rad, AngIniDeg, AngCenDeg, DeltaN [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) Point3d ptCen ; LuaCheckParam( L, 2, ptCen) - Vector3d vtN ; - LuaCheckParam( L, 3, vtN) double dRad ; - LuaCheckParam( L, 4, dRad) - Vector3d vtS ; - LuaCheckParam( L, 5, vtS) + LuaCheckParam( L, 3, dRad) + double dAngIniDeg ; + LuaCheckParam( L, 4, dAngIniDeg) double dAngCenDeg ; - LuaCheckParam( L, 6, dAngCenDeg) + LuaCheckParam( L, 5, dAngCenDeg) double dDeltaN ; - LuaCheckParam( L, 7, dDeltaN) + LuaCheckParam( L, 6, dDeltaN) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 8, nRefType) ; + LuaGetParam( L, 7, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArc( nParentId, ptCen, vtN, dRad, vtS, dAngCenDeg, dDeltaN, nRefType) ; + int nId = ExeCreateCurveArc( nParentId, ptCen, dRad, dAngIniDeg, dAngCenDeg, dDeltaN, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -275,9 +293,9 @@ LuaCreateCurveArc( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveArcC2PN( lua_State* L) +LuaCreateCurveArcC2P( lua_State* L) { - // 5 o 6 parametri : ParentId, PtCen, PtStart, PtNearEnd, VtNorm [, nRefType] + // 4 o 5 parametri : ParentId, PtCen, PtStart, PtNearEnd [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) Point3d ptCen ; @@ -286,13 +304,11 @@ LuaCreateCurveArcC2PN( lua_State* L) LuaCheckParam( L, 3, ptStart) Point3d ptNearEnd ; LuaCheckParam( L, 4, ptNearEnd) - Vector3d vtNorm ; - LuaCheckParam( L, 5, vtNorm) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 6, nRefType) ; + LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArcC2PN( nParentId, ptCen, ptStart, ptNearEnd, vtNorm, nRefType) ; + int nId = ExeCreateCurveArcC2P( nParentId, ptCen, ptStart, ptNearEnd, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -303,9 +319,9 @@ LuaCreateCurveArcC2PN( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveArcC2PNEx( lua_State* L) +LuaCreateCurveArcC2PEx( lua_State* L) { - // 7 o 8 parametri : ParentId, PtCen, PtStart, nSepS, nIdS, PtNearEnd, VtNorm [, nRefType] + // 6 o 7 parametri : ParentId, PtCen, PtStart, nSepS, nIdS, PtNearEnd [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) Point3d ptCen ; @@ -318,13 +334,11 @@ LuaCreateCurveArcC2PNEx( lua_State* L) LuaCheckParam( L, 5, nIdS) Point3d ptNearEnd ; LuaCheckParam( L, 6, ptNearEnd) - Vector3d vtNorm ; - LuaCheckParam( L, 7, vtNorm) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 8, nRefType) ; + LuaGetParam( L, 7, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArcC2PNEx( nParentId, ptCen, ptStart, nSepS, nIdS, ptNearEnd, vtNorm, nRefType) ; + int nId = ExeCreateCurveArcC2PEx( nParentId, ptCen, ptStart, nSepS, nIdS, ptNearEnd, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -361,24 +375,22 @@ LuaCreateCurveArc3P( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveArc2PVN( lua_State* L) +LuaCreateCurveArc2PD( lua_State* L) { - // 5 o 6 parametri : ParentId, PtStart, PtEnd, VtDirS, VtNorm [, nRefType] + // 4 o 5 parametri : ParentId, PtStart, PtEnd, dDirSDeg [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) Point3d ptStart ; LuaCheckParam( L, 2, ptStart) Point3d ptEnd ; LuaCheckParam( L, 3, ptEnd) - Vector3d vtDirS ; - LuaCheckParam( L, 4, vtDirS) - Vector3d vtNorm ; - LuaCheckParam( L, 5, vtNorm) + double dDirSDeg ; + LuaCheckParam( L, 4, dDirSDeg) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 6, nRefType) ; + LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArc2PVN( nParentId, ptStart, ptEnd, vtDirS, vtNorm, nRefType) ; + int nId = ExeCreateCurveArc2PD( nParentId, ptStart, ptEnd, dDirSDeg, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -389,9 +401,9 @@ LuaCreateCurveArc2PVN( lua_State* L) //------------------------------------------------------------------------------- static int -LuaCreateCurveArc2PVNEx( lua_State* L) +LuaCreateCurveArc2PDEx( lua_State* L) { - // 7 o 8 parametri : ParentId, PtStart, PtEnd, nSepE, nIdE, VtDirS, VtNorm [, nRefType] + // 6 o 7 parametri : ParentId, PtStart, PtEnd, nSepE, nIdE, dDirSDeg [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) Point3d ptStart ; @@ -402,16 +414,70 @@ LuaCreateCurveArc2PVNEx( lua_State* L) LuaCheckParam( L, 4, nSepE) int nIdE ; LuaCheckParam( L, 5, nIdE) - Vector3d vtDirS ; - LuaCheckParam( L, 6, vtDirS) - Vector3d vtNorm ; - LuaCheckParam( L, 7, vtNorm) + double dDirSDeg ; + LuaCheckParam( L, 6, dDirSDeg) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 8, nRefType) ; + LuaGetParam( L, 7, nRefType) ; LuaClearStack( L) ; // creo l'arco - int nId = ExeCreateCurveArc2PVNEx( nParentId, ptStart, ptEnd, nSepE, nIdE, - vtDirS, vtNorm, nRefType) ; + int nId = ExeCreateCurveArc2PDEx( nParentId, ptStart, ptEnd, nSepE, nIdE, + dDirSDeg, nRefType) ; + // restituisco il risultato + if ( nId != GDB_ID_NULL) + LuaSetParam( L, nId) ; + else + LuaSetParam( L) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaCreateCurveArc2PV( lua_State* L) +{ + // 4 o 5 parametri : ParentId, PtStart, PtEnd, VtDirS [, nRefType] + int nParentId ; + LuaCheckParam( L, 1, nParentId) + Point3d ptStart ; + LuaCheckParam( L, 2, ptStart) + Point3d ptEnd ; + LuaCheckParam( L, 3, ptEnd) + Vector3d vtDirS ; + LuaCheckParam( L, 4, vtDirS) + int nRefType = RTY_DEFAULT ; + LuaGetParam( L, 5, nRefType) ; + LuaClearStack( L) ; + // creo l'arco + int nId = ExeCreateCurveArc2PV( nParentId, ptStart, ptEnd, vtDirS, nRefType) ; + // restituisco il risultato + if ( nId != GDB_ID_NULL) + LuaSetParam( L, nId) ; + else + LuaSetParam( L) ; + return 1 ; +} + +//------------------------------------------------------------------------------- +static int +LuaCreateCurveBiArc( lua_State* L) +{ + // 6 o 7 parametri : ParentId, ptStart, ptEnd, dDirSDeg, dDirEDeg, dPar [, nRefType] + int nParentId ; + LuaCheckParam( L, 1, nParentId) + Point3d ptStart ; + LuaCheckParam( L, 2, ptStart) + Point3d ptEnd ; + LuaCheckParam( L, 3, ptEnd) + double dDirSDeg ; + LuaCheckParam( L, 4, dDirSDeg) + double dDirEDeg ; + LuaCheckParam( L, 5, dDirEDeg) + double dPar ; + LuaCheckParam( L, 6, dPar) + int nRefType = RTY_DEFAULT ; + LuaGetParam( L, 7, nRefType) ; + LuaClearStack( L) ; + // creo l'arco di fillet + int nId = ExeCreateCurveBiArc( nParentId, ptStart, ptEnd, dDirSDeg, dDirEDeg, dPar, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -424,7 +490,7 @@ LuaCreateCurveArc2PVNEx( lua_State* L) static int LuaCreateCurveFillet( lua_State* L) { - // 8 o 9 parametri : ParentId, nCrv1, PtNear1, nCrv2, PtNear2, VtNorm, dRad, bTrim [, nRefType] + // 7 o 8 parametri : ParentId, nCrv1, PtNear1, nCrv2, PtNear2, dRad, bTrim [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) int nCrv1 ; @@ -435,18 +501,16 @@ LuaCreateCurveFillet( lua_State* L) LuaCheckParam( L, 4, nCrv2) Point3d ptNear2 ; LuaCheckParam( L, 5, ptNear2) - Vector3d vtNorm ; - LuaCheckParam( L, 6, vtNorm) double dRad ; - LuaCheckParam( L, 7, dRad) + LuaCheckParam( L, 6, dRad) bool bTrim ; - LuaCheckParam( L, 8, bTrim) + LuaCheckParam( L, 7, bTrim) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 9, nRefType) ; + LuaGetParam( L, 8, nRefType) ; LuaClearStack( L) ; // creo l'arco di fillet int nId = ExeCreateCurveFillet( nParentId, nCrv1, ptNear1, nCrv2, ptNear2, - vtNorm, dRad, bTrim, nRefType) ; + dRad, bTrim, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -459,7 +523,7 @@ LuaCreateCurveFillet( lua_State* L) static int LuaCreateCurveChamfer( lua_State* L) { - // 8 o 9 parametri : ParentId, nCrv1, PtNear1, nCrv2, PtNear2, VtNorm, dDist, bTrim [, nRefType] + // 7 o 8 parametri : ParentId, nCrv1, PtNear1, nCrv2, PtNear2, dDist, bTrim [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) int nCrv1 ; @@ -470,18 +534,16 @@ LuaCreateCurveChamfer( lua_State* L) LuaCheckParam( L, 4, nCrv2) Point3d ptNear2 ; LuaCheckParam( L, 5, ptNear2) - Vector3d vtNorm ; - LuaCheckParam( L, 6, vtNorm) double dDist ; - LuaCheckParam( L, 7, dDist) + LuaCheckParam( L, 6, dDist) bool bTrim ; - LuaCheckParam( L, 8, bTrim) + LuaCheckParam( L, 7, bTrim) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 9, nRefType) ; + LuaGetParam( L, 8, nRefType) ; LuaClearStack( L) ; // creo l'arco di fillet int nId = ExeCreateCurveChamfer( nParentId, nCrv1, ptNear1, nCrv2, ptNear2, - vtNorm, dDist, bTrim, nRefType) ; + dDist, bTrim, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -612,6 +674,34 @@ LuaCreateCurveCompoByChain( lua_State* L) return 2 ; } +//------------------------------------------------------------------------------- +static int +LuaCreateCurveCompoByInterpolation( lua_State* L) +{ + // 3 o 4 parametri : ParentId, ptPs, nType [, nRefType] + int nParentId ; + LuaCheckParam( L, 1, nParentId) + PNTVECTOR vPnt ; + LuaCheckParam( L, 2, vPnt) + int nType ; + LuaGetParam( L, 3, nType) ; + int nRefType = RTY_DEFAULT ; + LuaGetParam( L, 4, nRefType) ; + LuaClearStack( L) ; + PolyLine PL ; + // creo una polilinea a partire dai punti + for ( size_t i = 0 ; i < vPnt.size() ; ++ i) + PL.AddUPoint( 0, vPnt[i]) ; + // creo la curva composita + int nId = ExeCreateCurveCompoByInterpolation( nParentId, PL, nType, nRefType) ; + // restituisco il risultato + if ( nId != GDB_ID_NULL) + LuaSetParam( L, nId) ; + else + LuaSetParam( L) ; + return 1 ; +} + //------------------------------------------------------------------------------- static int LuaCreateCurveCompoFromPoints( lua_State* L) @@ -664,6 +754,30 @@ LuaCreateCurveCompoFromPointBulges( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaCreateRectangle2P( lua_State* L) +{ + // 3 o 4 parametri : ParentId, PtIni, PtCross [, nRefType] + int nParentId ; + LuaCheckParam( L, 1, nParentId) + Point3d ptIni ; + LuaCheckParam( L, 2, ptIni) + Point3d ptCross ; + LuaCheckParam( L, 3, ptCross) + int nRefType = RTY_DEFAULT ; + LuaGetParam( L, 4, nRefType) ; + LuaClearStack( L) ; + // creo il poligono + int nId = ExeCreateRectangle2P( nParentId, ptIni, ptCross, nRefType) ; + // restituisco il risultato + if ( nId != GDB_ID_NULL) + LuaSetParam( L, nId) ; + else + LuaSetParam( L) ; + return 1 ; +} + //------------------------------------------------------------------------------- static int LuaCreateRectangle3P( lua_State* L) @@ -694,7 +808,7 @@ LuaCreateRectangle3P( lua_State* L) static int LuaCreatePolygonFromRadius( lua_State* L) { - // 5 o 6 parametri : ParentId, nNumSides, PtCen, PtCorn, VtN [, nRefType] + // 4 o 5 parametri : ParentId, nNumSides, PtCen, PtCorn [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) int nNumSides ; @@ -703,13 +817,11 @@ LuaCreatePolygonFromRadius( lua_State* L) LuaCheckParam( L, 3, PtCen) Point3d PtCorn ; LuaCheckParam( L, 4, PtCorn) - Vector3d vtN ; - LuaCheckParam( L, 5, vtN) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 6, nRefType) ; + LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo il poligono - int nId = ExeCreatePolygonFromRadius( nParentId, nNumSides, PtCen, PtCorn, vtN, nRefType) ; + int nId = ExeCreatePolygonFromRadius( nParentId, nNumSides, PtCen, PtCorn, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -722,7 +834,7 @@ LuaCreatePolygonFromRadius( lua_State* L) static int LuaCreatePolygonFromApothem( lua_State* L) { - // 5 o 6 parametri : ParentId, nNumSides, PtCen, PtMid, VtN [, nRefType] + // 4 o 5 parametri : ParentId, nNumSides, PtCen, PtMid [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) int nNumSides ; @@ -731,13 +843,11 @@ LuaCreatePolygonFromApothem( lua_State* L) LuaCheckParam( L, 3, PtCen) Point3d PtMid ; LuaCheckParam( L, 4, PtMid) - Vector3d vtN ; - LuaCheckParam( L, 5, vtN) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 6, nRefType) ; + LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo il poligono - int nId = ExeCreatePolygonFromApothem( nParentId, nNumSides, PtCen, PtMid, vtN, nRefType) ; + int nId = ExeCreatePolygonFromApothem( nParentId, nNumSides, PtCen, PtMid, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -750,7 +860,7 @@ LuaCreatePolygonFromApothem( lua_State* L) static int LuaCreatePolygonFromSide( lua_State* L) { - // 5 o 6 parametri : ParentId, nNumSides, PtIni, PtFin, VtN [, nRefType] + // 4 o 5 parametri : ParentId, nNumSides, PtIni, PtFin [, nRefType] int nParentId ; LuaCheckParam( L, 1, nParentId) int nNumSides ; @@ -759,13 +869,11 @@ LuaCreatePolygonFromSide( lua_State* L) LuaCheckParam( L, 3, ptIni) Point3d ptFin ; LuaCheckParam( L, 4, ptFin) - Vector3d vtN ; - LuaCheckParam( L, 5, vtN) int nRefType = RTY_DEFAULT ; - LuaGetParam( L, 6, nRefType) ; + LuaGetParam( L, 5, nRefType) ; LuaClearStack( L) ; // creo il poligono - int nId = ExeCreatePolygonFromSide( nParentId, nNumSides, ptIni, ptFin, vtN, nRefType) ; + int nId = ExeCreatePolygonFromSide( nParentId, nNumSides, ptIni, ptFin, nRefType) ; // restituisco il risultato if ( nId != GDB_ID_NULL) LuaSetParam( L, nId) ; @@ -781,18 +889,21 @@ 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( "EgtCircleCPN", LuaCreateCurveCircleCPN) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtCircleCPNEx", LuaCreateCurveCircleCPNEx) ; + 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( "EgtArcC2PN", LuaCreateCurveArcC2PN) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PNEx", LuaCreateCurveArcC2PNEx) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateCurveArcC2P) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateCurveArcC2PEx) ; bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateCurveArc3P) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PVN", LuaCreateCurveArc2PVN) ; - bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PVNEx", LuaCreateCurveArc2PVNEx) ; + 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( "EgtCurveFillet", LuaCreateCurveFillet) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveChamfer", LuaCreateCurveChamfer) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezier", LuaCreateCurveBezier) ; @@ -800,8 +911,10 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierFromArc", LuaCreateCurveBezierFromArc) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompo", LuaCreateCurveCompo) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByChain", LuaCreateCurveCompoByChain) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoByInterpolation", LuaCreateCurveCompoByInterpolation) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoFromPoints", LuaCreateCurveCompoFromPoints) ; bOk = bOk && luaMgr.RegisterFunction( "EgtCurveCompoFromPointBulges", LuaCreateCurveCompoFromPointBulges) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtRectangle2P", LuaCreateRectangle2P) ; bOk = bOk && luaMgr.RegisterFunction( "EgtRectangle3P", LuaCreateRectangle3P) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromRadius", LuaCreatePolygonFromRadius) ; bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromApothem", LuaCreatePolygonFromApothem) ;