Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a5a0646ddc | |||
| b954be810c | |||
| 8500a0467e | |||
| 8145b4586c | |||
| 4de367395a | |||
| d9cf624458 | |||
| eedd2068fa | |||
| cf2b1742a0 | |||
| 29462e9536 | |||
| 7e7975c622 | |||
| 85c4af98ce | |||
| 382138e6c5 | |||
| 749830aba9 | |||
| 90449cad40 | |||
| 3d3900b39a |
@@ -10,6 +10,8 @@
|
||||
// 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.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -49,9 +51,11 @@ 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" ;
|
||||
@@ -316,6 +320,21 @@ 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)
|
||||
@@ -361,6 +380,21 @@ 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)
|
||||
|
||||
@@ -25,9 +25,11 @@ class IImportDxf ;
|
||||
class IImportPnt ;
|
||||
class IImportStl ;
|
||||
class IImport3MF ;
|
||||
class IImport3dm ;
|
||||
class IExportDxf ;
|
||||
class IExportStl ;
|
||||
class IExport3MF ;
|
||||
class IExport3dm ;
|
||||
class IExportThreeJS ;
|
||||
class IExportSvg ;
|
||||
class IExcExecutor ;
|
||||
@@ -50,9 +52,11 @@ 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) ;
|
||||
|
||||
+70
-1
@@ -28,9 +28,11 @@
|
||||
#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"
|
||||
@@ -80,6 +82,8 @@ 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")
|
||||
@@ -355,6 +359,46 @@ 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)
|
||||
@@ -520,7 +564,7 @@ ExeExport3MF( int nId, const string& sFilePath, int nFilter)
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
bool bOk = true ;
|
||||
// esporto il file STL
|
||||
// esporto il file 3MF
|
||||
// preparo l'esportatore
|
||||
PtrOwner<IExport3MF> pExp3MF( MyCreateExport3MF()) ;
|
||||
bOk = bOk && ! IsNull( pExp3MF) ;
|
||||
@@ -538,6 +582,31 @@ 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
@@ -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
|
||||
ptP1L = ptP1L ;
|
||||
// ptDim è dal lato di ptP1L, quindi tengo 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
|
||||
ptP3L = ptP3L ;
|
||||
// ptDim è dal lato di ptP1L, quindi tengo ptP3L
|
||||
;
|
||||
else
|
||||
// ptDim è dal lato di ptP2L
|
||||
// ptDim è dal lato di ptP2L
|
||||
ptP3L = ptP4L ;
|
||||
}
|
||||
|
||||
|
||||
+42
-7
@@ -1091,6 +1091,44 @@ 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,
|
||||
@@ -1099,20 +1137,17 @@ 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 ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
bool 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) ;
|
||||
// setto l'arco
|
||||
pCrv.Set( GetArc2PVN( ptStartL, ptEndL, vtDirSL, vtNormL)) ;
|
||||
// creo l'arco (in casi particolari retta)
|
||||
PtrOwner<ICurve> pCrv( bOk ? GetArc2PVN( ptStartL, ptEndL, vtDirSL, vtNormL) : nullptr) ;
|
||||
bOk = bOk && ! IsNull( pCrv) ;
|
||||
// assegno il versore estrusione
|
||||
bOk = bOk && pCrv->SetExtrusion( vtExtrL) ;
|
||||
@@ -1948,7 +1983,7 @@ ExeCreateCurveCompoByInterpolation( int nParentId, const PolyLine& PL, int nType
|
||||
bFound ;
|
||||
bFound = PL.GetNextPoint( ptP))
|
||||
crvByInterp.AddPoint( ptP) ;
|
||||
PtrOwner<ICurve> pCrvCompo( crvByInterp.GetCurve( nMethod, nType)) ;
|
||||
PtrOwner<ICurve> pCrvCompo( crvByInterp.GetCurve( nMethod, nCrvType)) ;
|
||||
bOk = bOk && ! IsNull( pCrvCompo) ;
|
||||
// assegno il versore estrusione
|
||||
bOk = bOk && pCrvCompo->SetExtrusion( Z_AX) ;
|
||||
|
||||
@@ -188,6 +188,8 @@ 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) ;
|
||||
|
||||
+74
-6
@@ -28,6 +28,7 @@
|
||||
#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"
|
||||
|
||||
@@ -367,16 +368,16 @@ ExeSurfFrGetZigZagInfill( int nId, int nDestGrpId, double dStep, double dAng, bo
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeSurfTmPartCount( int nId)
|
||||
ExeSurfTmVertexCount( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, -1)
|
||||
VERIFY_GEOMDB( pGeomDB, 0)
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return -1 ;
|
||||
// recupero il numero di parti
|
||||
return pStm->GetPartCount() ;
|
||||
return 0 ;
|
||||
// recupero il numero di vertici
|
||||
return pStm->GetVertexCount() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -393,6 +394,59 @@ 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)
|
||||
@@ -936,6 +990,20 @@ 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)
|
||||
@@ -1344,4 +1412,4 @@ ExeExtractSurfBezierLoops( int nId, int nDestGrpId, int* pnCount)
|
||||
if ( pnCount != nullptr)
|
||||
*pnCount = nCount ;
|
||||
return nFirstId ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ ExeApproxCurve( int nId, int nApprType, double dLinTol)
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
const 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 && dynamic_cast<ICurveArc*>(pCurve)->ChangeStartPoint(dU) ;
|
||||
bOk = bOk && GetCurveArc( pCurve)->ChangeStartPoint(dU) ;
|
||||
else if ( bOk && pCurve->GetType() == CRV_COMPO)
|
||||
bOk = bOk && dynamic_cast<ICurveComposite*>(pCurve)->ChangeStartPoint(dU) ;
|
||||
bOk = bOk && GetCurveComposite( 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 && dynamic_cast<ICurveArc*>(pCurve)->ChangeStartPoint(dPar) ;
|
||||
bOk = bOk && GetCurveArc(pCurve)->ChangeStartPoint(dPar) ;
|
||||
else if ( bOk && pCurve->GetType() == CRV_COMPO)
|
||||
bOk = bOk && dynamic_cast<ICurveComposite*>(pCurve)->ChangeStartPoint(dPar) ;
|
||||
bOk = bOk && GetCurveComposite( pCurve)->ChangeStartPoint(dPar) ;
|
||||
else
|
||||
bOk = false ;
|
||||
ExeSetModified() ;
|
||||
|
||||
+42
-5
@@ -410,6 +410,43 @@ 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)
|
||||
@@ -468,7 +505,7 @@ ExeSurfTmToTriangles( int nId, int* pnCount)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmToTriangles(" + ToString( nId) + ")" +
|
||||
string sLua = "EgtSurfTmToTriangles(" + IdToString( nId) + ")" +
|
||||
" -- Id1=" + ToString( nFirstId) + ",Nbr=" + ToString( nCount) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
@@ -492,7 +529,7 @@ ExeSurfTmRemoveFacet( int nId, int nFacet)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmRemoveFacet(" + ToString( nId) + "," +
|
||||
string sLua = "EgtSurfTmRemoveFacet(" + IdToString( nId) + "," +
|
||||
ToString( nFacet) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
@@ -515,7 +552,7 @@ ExeSurfTmSwapFacets( int nId, int nFacet1, int nFacet2)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmSwapFacets(" + ToString( nId) + "," +
|
||||
string sLua = "EgtSurfTmSwapFacets(" + IdToString( nId) + "," +
|
||||
ToString( nFacet1) + "," +
|
||||
ToString( nFacet2) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
@@ -539,7 +576,7 @@ ExeSurfTmRemovePart( int nId, int nPart)
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmRemovePart(" + ToString( nId) + "," +
|
||||
string sLua = "EgtSurfTmRemovePart(" + IdToString( nId) + "," +
|
||||
ToString( nPart) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
@@ -571,7 +608,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(" + ToString( nId) + ",{" +
|
||||
string sLua = "EgtCutSurfTmPlane(" + IdToString( nId) + ",{" +
|
||||
ToString( ptOn) + "},{" +
|
||||
ToString( vtN) + "}," +
|
||||
( bSaveOnEq ? "true" : "false") + "," +
|
||||
|
||||
@@ -594,6 +594,8 @@ 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
|
||||
|
||||
@@ -245,6 +245,26 @@ 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)
|
||||
|
||||
Binary file not shown.
@@ -169,6 +169,23 @@ 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)
|
||||
@@ -245,6 +262,25 @@ 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)
|
||||
@@ -297,10 +333,12 @@ 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 ;
|
||||
|
||||
@@ -425,6 +425,32 @@ 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)
|
||||
@@ -1057,6 +1083,7 @@ 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) ;
|
||||
|
||||
+96
-8
@@ -270,18 +270,15 @@ LuaSurfFrGetZigZagInfill( lua_State* L)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmPartCount( lua_State* L)
|
||||
LuaSurfTmVertexCount( 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) ;
|
||||
// recupero il numero di vertici della superficie trimesh
|
||||
int nNbr = ExeSurfTmVertexCount( nId) ;
|
||||
LuaSetParam( L, nNbr) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
@@ -299,6 +296,72 @@ 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)
|
||||
@@ -319,6 +382,27 @@ 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)
|
||||
@@ -961,9 +1045,13 @@ 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( "EgtSurfTmPartCount", LuaSurfTmPartCount) ;
|
||||
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( "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) ;
|
||||
|
||||
@@ -141,6 +141,30 @@ 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)
|
||||
@@ -376,6 +400,7 @@ 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) ;
|
||||
|
||||
+4
-1
@@ -256,7 +256,10 @@ LuaSetVal( lua_State* L)
|
||||
} break ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, sNotes) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, sNotes) ;
|
||||
else
|
||||
LuaSetParam(L, "") ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,38 @@ 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)
|
||||
@@ -85,6 +117,7 @@ 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 ;
|
||||
}
|
||||
|
||||
@@ -227,6 +227,26 @@ 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)
|
||||
@@ -3983,6 +4003,7 @@ 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) ;
|
||||
|
||||
Reference in New Issue
Block a user