Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 16b7208962 | |||
| 7c6c48b8b8 | |||
| 2f3d1a84ef | |||
| 2221934f3c | |||
| 0424900a2b | |||
| e4f45df79a | |||
| 868efb69f1 | |||
| 3d59a7ec24 | |||
| 9219fe9792 | |||
| bf069c7f7a | |||
| f949e39d47 | |||
| 88904db10f | |||
| 429b8d828c | |||
| 1bf59acd00 | |||
| a5a85a6723 | |||
| c523c46670 | |||
| fb0b4f9621 | |||
| 7070032120 | |||
| 0b1461984c | |||
| 4f7f5d97b2 | |||
| 8cd72b2a4c | |||
| 7b3c24c2be | |||
| e5f296e712 |
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2023
|
||||
// EgalTech 2014-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE.h Data : 05.02.23 Versione : 2.5a6
|
||||
// File : EXE.h Data : 15.05.24 Versione : 2.6e4
|
||||
// Contenuto : Dichiarazioni locali per moduli EXE.
|
||||
//
|
||||
//
|
||||
@@ -26,6 +26,7 @@ const std::string& ExeGetIniFile( void) ;
|
||||
const std::string& ExeGetKey( void) ;
|
||||
const std::string& ExeGetNestKey( void) ;
|
||||
const std::string& ExeGetLockId( void) ;
|
||||
bool ExeVerifyKeyOption( int nOptInd) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ILogger* GetLogger( void) ;
|
||||
|
||||
+68
-1
@@ -40,11 +40,12 @@
|
||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkCurveByInterp.h"
|
||||
#include "/EgtDev/Include/EGkCurveByApprox.h"
|
||||
#include "/EgtDev/Include/EGkCurveAux.h"
|
||||
#include "/EgtDev/Include/EGkOffsetCurve.h"
|
||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -2584,3 +2585,69 @@ CalcExtrusion( IGeomDB* pGeomDB, int nParentId, int nRefType)
|
||||
vtExtr.LocToLoc( pGeomDB->GetGridFrame(), frEnt) ;
|
||||
return vtExtr ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
MyCreateCurveBezierForm( int nParentId, int nCrvId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
nParentId = AdjustId( nParentId) ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nCrvId, frCrv))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento di destinazione
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero la curva
|
||||
const ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nCrvId)) ;
|
||||
if ( pCurve == nullptr || ! pCurve->IsValid())
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il vettore estrusione della curva e lo porto in locale al gruppo destinazione
|
||||
Vector3d vtExtr ;
|
||||
pCurve->GetExtrusion( vtExtr) ;
|
||||
vtExtr.LocToLoc( frCrv, frLoc) ;
|
||||
int nType = pCurve->GetType() ;
|
||||
PtrOwner<ICurve> pCrv ;
|
||||
switch ( nType ) {
|
||||
case CRV_LINE :
|
||||
pCrv.Set( LineToBezierCurve( GetCurveLine( pCurve))) ;
|
||||
break ;
|
||||
case CRV_ARC :
|
||||
pCrv.Set( ArcToBezierCurve( GetCurveArc( pCurve))) ;
|
||||
break ;
|
||||
case CRV_BEZIER :
|
||||
pCrv.Set( BezierToBasicBezierCurve( GetCurveBezier( pCurve))) ;
|
||||
break ;
|
||||
case CRV_COMPO :
|
||||
pCrv.Set( CompositeToBezierCurve( GetCurveComposite( pCurve))) ;
|
||||
break ;
|
||||
default :
|
||||
break ;
|
||||
}
|
||||
// setto l'estrusione
|
||||
pCrv->SetExtrusion( vtExtr) ;
|
||||
// aggiungo la curva in forma di Bezier al DB
|
||||
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrv)) ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
ExeCreateCurveBezierForm( int nParentId, int nCrvId)
|
||||
{
|
||||
// eseguo
|
||||
int nId = MyCreateCurveBezierForm( nParentId, nCrvId) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtCreateCurveBezierForm(" + IdToString( nParentId) + "," +
|
||||
IdToString( nCrvId) + "," +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nId ;
|
||||
}
|
||||
|
||||
@@ -187,3 +187,57 @@ ExeCreateVolZmapFromSurfTm( int nParentId, int nStmId, double dPrec, bool bTriDe
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUpdateVolZmapByAddingSurfTm( int nVolZmapId, int nStmId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero lo Zmap
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZmapId)) ;
|
||||
bool bOk = ( pVZM != nullptr) ;
|
||||
// recupero la trimesh
|
||||
PtrOwner<ISurfTriMesh> pStm( CloneSurfTriMesh( pGeomDB->GetGeoObj( nStmId))) ;
|
||||
bOk = bOk && !IsNull( pStm) ;
|
||||
// recupero il frame dello Zmap e della Trimesh
|
||||
Frame3d frZmap, frStm ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nVolZmapId, frZmap) &&
|
||||
pGeomDB->GetGlobFrame( nStmId, frStm) ;
|
||||
// porto la Stm nel frame dello Zmap
|
||||
bOk = bOk && pStm->LocToLoc( frStm, frZmap) ;
|
||||
// aggiorno lo Zmap con la nuova superficie
|
||||
bOk = bOk && pVZM->AddSurfTm( pStm) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtUpdateVolZmapByAddingSurfTm(" + ToString( nVolZmapId) + "," +
|
||||
ToString( nStmId) + ")"
|
||||
" -- bOk =" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeUniformVolZmap( int nVolZmapId, double dToler)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero lo Zmap
|
||||
IVolZmap* pVZM = GetVolZmap( pGeomDB->GetGeoObj( nVolZmapId)) ;
|
||||
bool bOk = ( pVZM != nullptr) ;
|
||||
// aggiorno lo Zmap
|
||||
dToler = max( dToler, EPS_SMALL) ;
|
||||
bOk = bOk && pVZM->MakeUniform( dToler) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtUniformZmap(" + ToString( nVolZmapId) + "," +
|
||||
ToString( dToler) + ")"
|
||||
" -- bOk =" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkIntersCurves.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
@@ -676,4 +677,4 @@ ExeCurveCompoNormVersor( int nId, int nSimpCrv, int nRefId, Vector3d& vtNorm)
|
||||
}
|
||||
// gestione trasformazione ( eventuale)
|
||||
return TransformVector( pGeomDB, nId, nRefId, vtNorm) ;
|
||||
}
|
||||
}
|
||||
@@ -1081,6 +1081,98 @@ ExeSurfTmGetFacetBBoxRef( int nId, int nFacet, int nFlag, const Frame3d& frRef,
|
||||
return pStm->GetFacetBBox( nFacet, frGlobL, b3Box, nFlag) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmGetFacetOutlineInfo( int nId, int nFacet, int nRefId,
|
||||
int& nStatus, BOOLVECTOR& vbOpen, INTVECTOR& vnAdj, DBLVECTOR& vdLen, VCT3DVECTOR& vvtNorm, DBLVECTOR& vdElev)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie TriMesh
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
// recupero normale della faccia
|
||||
Vector3d vtNorm ;
|
||||
if ( ! pStm->GetFacetNormal( nFacet, vtNorm))
|
||||
return false ;
|
||||
// recupero i loop come polilinee
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( ! pStm->GetFacetLoops( nFacet, vPL) || vPL.empty())
|
||||
return false ;
|
||||
// calcolo lo stato
|
||||
if ( vPL.size() == 1)
|
||||
nStatus = 0 ;
|
||||
else {
|
||||
nStatus = -1 ;
|
||||
for ( int i = 1 ; nStatus == -1 && i < int( vPL.size()) ; ++ i) {
|
||||
double dIni, dFin ;
|
||||
Point3d ptIni, ptFin ;
|
||||
bool bFound = vPL[i].GetFirstULine( &dIni, &ptIni, &dFin, &ptFin) ;
|
||||
while ( bFound) {
|
||||
int nAdj = lround( dIni) ;
|
||||
Vector3d vtNf ;
|
||||
if ( nAdj >= 0 && pStm->GetFacetNormal( nAdj, vtNf)) {
|
||||
Vector3d vtTg = ptFin - ptIni ;
|
||||
vtTg.Normalize() ;
|
||||
if ( ( vtTg ^ vtNf) * vtNorm > EPS_SMALL) {
|
||||
nStatus = 1 ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
bFound = vPL[i].GetNextULine( &dIni, &ptIni, &dFin, &ptFin) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// pulisco e prealloco i vettori del risultato
|
||||
int nDim = vPL[0].GetLineNbr() ;
|
||||
vbOpen.clear() ; vbOpen.reserve( nDim) ;
|
||||
vnAdj.clear() ; vnAdj.reserve( nDim) ;
|
||||
vdLen.clear() ; vdLen.reserve( nDim) ;
|
||||
vvtNorm.clear() ; vvtNorm.reserve( nDim) ;
|
||||
vdElev.clear() ; vdElev.reserve( nDim) ;
|
||||
// recupero riferimento alla lista dei punti
|
||||
PNTULIST& lstPU = vPL[0].GetUPointList() ;
|
||||
// ciclo sui lati del loop esterno (il primo)
|
||||
double dIni, dFin ;
|
||||
Point3d ptIni, ptFin ;
|
||||
bool bFound = vPL[0].GetFirstULine( &dIni, &ptIni, &dFin, &ptFin) ;
|
||||
while ( bFound) {
|
||||
// faccia adiacente
|
||||
int nAdj = lround( dIni) ;
|
||||
// lunghezza lato
|
||||
double dLen = Dist( ptIni, ptFin) ;
|
||||
// aperto se senza adiacenza o con faccia adiacente che va da parte negativa (tipo foro)
|
||||
bool bOpen = true ;
|
||||
Vector3d vtTg = ptFin - ptIni ;
|
||||
vtTg.Normalize() ;
|
||||
Vector3d vtNf ;
|
||||
if ( nAdj >= 0 && pStm->GetFacetNormal( nAdj, vtNf))
|
||||
bOpen = ((vtTg ^ vtNf) * vtNorm < EPS_SMALL) ;
|
||||
// normale al lato (verso interno se chiuso, verso esterno se aperto)
|
||||
Vector3d vtN = vtTg ;
|
||||
vtN.Rotate( vtNorm, 0, ( bOpen ? -1 : 1)) ;
|
||||
// elevazione secondo direzione della normale al lato
|
||||
double dElev = 0 ;
|
||||
for ( const auto& PU : lstPU) {
|
||||
double dDist = ( PU.first - ptIni) * vtN ;
|
||||
dElev = ( bOpen ? min( dElev, dDist) : max( dElev, dDist)) ;
|
||||
}
|
||||
// porto normale nel riferimento desiderato
|
||||
TransformVector( pGeomDB, nId, nRefId, vtN) ;
|
||||
// inserisco dati nei parametri di ritorno
|
||||
vbOpen.emplace_back( bOpen) ;
|
||||
vnAdj.emplace_back( nAdj) ;
|
||||
vdLen.emplace_back( dLen) ;
|
||||
vvtNorm.emplace_back( vtN) ;
|
||||
vdElev.emplace_back( dElev) ;
|
||||
// passo al prossimo lato
|
||||
bFound = vPL[0].GetNextULine( &dIni, &ptIni, &dFin, &ptFin) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeSurfTmGetEdges( int nId, int nDestGrpId, bool bSmoothAng, int* pnCount)
|
||||
|
||||
+230
-6
@@ -20,6 +20,8 @@
|
||||
#include "GeoTools.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveBezier.h"
|
||||
@@ -34,16 +36,15 @@
|
||||
#include "/EgtDev/Include/EGkChainCurves.h"
|
||||
#include "/EgtDev/Include/EGkProjectCurveSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkSurfBezier.h"
|
||||
#include "/EgtDev/Include/EGkExtTExt.h"
|
||||
#include "/EgtDev/Include/EGkGdbIterator.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkIntervals.h"
|
||||
#include "/EgtDev/Include/EGkPolygon3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGkCalcPocketing.h"
|
||||
#include <EgtDev/Include/EGkSfrCreate.h>
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <functional>
|
||||
|
||||
|
||||
@@ -333,10 +334,9 @@ ExeChangeClosedCurveStartPoint( int nId, const Point3d& ptP, int nRefType)
|
||||
// porto in locale il punto vicino ad iniziale
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
|
||||
// recupero la posizione parametrica della proiezione di questo punto sulla curva
|
||||
DistPointCurve distPC( ptPL, *pCurve) ;
|
||||
double dPar ;
|
||||
int nFlag ;
|
||||
bOk = bOk && distPC.GetParamAtMinDistPoint( 0, dPar, nFlag) ;
|
||||
bOk = bOk && DistPointCurve( ptPL, *pCurve).GetParamAtMinDistPoint( 0, dPar, nFlag) ;
|
||||
// cambio il punto iniziale
|
||||
if ( bOk && pCurve->GetType() == CRV_ARC)
|
||||
bOk = bOk && GetCurveArc(pCurve)->ChangeStartPoint(dPar) ;
|
||||
@@ -2491,6 +2491,230 @@ ExeProjectCurveOnSurfTmExt( int nCurveId, int nSurfTmId, int nGuideId, int nDest
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
MyProjectCurveOnSurfBz( int nCurveId, int nSurfBzId, const Vector3d& vtDir, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva e il suo riferimento
|
||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCurveId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
|
||||
return false ;
|
||||
// recupero la superficie bezier e il suo riferimento
|
||||
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = pSbz->GetAuxSurf() ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
Frame3d frSbz ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nSurfBzId, frSbz))
|
||||
return false ;
|
||||
// recupero il riferimento del gruppo di destinazione
|
||||
nDestGrpId = AdjustId( nDestGrpId) ;
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
||||
return false ;
|
||||
// porto la curva e il vettore nel riferimento della superficie
|
||||
CurveLocal CrvLoc( pCrv, frCrv, frSbz) ;
|
||||
if ( CrvLoc.Get() == nullptr)
|
||||
return false ;
|
||||
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frCrv) ;
|
||||
vtDirL.LocToLoc( frCrv, frSbz) ;
|
||||
// eseguo la proiezione
|
||||
PNT5AXVECTOR vPt5ax ;
|
||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, vtDirL, dLinTol, dMaxSegmLen, vPt5ax))
|
||||
return false ;
|
||||
// inserisco la composita nel gruppo destinazione
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
for ( const auto& Pt5ax : vPt5ax) {
|
||||
if ( IsNull( pCompo)) {
|
||||
pCompo.Set( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo))
|
||||
return false ;
|
||||
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
||||
}
|
||||
else
|
||||
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
||||
}
|
||||
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
|
||||
if ( nCompoId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// aggiungo i versori nel gruppo destinazione
|
||||
int nInd = 0 ;
|
||||
for ( const auto& Pt5ax : vPt5ax) {
|
||||
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
||||
if ( IsNull( pGeoVct))
|
||||
return false ;
|
||||
pGeoVct->Set( 10 * GetLocToLoc( Pt5ax.vtDir, frSbz, frDest), GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return false ;
|
||||
pGeomDB->SetInfo( nNewId, "Ind", nInd ++) ;
|
||||
pGeomDB->SetInfo( nNewId, "Par", Pt5ax.dPar) ;
|
||||
pGeomDB->SetInfo( nNewId, "Flag", Pt5ax.nFlag) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeProjectCurveOnSurfBz( int nCurveId, int nSurfBzId, const Vector3d& vtDir, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, int nRefType)
|
||||
{
|
||||
bool bOk = MyProjectCurveOnSurfBz( nCurveId, nSurfBzId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtProjectCurveOnSurfBz(" + ToString( nCurveId) + "," +
|
||||
ToString( nSurfBzId) + ",{" +
|
||||
ToString( vtDir) + "}," +
|
||||
ToString( nDestGrpId) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
ToString( dMaxSegmLen) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static bool
|
||||
MyProjectCurveOnSurfBzExt( int nCurveId, int nSurfBzId, int nGuideId, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva e il suo riferimento
|
||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nCurveId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nCurveId, frCrv))
|
||||
return false ;
|
||||
// recupero la superficie Bezier e il suo riferimento
|
||||
const ISurfBezier* pSbz = GetSurfBezier( pGeomDB->GetGeoObj( nSurfBzId)) ;
|
||||
// recupero la superficie trimesh
|
||||
const ISurfTriMesh* pStm = pSbz->GetAuxSurf() ;
|
||||
if ( pStm == nullptr)
|
||||
return false ;
|
||||
Frame3d frSbz ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nSurfBzId, frSbz))
|
||||
return false ;
|
||||
// recupero l'entità guida (punto, curva o superficie) e il suo riferimento
|
||||
const IGeoPoint3d* pGdePnt = nullptr ;
|
||||
const ICurve* pGdeCrv = nullptr ;
|
||||
const ISurfTriMesh* pGdeStm = nullptr ;
|
||||
pGdePnt = GetGeoPoint3d( pGeomDB->GetGeoObj( nGuideId)) ;
|
||||
if ( pGdePnt == nullptr) {
|
||||
pGdeCrv = GetCurve( pGeomDB->GetGeoObj( nGuideId)) ;
|
||||
if ( pGdeCrv == nullptr) {
|
||||
pGdeStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nGuideId)) ;
|
||||
if ( pGdeStm == nullptr)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
Frame3d frGde ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nGuideId, frGde))
|
||||
return false ;
|
||||
// recupero il riferimento del gruppo di destinazione
|
||||
nDestGrpId = AdjustId( nDestGrpId) ;
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nDestGrpId, frDest))
|
||||
return false ;
|
||||
// porto la curva nel riferimento della superficie
|
||||
CurveLocal CrvLoc( pCrv, frCrv, frSbz) ;
|
||||
if ( CrvLoc.Get() == nullptr)
|
||||
return false ;
|
||||
// eseguo l'opportuna proiezione dopo aver portato l'entità guida nel riferimento della superficie
|
||||
PNT5AXVECTOR vPt5ax ;
|
||||
if ( pGdePnt != nullptr) {
|
||||
PtrOwner<IGeoPoint3d> pGdeLoc( pGdePnt->Clone()) ;
|
||||
if ( pGdeLoc == nullptr)
|
||||
return false ;
|
||||
pGdeLoc->LocToLoc( frGde, frSbz) ;
|
||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, vPt5ax))
|
||||
return false ;
|
||||
}
|
||||
else if ( pGdeCrv != nullptr) {
|
||||
CurveLocal GdeLoc( pGdeCrv, frGde, frSbz) ;
|
||||
if ( GdeLoc.Get() == nullptr)
|
||||
return false ;
|
||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *GdeLoc.Get(), dLinTol, dMaxSegmLen, vPt5ax))
|
||||
return false ;
|
||||
}
|
||||
else { // pGdeStm != nullptr
|
||||
SurfLocal GdeLoc( pGdeStm, frGde, frSbz) ;
|
||||
const ISurfTriMesh* pGdeLoc = GetSurfTriMesh( GdeLoc.Get()) ;
|
||||
if ( pGdeLoc == nullptr)
|
||||
return false ;
|
||||
if ( ! ProjectCurveOnSurfTm( *CrvLoc.Get(), *pStm, *pGdeLoc, dLinTol, dMaxSegmLen, vPt5ax))
|
||||
return false ;
|
||||
}
|
||||
// inserisco la composita nel gruppo destinazione
|
||||
PtrOwner<ICurveComposite> pCompo ;
|
||||
for ( const auto& Pt5ax : vPt5ax) {
|
||||
if ( IsNull( pCompo)) {
|
||||
pCompo.Set( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCompo))
|
||||
return false ;
|
||||
pCompo->AddPoint( GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
||||
}
|
||||
else
|
||||
pCompo->AddLine( GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
||||
}
|
||||
int nCompoId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pCompo)) ;
|
||||
if ( nCompoId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// aggiungo i versori nel gruppo destinazione
|
||||
int nInd = 0 ;
|
||||
for ( const auto& Pt5ax : vPt5ax) {
|
||||
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
||||
if ( IsNull( pGeoVct))
|
||||
return false ;
|
||||
Vector3d vtDir = ( bDirFromGuide ? Pt5ax.vtDir2 : Pt5ax.vtDir) ;
|
||||
pGeoVct->Set( 10 * GetLocToLoc( vtDir, frSbz, frDest), GetLocToLoc( Pt5ax.ptP, frSbz, frDest)) ;
|
||||
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nDestGrpId, Release( pGeoVct)) ;
|
||||
if ( nNewId == GDB_ID_NULL)
|
||||
return false ;
|
||||
pGeomDB->SetInfo( nNewId, "Ind", nInd ++) ;
|
||||
pGeomDB->SetInfo( nNewId, "Par", Pt5ax.dPar) ;
|
||||
pGeomDB->SetInfo( nNewId, "Flag", Pt5ax.nFlag) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
ExeProjectCurveOnSurfBzExt( int nCurveId, int nSurfBzId, int nGuideId, int nDestGrpId,
|
||||
double dLinTol, double dMaxSegmLen, bool bDirFromGuide)
|
||||
{
|
||||
bool bOk = MyProjectCurveOnSurfBzExt( nCurveId, nSurfBzId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtProjectCurveOnSurfBzExt(" + ToString( nCurveId) + "," +
|
||||
ToString( nSurfBzId) + ",{" +
|
||||
ToString( nGuideId) + "}," +
|
||||
ToString( nDestGrpId) + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
ToString( dMaxSegmLen) + "," +
|
||||
( bDirFromGuide ? "true" : "false") + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeCurveGetVoronoi( int nId, int nDestGrpId, int nBound, int* pnCount)
|
||||
|
||||
@@ -1074,6 +1074,45 @@ ExeSurfTmSubtractProjectedFacesOnFace( int nSurfId, int nFaceInd, int nDestGrpId
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmSetFaceColor( int nId, int nFacet, int nColor)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie TriMesh
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
// recupero tutti i triangoli della faccia e imposto il flag opportuno per il colore
|
||||
INTVECTOR vTria ;
|
||||
bOk = bOk && pStm->GetAllTriaInFacet( nFacet, vTria) ;
|
||||
for ( const auto nT : vTria)
|
||||
pStm->SetTFlag( nT, nColor) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmSetFaceColor(" + ToString( nId) + "," +
|
||||
ToString( nFacet) + "," +
|
||||
ToString( nColor) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmGetTriaColor( int nId, int nTria, int& nColor)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie TriMesh
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
// recupero il colore del triangolo
|
||||
return ( bOk && pStm->GetTFlag( nTria, nColor)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmResetTwoColors( int nId)
|
||||
@@ -1118,6 +1157,20 @@ ExeSurfTmSetShowEdges( int nId, bool bShow)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmGetShowEdges( int nId, bool& bShow)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie trimesh
|
||||
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pStm != nullptr) ;
|
||||
// recupero lo stato di visualizzazione degli spigoli vivi
|
||||
bShow = ( bOk && pStm->GetShowEdges()) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
MySurfBzTrim( int nId, int nTrimmerId)
|
||||
@@ -1161,3 +1214,24 @@ ExeSurfBzTrim( int nId, int nCutterId)
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSurfTmSetSmoothAng( int nId, double dAngDeg)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la superficie trimseh da trimmare
|
||||
ISurfTriMesh* pSrfTm = GetSurfTriMesh( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pSrfTm == nullptr)
|
||||
return false ;
|
||||
pSrfTm->SetSmoothAngle( dAngDeg) ;
|
||||
ExeSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmSetSmoothAng(" + ToString( nId) + "," +
|
||||
ToString( dAngDeg) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "/EgtDev/Include/EgtIniFile.h"
|
||||
#include "/EgtDev/Include/EgtLogger.h"
|
||||
#include "/EgtDev/Include/EgtStringConverter.h"
|
||||
#include "/EgtDev/Include/EgtKeyCodes.h"
|
||||
#include "/EgtDev/Include/SELkLockId.h"
|
||||
#include "/EgtDev/Include/SELkKeyProc.h"
|
||||
#include <fstream>
|
||||
@@ -352,6 +353,34 @@ ExeGetNetHwKey( void)
|
||||
return s_bNetHwKey ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeVerifyKeyOption( int nOptInd)
|
||||
{
|
||||
// recupero le opzioni abilitate
|
||||
unsigned int nOpt1, nOpt2 ;
|
||||
int nOptExpDays ;
|
||||
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
if ( ! ExeGetNetHwKey())
|
||||
nRet = GetKeyOptions( ExeGetKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
// verifico validità chiave con licenza
|
||||
if ( nRet != KEY_OK || nOptExpDays < GetCurrDay())
|
||||
return false ;
|
||||
// verifico le opzioni (nOptInd = 100 -> bit 0 di Opt1 ... = 200 -> bit 0 di Opt2 ... = 231 -> bit 31 di Opt2)
|
||||
if ( nOptInd >= 100 && nOptInd <= 131) {
|
||||
unsigned int nOptVal = ( 1 << ( nOptInd - 100)) ;
|
||||
return ( ( nOpt1 & nOptVal) != 0) ;
|
||||
}
|
||||
else if ( nOptInd >= 200 && nOptInd <= 231) {
|
||||
unsigned int nOptVal = ( 1 << ( nOptInd - 200)) ;
|
||||
return ( ( nOpt2 & nOptVal) != 0) ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetFont( const string& sNfeFontDir, const string& sDefaultFont)
|
||||
|
||||
Binary file not shown.
@@ -1091,6 +1091,26 @@ LuaCreateCirclesAlongCurve( lua_State* L)
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateCurveBezierForm( lua_State* L)
|
||||
{
|
||||
// 2 parametri : ParentId, nCrvId
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nCrvId ;
|
||||
LuaCheckParam( L, 2, nCrvId)
|
||||
|
||||
// creo la versione bezier della curva
|
||||
int nId = ExeCreateCurveBezierForm( nParentId, nCrvId) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetParam( L, nId) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
|
||||
@@ -1135,5 +1155,6 @@ LuaInstallGdbCreateCurve( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromApothem", LuaCreatePolygonFromApothem) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPolygonFromSide", LuaCreatePolygonFromSide) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCirclesAlongCurve", LuaCreateCirclesAlongCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveBezierForm", LuaCreateCurveBezierForm) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -140,6 +140,37 @@ LuaCreateVolZmapFromSurfTm( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaUpdateVolZmapByAddingSurfTm( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nVolZmapId, StmId,
|
||||
int nVolZmapId ;
|
||||
LuaCheckParam( L, 1, nVolZmapId) ;
|
||||
int nStmId ;
|
||||
LuaCheckParam( L, 2, nStmId) ;
|
||||
LuaClearStack( L) ;
|
||||
bool bOk = ExeUpdateVolZmapByAddingSurfTm( nVolZmapId, nStmId) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaUniformVolZmap( lua_State* L)
|
||||
{
|
||||
// 1 o 2 parametri : nVolZmapId [, dToler]
|
||||
int nVolZmapId ;
|
||||
LuaCheckParam( L, 1, nVolZmapId) ;
|
||||
double dToler = EPS_SMALL ;
|
||||
LuaGetParam( L, 2, dToler) ;
|
||||
LuaClearStack( L) ;
|
||||
bool bOk = ExeUniformVolZmap( nVolZmapId, dToler) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbCreateVol( LuaMgr& luaMgr)
|
||||
@@ -149,5 +180,7 @@ LuaInstallGdbCreateVol( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapEmpty", LuaCreateVolZmapEmpty) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapByRegionExtrusion", LuaCreateVolZmapByRegionExtrusion) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVolZmapFromSurfTm", LuaCreateVolZmapFromSurfTm) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUpdateVolZmapByAddingSurfTm", LuaUpdateVolZmapByAddingSurfTm ) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtUniformZmap", LuaUniformVolZmap) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -443,6 +443,42 @@ LuaSurfTmGetFacetBBoxRef( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmGetFacetOutlineInfo( lua_State* L)
|
||||
{
|
||||
// 2 o 3 parametri : Id, nFacet [, nRefId]
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nFacet ;
|
||||
LuaCheckParam( L, 2, nFacet)
|
||||
int nRefId = nId ;
|
||||
LuaGetParam( L, 3, nRefId) ;
|
||||
LuaClearStack( L) ;
|
||||
// recupero le informazioni
|
||||
int nStatus ;
|
||||
BOOLVECTOR vbOpen ;
|
||||
INTVECTOR vnAdj ;
|
||||
VCT3DVECTOR vvtNorm ;
|
||||
DBLVECTOR vdElev ;
|
||||
DBLVECTOR vdLen ;
|
||||
bool bOk = ExeSurfTmGetFacetOutlineInfo( nId, nFacet, nRefId, nStatus, vbOpen, vnAdj, vdLen, vvtNorm, vdElev) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, nStatus) ;
|
||||
LuaSetParam( L, vbOpen) ;
|
||||
LuaSetParam( L, vnAdj) ;
|
||||
LuaSetParam( L, vdLen) ;
|
||||
LuaSetParam( L, vvtNorm) ;
|
||||
LuaSetParam( L, vdElev) ;
|
||||
return 6 ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmFacetAdjacencies( lua_State* L)
|
||||
@@ -1106,6 +1142,7 @@ LuaInstallGdbGetSurf( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBox", LuaSurfTmGetFacetBBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxGlob", LuaSurfTmGetFacetBBoxGlob) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetBBoxRef", LuaSurfTmGetFacetBBoxRef) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetFacetOutlineInfo", LuaSurfTmGetFacetOutlineInfo) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetAdjacencies", LuaSurfTmFacetAdjacencies) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestEndPoint", LuaSurfTmFacetNearestEndPoint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmFacetNearestMidPoint", LuaSurfTmFacetNearestMidPoint) ;
|
||||
|
||||
@@ -1001,6 +1001,58 @@ LuaProjectCurveOnSurfTmExt( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaProjectCurveOnSurfBz( lua_State* L)
|
||||
{
|
||||
// 4, 5, 6 o 7 parametri : nCurveId, nSurfBzId, vtDir, nDestGrpId [, dLinTol [, dMaxSegmLen] [, nRefType]]
|
||||
int nCurveId ;
|
||||
LuaCheckParam( L, 1, nCurveId)
|
||||
int nSurfBzId ;
|
||||
LuaCheckParam( L, 2, nSurfBzId)
|
||||
Vector3d vtDir ;
|
||||
LuaCheckParam( L, 3, vtDir)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 4, nDestGrpId)
|
||||
double dLinTol = 0.01 ;
|
||||
double dMaxSegmLen = INFINITO ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 5, dLinTol) &&
|
||||
LuaGetParam( L, 6, dMaxSegmLen))
|
||||
LuaGetParam( L, 7, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// proietto la curva su una trimesh secondo la direzione data
|
||||
bool bOk = ExeProjectCurveOnSurfBz( nCurveId, nSurfBzId, vtDir, nDestGrpId, dLinTol, dMaxSegmLen, nRefType) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaProjectCurveOnSurfBzExt( lua_State* L)
|
||||
{
|
||||
// 4, 5, 6 o 7 parametri : nCurveId, nSurfBzId, nGuideId, nDestGrpId [, dLinTol [, dMaxSegmLen] [, bDirFromGuide]]
|
||||
int nCurveId ;
|
||||
LuaCheckParam( L, 1, nCurveId)
|
||||
int nSurfBzId ;
|
||||
LuaCheckParam( L, 2, nSurfBzId)
|
||||
int nGuideId ;
|
||||
LuaCheckParam( L, 3, nGuideId)
|
||||
int nDestGrpId ;
|
||||
LuaCheckParam( L, 4, nDestGrpId)
|
||||
double dLinTol = 0.01 ;
|
||||
double dMaxSegmLen = INFINITO ;
|
||||
bool bDirFromGuide = false ;
|
||||
if ( LuaGetParam( L, 5, dLinTol) &&
|
||||
LuaGetParam( L, 6, dMaxSegmLen))
|
||||
LuaGetParam( L, 7, bDirFromGuide) ;
|
||||
LuaClearStack( L) ;
|
||||
// proietto la curva su una trimesh secondo la direzione data
|
||||
bool bOk = ExeProjectCurveOnSurfBzExt( nCurveId, nSurfBzId, nGuideId, nDestGrpId, dLinTol, dMaxSegmLen, bDirFromGuide) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCurveGetVoronoi( lua_State* L)
|
||||
@@ -1137,5 +1189,7 @@ LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetVoronoi", LuaCurveGetVoronoi) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveMedialAxisAdv", LuaCurveMedialAxisAdv) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCurveGetFatCurve", LuaCurveGetFatCurve) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfBz", LuaProjectCurveOnSurfBz) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnSurfBzExt", LuaProjectCurveOnSurfBzExt) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -479,6 +479,44 @@ LuaSurfTmSubtractProjectedFacesOnFace( lua_State* L)
|
||||
return 4 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmSetFaceColor( lua_State* L)
|
||||
{
|
||||
// 3 parametri : Id, nFacet, nColor
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nFacet ;
|
||||
LuaCheckParam( L, 2, nFacet)
|
||||
int nColor ;
|
||||
LuaCheckParam( L, 3, nColor)
|
||||
LuaClearStack( L) ;
|
||||
// imposto il colore alla faccia della superficie TM
|
||||
bool bOk = ExeSurfTmSetFaceColor( nId, nFacet, nColor) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmGetTriaColor( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, nTria
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
int nTria ;
|
||||
LuaCheckParam( L, 2, nTria)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il flag di colore del triangolo della superficie TM
|
||||
int nColor ;
|
||||
bool bOk = ExeSurfTmGetTriaColor( nId, nTria, nColor) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, nColor) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmResetTwoColors( lua_State* L)
|
||||
@@ -510,6 +548,24 @@ LuaSurfTmSetShowEdges( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmGetShowEdges( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il flag di visualizzazione degli spigoli vivi della superficie TM
|
||||
bool bShow ;
|
||||
bool bOk = ExeSurfTmGetShowEdges( nId, bShow) ;
|
||||
if ( bOk)
|
||||
LuaSetParam( L, bShow) ;
|
||||
else
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfBzTrim( lua_State* L)
|
||||
@@ -526,6 +582,22 @@ LuaSurfBzTrim( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaSurfTmSetSmoothAng( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nId, nCutterId
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
double dAngDeg ;
|
||||
LuaCheckParam( L, 2, dAngDeg)
|
||||
LuaClearStack( L) ;
|
||||
// aggiorno lo smooth angle della superficie
|
||||
bool bOk = ExeSurfTmSetSmoothAng( nId, dAngDeg) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
||||
@@ -554,8 +626,12 @@ LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSplit", LuaSurfTmSplit) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmCut", LuaSurfTmCut) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSubtractProjectedFacesOnFace", LuaSurfTmSubtractProjectedFacesOnFace) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetFaceColor", LuaSurfTmSetFaceColor) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetTriaColor", LuaSurfTmGetTriaColor) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmResetTwoColors", LuaSurfTmResetTwoColors) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetShowEdges", LuaSurfTmSetShowEdges) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmGetShowEdges", LuaSurfTmGetShowEdges) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfBzTrim", LuaSurfBzTrim) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtSurfTmSetSmoothAng", LuaSurfTmSetSmoothAng) ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -107,6 +107,24 @@ LuaPause( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetKeyPressed( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nKeyCode
|
||||
int nKeyCode ;
|
||||
LuaCheckParam( L, 1, nKeyCode)
|
||||
LuaClearStack( L) ;
|
||||
// se abilitata UI, controllo se il tasto indicato è premuto
|
||||
bool bPressed = false ;
|
||||
if ( ExeGetEnableUI()) {
|
||||
bPressed = (( GetAsyncKeyState( nKeyCode) & 0x8000) != 0) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bPressed) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaStartCounter( lua_State* L)
|
||||
@@ -1065,6 +1083,20 @@ LuaGetMsg( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaVerifyKeyOption( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nOptInd
|
||||
int nOptInd ;
|
||||
LuaCheckParam( L, 1, nOptInd)
|
||||
LuaClearStack( L) ;
|
||||
// verifico l'abilitazione dell'opzione (da chiave + licenza)
|
||||
bool bOk = ExeVerifyKeyOption( nOptInd) ;
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaWinExec( lua_State* L)
|
||||
@@ -1322,6 +1354,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "print", MyPrint) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtEvalNumExpr", LuaEvalNumExpr) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPause", LuaPause) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetKeyPressed", LuaGetKeyPressed) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtStartCounter", LuaStartCounter) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtStopCounter", LuaStopCounter) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtNumToString", LuaNumToString) ;
|
||||
@@ -1365,6 +1398,7 @@ LuaInstallGeneral( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtIs64bit", LuaIs64bit) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtGetLanguage", LuaGetLanguage) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtMsg", LuaGetMsg) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyKeyOption", LuaVerifyKeyOption) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtWinExec", LuaWinExec) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseExe", LuaCloseExe) ;
|
||||
|
||||
Reference in New Issue
Block a user