Compare commits

..

2 Commits

Author SHA1 Message Date
Daniele Bariletti e989b88dd4 Merge remote-tracking branch 'origin/HEAD' into Bezier_trim&mesh 2023-06-21 09:36:55 +02:00
Daniele Bariletti 4b58f4f522 EgtExecutor :
- aggiunta funzione per il trim delle superfici di Bezier
- aggiunta funzione per vedere la divione di in celle di una superficie
di Bezier durante la costruzione della trimesh (per debug).
2023-06-21 09:36:41 +02:00
21 changed files with 178 additions and 546 deletions
-34
View File
@@ -10,8 +10,6 @@
// 03.07.18 DS Aggiunto ImportPnt.
// 15.09.19 DS Aggiunto ExportSvg.
// 14.12.20 DS Aggiunto ImportBtlx.
// 23.06.23 DB Aggiunto Import3dm.
// 21.09.23 DB Aggiunto Export3dm.
//
//----------------------------------------------------------------------------
@@ -51,11 +49,9 @@ static const char* EEX_CREATEIMPORTDXF = "CreateImportDxf" ;
static const char* EEX_CREATEIMPORTPNT = "CreateImportPnt" ;
static const char* EEX_CREATEIMPORTSTL = "CreateImportStl" ;
static const char* EEX_CREATEIMPORT3MF = "CreateImport3MF" ;
static const char* EEX_CREATEIMPORT3DM = "CreateImport3dm" ;
static const char* EEX_CREATEEXPORTDXF = "CreateExportDxf" ;
static const char* EEX_CREATEEXPORTSTL = "CreateExportStl" ;
static const char* EEX_CREATEEXPORT3MF = "CreateExport3MF" ;
static const char* EEX_CREATEEXPORT3DM = "CreateExport3dm" ;
static const char* EEX_CREATEEXPORTSVG = "CreateExportSvg" ;
static const char* EEX_SETTHREEJSLIBDIR = "SetThreeJSLibDir" ;
static const char* EEX_CREATEEXPORTTHREEJS = "CreateExportThreeJS" ;
@@ -320,21 +316,6 @@ MyCreateImport3MF( void)
return pFun() ;
}
//-----------------------------------------------------------------------------
IImport3dm*
MyCreateImport3dm( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IImport3dm* (* PF_CreateImport3dm) ( void) ;
PF_CreateImport3dm pFun = (PF_CreateImport3dm)GetProcAddress( s_hEEx, EEX_CREATEIMPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExportDxf*
MyCreateExportDxf( void)
@@ -380,21 +361,6 @@ MyCreateExport3MF( void)
return pFun() ;
}
//-----------------------------------------------------------------------------
IExport3dm*
MyCreateExport3dm( void)
{
// verifico caricamento libreria EgtExchange
if ( s_hEEx == nullptr)
return nullptr ;
// recupero funzione creazione oggetto
typedef IExport3dm* (* PF_CreateExport3dm) ( void) ;
PF_CreateExport3dm pFun = (PF_CreateExport3dm)GetProcAddress( s_hEEx, EEX_CREATEEXPORT3DM) ;
if ( pFun == nullptr)
return nullptr ;
return pFun() ;
}
//-----------------------------------------------------------------------------
IExportSvg*
MyCreateExportSvg( void)
-4
View File
@@ -25,11 +25,9 @@ class IImportDxf ;
class IImportPnt ;
class IImportStl ;
class IImport3MF ;
class IImport3dm ;
class IExportDxf ;
class IExportStl ;
class IExport3MF ;
class IExport3dm ;
class IExportThreeJS ;
class IExportSvg ;
class IExcExecutor ;
@@ -52,11 +50,9 @@ IImportDxf* MyCreateImportDxf( void) ;
IImportPnt* MyCreateImportPnt( void) ;
IImportStl* MyCreateImportStl( void) ;
IImport3MF* MyCreateImport3MF( void) ;
IImport3dm* MyCreateImport3dm( void) ;
IExportDxf* MyCreateExportDxf( void) ;
IExportStl* MyCreateExportStl( void) ;
IExport3MF* MyCreateExport3MF( void) ;
IExport3dm* MyCreateExport3dm( void) ;
bool MySetThreeJSLibDir( const std::string& sThreeJSLibDir) ;
IExportThreeJS* MyCreateExportThreeJS( void) ;
IExportSvg* MyCreateExportSvg( void) ;
+1 -70
View File
@@ -28,11 +28,9 @@
#include "/EgtDev/Include/EExImportPnt.h"
#include "/EgtDev/Include/EExImportBtl.h"
#include "/EgtDev/Include/EExImportBtlx.h"
#include "/EgtDev/Include/EExImport3dm.h"
#include "/EgtDev/Include/EExExportDxf.h"
#include "/EgtDev/Include/EExExportStl.h"
#include "/EgtDev/Include/EExExport3MF.h"
#include "/EgtDev/Include/EExExport3dm.h"
#include "/EgtDev/Include/EExExportSvg.h"
#include "/EgtDev/Include/EExExportThreeJS.h"
#include "/EgtDev/Include/EGnStringUtils.h"
@@ -82,8 +80,6 @@ ExeGetFileType( const string& sFilePath)
return FT_BTL ;
else if ( sFileExt == "BTLX")
return FT_BTLX ;
else if ( sFileExt == "3DM")
return FT_3DM ;
else if ( sFileExt == "PNG" || sFileExt == "JPG" || sFileExt == "JPEG" || sFileExt == "BMP")
return FT_IMG ;
else if ( sFileExt == "PNT" || sFileExt == "XYZ")
@@ -359,46 +355,6 @@ ExeImport3MF( const string& sFilePath)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeImport3dm( const string& sFilePath, double dScaleFactor)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_GEOMDB( pGseCtx, false)
bool bOk = true ;
// importo il file 3dm
// aggiungo un gruppo pezzo e un gruppo layer
int nPartId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
int nLayerId = pGseCtx->m_pGeomDB->AddGroup( GDB_ID_NULL, nPartId, Frame3d()) ;
// preparo l'importatore
PtrOwner<IImport3dm> pImp3dm( MyCreateImport3dm()) ;
bOk = bOk && ! IsNull( pImp3dm) ;
// eseguo l'importazione
const DimensionStyle& DimSt = pGseCtx->m_dsCurr ;
double dExtLine = DimSt.dExtLineLen ;
double dArrLen = DimSt.dArrowLen ;
double dTextDist = DimSt.dTextDist ;
bool bLenIsMM = ( DimSt.nLenIsMM == 2 ? ExeUiUnitsAreMM() : ( DimSt.nLenIsMM != 0 )) ;
int nDecDig = DimSt.nDecDigit ;
string sFont = DimSt.sFont ;
double dTextHeight = DimSt.dTextHeight ;
bOk = bOk && pImp3dm->Import( sFilePath, pGseCtx->m_pGeomDB, nLayerId, dScaleFactor,
dTextHeight, dExtLine, dArrLen, dTextDist, bLenIsMM, nDecDig, sFont) ;
// aggiorno stato file corrente
if ( pGseCtx->m_sFilePath.empty())
pGseCtx->m_sFilePath = sFilePath ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtImport3dm('" + StringToLuaString( sFilePath) + "'," +
ToString( dScaleFactor) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeAdvancedImportIsEnabled( void)
@@ -564,7 +520,7 @@ ExeExport3MF( int nId, const string& sFilePath, int nFilter)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file 3MF
// esporto il file STL
// preparo l'esportatore
PtrOwner<IExport3MF> pExp3MF( MyCreateExport3MF()) ;
bOk = bOk && ! IsNull( pExp3MF) ;
@@ -582,31 +538,6 @@ ExeExport3MF( int nId, const string& sFilePath, int nFilter)
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeExport3dm( int nId, const string& sFilePath, int nFilter)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// esporto il file 3dm
// preparo l'esportatore
PtrOwner<IExport3dm> pExp3dm( MyCreateExport3dm()) ;
bOk = bOk && ! IsNull( pExp3dm) ;
// eseguo l'esportazione
bOk = bOk && pExp3dm->SetOptions( nFilter) ;
bOk = bOk && pExp3dm->Export( pGeomDB, nId, sFilePath) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtExport3dm(" + ToString( nId) + ",'" +
StringToLuaString( sFilePath) + "')" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-----------------------------------------------------------------------------
bool
ExeExportSvg( int nId, const string& sFilePath, int nFilter)
+6 -6
View File
@@ -766,17 +766,17 @@ MyCreateAngularDimensionFromLines( int nParentId, INTVECTOR vLineIds, const Poin
return false ;
if ( abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptDim1).Len() - ( ptP0L - ptP1L).Len()) < EPS_SMALL ||
abs(( ptDim1 - ptP1L).Len() + ( ptP0L - ptP1L ).Len() - ( ptDim1 - ptP0L).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP1L
;
// ptDim è dal lato di ptP1L
ptP1L = ptP1L ;
else
// ptDim è dal lato di ptP2L
// ptDim è dal lato di ptP2L
ptP1L = ptP2L ;
if ( abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptDim2).Len() - ( ptP0L - ptP3L).Len()) < EPS_SMALL ||
abs(( ptDim2 - ptP3L).Len() + ( ptP0L - ptP3L).Len() - ( ptDim2 - ptP0L).Len()) < EPS_SMALL)
// ptDim è dal lato di ptP1L, quindi tengo ptP3L
;
// ptDim è dal lato di ptP1L
ptP3L = ptP3L ;
else
// ptDim è dal lato di ptP2L
// ptDim è dal lato di ptP2L
ptP3L = ptP4L ;
}
+7 -42
View File
@@ -1091,44 +1091,6 @@ ExeCreateArc3P( int nParentId, const Point3d& ptP1,
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PB( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
double dBulge, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// porto in locale i punti, il versore normale e quelloe estrusione
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo l'arco (in casi particolari retta)
PtrOwner<ICurve> pCrv( bOk ? GetArc2PNB( ptStartL, ptEndL, vtNormL, dBulge) : nullptr) ;
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 = "EgtArc2PB(" + IdToString( nParentId) + ",{" +
ToString( ptStart) + "},{" +
ToString( ptEnd) + "}," +
ToString( dBulge) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateArc2PD( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
@@ -1137,17 +1099,20 @@ ExeCreateArc2PD( int nParentId, const Point3d& ptStart, const Point3d& ptEnd,
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
// creo l'arco (in casi particolari retta)
PtrOwner<ICurve> pCrv ;
bool bOk = true ;
// recupero il riferimento locale
Frame3d frLoc ;
bool bOk = pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// 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, FromPolar( 1, dDirSDeg), nRefType, frLoc) ;
Vector3d vtNormL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX, nRefType, frLoc) ;
// creo l'arco (in casi particolari retta)
PtrOwner<ICurve> pCrv( bOk ? GetArc2PVN( ptStartL, ptEndL, vtDirSL, vtNormL) : nullptr) ;
// setto l'arco
pCrv.Set( GetArc2PVN( ptStartL, ptEndL, vtDirSL, vtNormL)) ;
bOk = bOk && ! IsNull( pCrv) ;
// assegno il versore estrusione
bOk = bOk && pCrv->SetExtrusion( vtExtrL) ;
@@ -1983,7 +1948,7 @@ ExeCreateCurveCompoByInterpolation( int nParentId, const PolyLine& PL, int nType
bFound ;
bFound = PL.GetNextPoint( ptP))
crvByInterp.AddPoint( ptP) ;
PtrOwner<ICurve> pCrvCompo( crvByInterp.GetCurve( nMethod, nCrvType)) ;
PtrOwner<ICurve> pCrvCompo( crvByInterp.GetCurve( nMethod, nType)) ;
bOk = bOk && ! IsNull( pCrvCompo) ;
// assegno il versore estrusione
bOk = bOk && pCrvCompo->SetExtrusion( Z_AX) ;
+54 -1
View File
@@ -32,7 +32,7 @@
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkCurveLocal.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkExtText.h"
using namespace std ;
//-------------------------------------------------------------------------------
@@ -1623,3 +1623,56 @@ ExeCreateSurfBezierRational( int nParentId, int nDegU, int nDegV, int nSpanU, in
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
ExeCreateSurfBezierLeaves( int nParentId, int nSurfBzId, int nTextHeight)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
nParentId = AdjustId( nParentId) ;
ISurfBezier* pSurfBez = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
if ( pSurfBez == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nSurfBzId, frSurf))
return false ;
bool bOk = true ;
//disegno le foglie
vector<tuple<int,Point3d,Point3d>> vLeaves ;
pSurfBez->GetLeaves( vLeaves) ;
double dFactor = 1 ;
int nId ;
for ( int k = 0 ; k < (int)vLeaves.size() ; ++k ) {
Point3d ptBL = std::get<1>(vLeaves[k]) * dFactor ;
Point3d ptTR = std::get<2>(vLeaves[k]) * dFactor ;
Point3d ptBr( ptTR.x, ptBL.y) ;
Point3d ptTl( ptBL.x, ptTR.y) ;
PolyLine PL ;
PL.AddUPoint( 0, ptBL) ;
PL.AddUPoint( 1, ptBr) ;
PL.AddUPoint( 2, ptTR) ;
PL.AddUPoint( 3, ptTl) ;
PL.AddUPoint( 4, ptBL) ;
// creo la curva e la inserisco nel GDB
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
bOk = bOk && ! IsNull( pCrvCompo) ;
// inserisco i segmenti che uniscono i punti
bOk = bOk && pCrvCompo->FromPolyLine( PL) ;
// assegno il versore estrusione
bOk = bOk && pCrvCompo->SetExtrusion( Z_AX) ;
// inserisco la curva composita nel DB
pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) ;
string sText = ToString( std::get<0>(vLeaves[k])) ;
// creo il testo e lo riempio
Point3d ptCenter( (ptBL + ptTR) / 2) ;
PtrOwner<IExtText> pTXT( CreateExtText()) ;
bOk = bOk && ! IsNull( pTXT) ;
bOk = bOk && pTXT->Set( ptCenter, Z_AX, X_AX, sText, "", false, nTextHeight) ;
// inserisco il testo nel DB
nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pTXT)): GDB_ID_NULL) ;
}
return nId ;
}
-2
View File
@@ -188,8 +188,6 @@ ExeCurveIsACircle( int nId, Point3d& ptCen, Vector3d& vtN, double& dRad, bool& b
bCCW = ( pArc->GetAngCenter() > 0) ;
return true ;
}
else
return false ;
}
case CRV_COMPO :
{ ICurveComposite* pCompo = GetCurveComposite( pGObj) ;
+6 -74
View File
@@ -28,7 +28,6 @@
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
@@ -368,16 +367,16 @@ ExeSurfFrGetZigZagInfill( int nId, int nDestGrpId, double dStep, double dAng, bo
//----------------------------------------------------------------------------
int
ExeSurfTmVertexCount( int nId)
ExeSurfTmPartCount( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, 0)
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return 0 ;
// recupero il numero di vertici
return pStm->GetVertexCount() ;
return -1 ;
// recupero il numero di parti
return pStm->GetPartCount() ;
}
//----------------------------------------------------------------------------
@@ -394,59 +393,6 @@ ExeSurfTmFacetCount( int nId)
return pStm->GetFacetCount() ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmPartCount( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, -1)
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return -1 ;
// recupero il numero di parti
return pStm->GetPartCount() ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetVertex( int nId, int nVert, int nRefId, Point3d& ptVert)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// recupero il vertice di indice dato
if ( ! pStm->GetVertex( nVert, ptVert))
return false ;
// gestione trasformazioni ( eventuali)
return TransformPoint( pGeomDB, nId, nRefId, ptVert) ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetNearestVertex( int nId, const Point3d& ptNear, int nRefId, int& nVert, Point3d& ptVert)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie trimesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// porto il punto Near nel riferimento dell'entità
Point3d ptNearL = ptNear ;
if ( ! InvTransformPoint( pGeomDB, nId, nRefId, ptNearL))
return false ;
// recupero il vertice più vicino della superficie
nVert = GetSurfTmNearestVertex( ptNearL, *pStm) ;
if ( ! pStm->GetVertex( nVert, ptVert))
return false ;
// gestione trasformazioni ( eventuali)
return TransformPoint( pGeomDB, nId, nRefId, ptVert) ;
}
//----------------------------------------------------------------------------
int
ExeSurfTmFacetFromTria( int nId, int nT)
@@ -990,20 +936,6 @@ ExeCopySurfTmFacet( int nId, int nFacet, int nDestGrpId)
return nFacId ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetAllVertInFacet( int nId, int nFacet, INTVECTOR& vVert)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie TriMesh
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
if ( pStm == nullptr)
return false ;
// recupero l'elenco dei vertici nella faccia
return pStm->GetAllVertInFacet( nFacet, vVert) ;
}
//-----------------------------------------------------------------------------
bool
ExeSurfTmGetFacetBBox( int nId, int nFacet, int nFlag, BBox3d& b3Box)
@@ -1412,4 +1344,4 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
if ( pnCount != nullptr)
*pnCount = nCount ;
return nFirstId ;
}
}
+5 -5
View File
@@ -186,7 +186,7 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol)
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pCurve != nullptr) ;
// eseguo l'approssimazione
PtrOwner<ICurveComposite> pCC( CreateCurveComposite()) ;
@@ -292,9 +292,9 @@ ExeChangeClosedCurveStart( int nId, double dU)
bOk = bOk && ( pCurve != nullptr) ;
// cambio il punto iniziale
if ( bOk && pCurve->GetType() == CRV_ARC)
bOk = bOk && GetCurveArc( pCurve)->ChangeStartPoint(dU) ;
bOk = bOk && dynamic_cast<ICurveArc*>(pCurve)->ChangeStartPoint(dU) ;
else if ( bOk && pCurve->GetType() == CRV_COMPO)
bOk = bOk && GetCurveComposite( pCurve)->ChangeStartPoint(dU) ;
bOk = bOk && dynamic_cast<ICurveComposite*>(pCurve)->ChangeStartPoint(dU) ;
else
bOk = false ;
ExeSetModified() ;
@@ -331,9 +331,9 @@ ExeChangeClosedCurveStartPoint( int nId, const Point3d& ptP, int nRefType)
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ;
// cambio il punto iniziale
if ( bOk && pCurve->GetType() == CRV_ARC)
bOk = bOk && GetCurveArc(pCurve)->ChangeStartPoint(dPar) ;
bOk = bOk && dynamic_cast<ICurveArc*>(pCurve)->ChangeStartPoint(dPar) ;
else if ( bOk && pCurve->GetType() == CRV_COMPO)
bOk = bOk && GetCurveComposite( pCurve)->ChangeStartPoint(dPar) ;
bOk = bOk && dynamic_cast<ICurveComposite*>(pCurve)->ChangeStartPoint(dPar) ;
else
bOk = false ;
ExeSetModified() ;
+49 -42
View File
@@ -410,43 +410,6 @@ ExeSurfFrRotateSimpleNoCollision( int nId1, int nId2, const Point3d& ptCen, doub
return ( bOk && CAvSimpleSurfFrMove( *pSfr1, *pSfr2L).Rotate(ptCenL, dAngDeg)) ;
}
//-------------------------------------------------------------------------------
bool
ExeSurfTmMoveVertex( int nId, int nVert, const Point3d& ptNewVert, int nRefType, bool bUpdate)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pStm != nullptr) ;
// recupero il riferimento in cui è immersa la superficie
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frStm) ;
// eseguo la modifica
if ( bOk) {
// porto il nuovo vertice nel riferimento della superficie
Point3d ptNewVertL = GetPointLocal( pGeomDB, ptNewVert, nRefType, frStm) ;
// eseguo la modifica
bOk = pStm->MoveVertex( nVert, ptNewVertL) ;
// se richiesto, semplificazione della trimesh
if ( bUpdate)
bOk = bOk && pStm->DoCompacting() ;
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmMoveVertex(" + IdToString( nId) + "," +
ToString( nVert) + ",{" +
ToString( ptNewVert) + "}," +
RefTypeToString( nRefType) + "," +
( bUpdate ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
static int
MySurfTmToTriangles( int nId, int& nCount)
@@ -505,7 +468,7 @@ ExeSurfTmToTriangles( int nId, int* pnCount)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmToTriangles(" + IdToString( nId) + ")" +
string sLua = "EgtSurfTmToTriangles(" + ToString( nId) + ")" +
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -529,7 +492,7 @@ ExeSurfTmRemoveFacet( int nId, int nFacet)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmRemoveFacet(" + IdToString( nId) + "," +
string sLua = "EgtSurfTmRemoveFacet(" + ToString( nId) + "," +
ToString( nFacet) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -552,7 +515,7 @@ ExeSurfTmSwapFacets( int nId, int nFacet1, int nFacet2)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmSwapFacets(" + IdToString( nId) + "," +
string sLua = "EgtSurfTmSwapFacets(" + ToString( nId) + "," +
ToString( nFacet1) + "," +
ToString( nFacet2) + ")" +
" -- Ok=" + ToString( bOk) ;
@@ -576,7 +539,7 @@ ExeSurfTmRemovePart( int nId, int nPart)
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmRemovePart(" + IdToString( nId) + "," +
string sLua = "EgtSurfTmRemovePart(" + ToString( nId) + "," +
ToString( nPart) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
@@ -608,7 +571,7 @@ ExeCutSurfTmPlane( int nId, const Point3d& ptOn, const Vector3d& vtN, bool bSave
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCutSurfTmPlane(" + IdToString( nId) + ",{" +
string sLua = "EgtCutSurfTmPlane(" + ToString( nId) + ",{" +
ToString( ptOn) + "},{" +
ToString( vtN) + "}," +
( bSaveOnEq ? "true" : "false") + "," +
@@ -924,3 +887,47 @@ ExeSurfTmCut( int nId, int nCutterId, bool bInVsOut, bool bSaveOnEq)
}
return bOk ;
}
//----------------------------------------------------------------------------
static bool
MySurfBzTrim( int nId, int nTrimmerId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero la superficie Bezier da trimmare
ISurfBezier* pSrfBz = GetSurfBezier( pGeomDB->GetGeoObj( nId)) ;
if ( pSrfBz == nullptr)
return false ;
// recupero il riferimento della superficie
Frame3d frSurf ;
if ( ! pGeomDB->GetGlobFrame( nId, frSurf))
return false ;
// recupero la superficie TriMesh divisore in locale alla prima
SurfLocal SurfCLoc( pGeomDB, nTrimmerId, frSurf) ;
//const ISurfTriMesh* pStmCLoc = GetSurfTriMesh( SurfCLoc) ;
const ISurfFlatRegion* pSrfFr = GetSurfFlatRegion( SurfCLoc) ;
if ( pSrfFr == nullptr)
return false ;
PtrOwner<ISurfFlatRegion> pSrfFrCopy( pSrfFr->Clone()) ;
if ( ! pSrfFr->GetNormVersor().IsZplus())
pSrfFrCopy->Invert() ;
// eseguo il taglio
return pSrfBz->SetTrimRegion( *pSrfFrCopy) ;
}
//----------------------------------------------------------------------------
bool
ExeSurfBzTrim( int nId, int nCutterId)
{
bool bOk = MySurfBzTrim( nId, nCutterId) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSurfTmCut(" + ToString( nId) + "," +
ToString( nCutterId) + "," +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
return bOk ;
}
-2
View File
@@ -594,8 +594,6 @@ ExeGeoObjDump( int nId, string& sDump)
sDump = pGeoObj->GetTitle() + " " + ToString( nId) + "\r\n" ;
// preparo gli attributi
pGeomDB->DumpAttributes( nId, sDump, bMM, "\r\n") ;
// preparo stipple
pGeomDB->DumpStipple( nId, sDump, bMM, "\r\n") ;
// preparo TextureData
pGeomDB->DumpTextureData( nId, sDump, bMM, "\r\n") ;
// preparo UserObj
-20
View File
@@ -245,26 +245,6 @@ ExeAddMachGroup( const string& sName, const string& sMachineName)
return nId ;
}
//-----------------------------------------------------------------------------
int
ExeCopyMachGroup( const string& sSouName, const string& sName)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL)
// copio la macchinata (gruppo di lavorazione)
int nId = pMachMgr->CopyMachGroup( sSouName, sName) ;
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCopyMachGroup('" + sSouName + "','" +
sName + "')" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return nId ;
}
//-----------------------------------------------------------------------------
bool
ExeRemoveMachGroup( int nMGroupId)
BIN
View File
Binary file not shown.
-38
View File
@@ -169,23 +169,6 @@ LuaImport3MF( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaImport3dm( lua_State* L)
{
// 1 o 2 parametri : path del file da importare [, Fattore di scala]
string sFilePath ;
LuaCheckParam( L, 1, sFilePath)
double dScaleFactor = 1.0 ;
LuaGetParam( L, 2, dScaleFactor) ;
LuaClearStack( L) ;
// apro il file
bool bOk = ExeImport3dm( sFilePath, dScaleFactor) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaAdvancedImport( lua_State* L)
@@ -262,25 +245,6 @@ LuaExport3MF( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaExport3dm( lua_State* L)
{
// 2 o 3 parametri : GroupId e path del file da esportare [, Filter]
int nGroupId ;
LuaCheckParam( L, 1, nGroupId)
string sFilePath ;
LuaCheckParam( L, 2, sFilePath)
int nFilter = EEXFLT_DEFAULT ;
LuaGetParam( L, 3, nFilter) ;
LuaClearStack( L) ;
// creo il file
bool bOk = ExeExport3dm( nGroupId, sFilePath) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaExportSvg( lua_State* L)
@@ -333,12 +297,10 @@ LuaInstallExchange( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtImportPnt", LuaImportPnt) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImportStl", LuaImportStl) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImport3MF", LuaImport3MF) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtImport3dm", LuaImport3dm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAdvancedImport", LuaAdvancedImport) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportDxf", LuaExportDxf) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportStl", LuaExportStl) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExport3MF", LuaExport3MF) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExport3dm", LuaExport3dm) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportSvg", LuaExportSvg) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExportThreeJS", LuaExportThreeJS) ;
return bOk ;
-27
View File
@@ -425,32 +425,6 @@ LuaCreateArc3P( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PB( lua_State* L)
{
// 4 o 5 parametri : ParentId, PtStart, PtEnd, dBulge [, nRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
Point3d ptStart ;
LuaCheckParam( L, 2, ptStart)
Point3d ptEnd ;
LuaCheckParam( L, 3, ptEnd)
double dBulge ;
LuaCheckParam( L, 4, dBulge)
int nRefType = RTY_DEFAULT ;
LuaGetParam( L, 5, nRefType) ;
LuaClearStack( L) ;
// creo l'arco
int nId = ExeCreateArc2PB( nParentId, ptStart, ptEnd, dBulge, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateArc2PD( lua_State* L)
@@ -1083,7 +1057,6 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2P", LuaCreateArcC2P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArcC2PEx", LuaCreateArcC2PEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc3P", LuaCreateArc3P) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PB", LuaCreateArc2PB) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PD", LuaCreateArc2PD) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PDEx", LuaCreateArc2PDEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtArc2PV", LuaCreateArc2PV) ;
+23
View File
@@ -816,6 +816,28 @@ LuaCreateSurfBezierRational( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCreateSurfBezierLeaves( lua_State* L)
{
// 3 parametri : ParentId, nId, nTextHeight
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSurfBzId ;
LuaCheckParam( L, 2, nSurfBzId)
int nTextHeight ;
LuaCheckParam( L, 3, nTextHeight)
LuaClearStack( L) ;
// creo la superficie
int nId = ExeCreateSurfBezierLeaves( nParentId, nSurfBzId, nTextHeight) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
@@ -850,5 +872,6 @@ LuaInstallGdbCreateSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmByVolZmap", LuaCreateSurfTmByVolZmap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezier", LuaCreateSurfBezier) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierRat", LuaCreateSurfBezierRational) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBezierLeaves", LuaCreateSurfBezierLeaves) ;
return bOk ;
}
+8 -96
View File
@@ -270,15 +270,18 @@ LuaSurfFrGetZigZagInfill( lua_State* L)
//----------------------------------------------------------------------------
static int
LuaSurfTmVertexCount( lua_State* L)
LuaSurfTmPartCount( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero il numero di vertici della superficie trimesh
int nNbr = ExeSurfTmVertexCount( nId) ;
LuaSetParam( L, nNbr) ;
// recupero il numero di parti della superficie trimesh
int nParts = ExeSurfTmPartCount( nId) ;
if ( nParts >= 0)
LuaSetParam( L, nParts) ;
else
LuaSetParam( L) ;
return 1 ;
}
@@ -296,72 +299,6 @@ LuaSurfTmFacetCount( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmPartCount( lua_State* L)
{
// 1 parametro : Id
int nId ;
LuaCheckParam( L, 1, nId)
LuaClearStack( L) ;
// recupero il numero di parti della superficie trimesh
int nParts = ExeSurfTmPartCount( nId) ;
if ( nParts >= 0)
LuaSetParam( L, nParts) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetVertex( lua_State* L)
{
// 2 o 3 parametri : Id, nVert, [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
int nVert ;
LuaCheckParam( L, 2, nVert)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero il vertice di indice dato (0-based)
Point3d ptVert ;
bool bOk = ExeSurfTmGetVertex( nId, nVert, nRefId, ptVert) ;
if ( bOk)
LuaSetParam( L, ptVert) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetNearestVertex( lua_State* L)
{
// 2 o 3 parametri : Id, ptNear [, nRefId]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptNear ;
LuaCheckParam( L, 2, ptNear)
int nRefId = nId ;
LuaGetParam( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero il vertice più vicino della superficie
int nVert ;
Point3d ptVert ;
bool bOk = ExeSurfTmGetNearestVertex( nId, ptNear, nRefId, nVert, ptVert) ;
if ( bOk) {
LuaSetParam( L, nVert) ;
LuaSetParam( L, ptVert) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 2 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmFacetFromTria( lua_State* L)
@@ -382,27 +319,6 @@ LuaSurfTmFacetFromTria( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetAllVertInFacet( lua_State* L)
{
// 2 parametri : nId, nFacet
int nId ;
LuaCheckParam( L, 1, nId)
int nFacet ;
LuaCheckParam( L, 2, nFacet)
LuaClearStack( L) ;
// recupero l'elenco dei vertici nella faccia
INTVECTOR vVert ;
bool bOk = ExeSurfTmGetAllVertInFacet( nId, nFacet, vVert) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, vVert) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmGetFacetBBox( lua_State* L)
@@ -1045,13 +961,9 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrMoveSimpleNoCollision", LuaSurfFrMoveSimpleNoCollision) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrRotateSimpleNoCollision", LuaSurfFrRotateSimpleNoCollision) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetSurfFrZigZagInfill", LuaSurfFrGetZigZagInfill) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmVertexCount", LuaSurfTmVertexCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmPartCount", LuaSurfTmPartCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetVertex", LuaSurfTmGetVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetNearestVertex", LuaSurfTmGetNearestVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetCount", LuaSurfTmFacetCount) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetFromTria", LuaSurfTmFacetFromTria) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetAllVertInFacet", LuaSurfTmGetAllVertInFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBox", LuaSurfTmGetFacetBBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxGlob", LuaSurfTmGetFacetBBoxGlob) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxRef", LuaSurfTmGetFacetBBoxRef) ;
+18 -25
View File
@@ -141,30 +141,6 @@ LuaSurfFrOffset( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmMoveVertex( lua_State* L)
{
// 3 o 4 o 5 parametri : nId, nVert, ptNewVert [, nRefId] [, bUpdate]
int nId ;
LuaCheckParam( L, 1, nId)
int nVert ;
LuaCheckParam( L, 2, nVert)
Point3d ptNewVert ;
LuaCheckParam( L, 3, ptNewVert)
int nRefType = RTY_DEFAULT ;
bool bUpdate = true ;
if ( LuaGetParam( L, 4, nRefType))
LuaGetParam( L, 5, bUpdate) ;
else
LuaGetParam( L, 4, bUpdate) ;
LuaClearStack( L) ;
// sposto il vertice di indice dato della trimesh
bool bOk = ExeSurfTmMoveVertex( nId, nVert, ptNewVert, nRefType, bUpdate) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmToTriangles( lua_State* L)
@@ -388,6 +364,23 @@ LuaSurfTmCut( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSurfBzTrim( lua_State* L)
{
// 2 parametri : nId, nCutterId
int nId ;
LuaCheckParam( L, 1, nId)
int nCutterId ;
LuaCheckParam( L, 2, nCutterId)
LuaClearStack( L) ;
// taglio la prima superficie in base alla seconda
//bool bOk = ExeSurfTmCut( nId, nCutterId, bInVsOut, bOn) ;
bool bOk = ExeSurfBzTrim( nId, nCutterId) ;
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
bool
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
@@ -400,7 +393,6 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrSubtract", LuaSurfFrSubtract) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrIntersect", LuaSurfFrIntersect) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfFrOffset", LuaSurfFrOffset) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmMoveVertex", LuaSurfTmMoveVertex) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmToTriangles", LuaSurfTmToTriangles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmRemoveFacet", LuaSurfTmRemoveFacet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSwapFacets", LuaSurfTmSwapFacets) ;
@@ -413,5 +405,6 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
return bOk ;
}
+1 -4
View File
@@ -256,10 +256,7 @@ LuaSetVal( lua_State* L)
} break ;
}
// restituisco il risultato
if ( bOk)
LuaSetParam( L, sNotes) ;
else
LuaSetParam(L, "") ;
LuaSetParam( L, sNotes) ;
return 1 ;
}
-33
View File
@@ -49,38 +49,6 @@ LuaPointCurveDist( lua_State* L)
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPointCurveDistSide( lua_State* L)
{
// 3 o 4 parametri : ptP, nCrvId, vtN [, nRefId]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
int nId ;
LuaCheckParam( L, 2, nId)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
int nRefType = nId ;
LuaGetParam( L, 4, nRefType) ;
LuaClearStack( L) ;
// calcolo la distanza
int nSide ;
double dDist ;
Point3d ptMin ;
bool bOk = ExePointCurveDistSide( ptP, nId, vtN, nRefType, &dDist, ptMin, &nSide) ;
if ( bOk) {
LuaSetParam( L, dDist) ;
LuaSetParam( L, ptMin) ;
LuaSetParam( L, nSide) ;
}
else {
LuaSetParam( L) ;
LuaSetParam( L) ;
LuaSetParam( L) ;
}
return 3 ;
}
//----------------------------------------------------------------------------
static int
LuaPointSurfTmDist( lua_State* L)
@@ -117,7 +85,6 @@ LuaInstallGeoDist( LuaMgr& luaMgr)
{
bool bOk = ( &luaMgr != nullptr) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointCurveDist", LuaPointCurveDist) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointCurveDistSide", LuaPointCurveDistSide) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtPointSurfTmDist", LuaPointSurfTmDist) ;
return bOk ;
}
-21
View File
@@ -227,26 +227,6 @@ LuaAddMachGroup( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaCopyMachGroup( lua_State* L)
{
// 2 parametri : nome del gruppo sorgente, nome del nuovo gruppo
string sSouName ;
LuaCheckParam( L, 1, sSouName)
string sName ;
LuaCheckParam( L, 2, sName) ;
LuaClearStack( L) ;
// copio la macchinata
int nId = ExeCopyMachGroup( sSouName, sName) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetParam( L, nId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRemoveMachGroup( lua_State* L)
@@ -4003,7 +3983,6 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetPrevMachGroup", LuaGetPrevMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupNewName", LuaGetMachGroupNewName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAddMachGroup", LuaAddMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtCopyMachGroup", LuaCopyMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveMachGroup", LuaRemoveMachGroup) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupName", LuaGetMachGroupName) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetMachGroupMachineName", LuaGetMachGroupMachineName) ;