EgtInterface 1.6a4 :

- completamento modifiche per registrazione comandi in lua e per gestione RefType e RefId.
This commit is contained in:
Dario Sassi
2015-01-26 07:53:04 +00:00
parent 4e5a81c493
commit a45c3fca8a
25 changed files with 1574 additions and 1254 deletions
+80 -66
View File
@@ -24,90 +24,104 @@ ILogger* GetCmdLogger( void) ;
bool IsCmdLog( void) ;
//--------------------------- General ----------------------------------------
bool __stdcall EgtGetVersionInfo( std::string& sVer, const char* szNewLine) ;
bool EgtGetVersionInfo( std::string& sVer, const char* szNewLine) ;
//--------------------------- GeomDB -----------------------------------------
bool __stdcall EgtSetGridFrame( const Frame3d& frFrame) ;
bool __stdcall EgtGetGridFrame( int nRefId, Frame3d& frFrame) ;
bool __stdcall EgtGetGridVersZ( int nRefId, Vector3d& vtVersZ) ;
bool __stdcall EgtOpenFile( const std::string& sFilePath) ;
bool __stdcall EgtImportFile( const std::string& sFilePath) ;
bool __stdcall EgtSaveFile( const std::string& sFilePath, int nFlag) ;
bool EgtSetGridFrame( const Frame3d& frFrame) ;
bool EgtGetGridFrame( int nRefId, Frame3d& frFrame) ;
bool EgtGetGridVersZ( int nRefId, Vector3d& vtVersZ) ;
bool EgtOpenFile( const std::string& sFilePath) ;
bool EgtImportFile( const std::string& sFilePath) ;
bool EgtSaveFile( const std::string& sFilePath, int nFlag) ;
//--------------------------- GeomDBCreate -----------------------------------
int __stdcall EgtCreateText( int nParentId, const Point3d& ptP, double dAngRotDeg,
const std::string& sText, double dH, int nRefType) ;
int __stdcall EgtCreateTextEx( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
const std::string& sText, const std::string& sFont, bool bItalic, double dH, int nRefType) ;
int __stdcall EgtCreateTextAdv( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
const std::string& sText, const std::string& sFont,
int nW, bool bItalic, double dH, double dRat, double dAddAdv, int nInsPos, int nRefType) ;
int EgtCreateText( int nParentId, const Point3d& ptP, double dAngRotDeg,
const std::string& sText, double dH, int nRefType) ;
int EgtCreateTextEx( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
const std::string& sText, const std::string& sFont, bool bItalic, double dH, int nRefType) ;
int EgtCreateTextAdv( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
const std::string& sText, const std::string& sFont,
int nW, bool bItalic, double dH, double dRat, double dAddAdv, int nInsPos, int nRefType) ;
//--------------------------- GeomDBCreateCurve ------------------------------
int __stdcall EgtCreateCurveBezier( int nParentId, int nDegree, const PNTVECTOR& vPnt) ;
int __stdcall EgtCreateCurveBezierRational( int nParentId, int nDegree, const PNTUVECTOR& vPntW) ;
int __stdcall EgtCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase) ;
int __stdcall EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, const Point3d& ptNear, bool bErase) ;
int __stdcall EgtCreateCurveCompoFromPoints( int nParentId, const PolyLine& PL) ;
int __stdcall EgtCreateCurveCompoFromPointBulges( int nParentId, const PolyArc& PA) ;
bool __stdcall GetPolyLineFromCurve( int nId, const Frame3d& frDest, double dLinTol, PolyLine& PL) ;
bool __stdcall GetPolyArcFromCurve( int nId, const Frame3d& frDest, double dLinTol, PolyArc& PA) ;
int EgtCreateCurveBezier( int nParentId, int nDegree, const PNTVECTOR& vPnt, int nRefType) ;
int EgtCreateCurveBezierRational( int nParentId, int nDegree, const PNTUVECTOR& vPntW, int nRefType) ;
int EgtCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase) ;
int EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds,
const Point3d& ptNear, bool bErase, int nRefType) ;
int EgtCreateCurveCompoFromPoints( int nParentId, const PolyLine& PL, int nRefType) ;
int EgtCreateCurveCompoFromPointBulges( int nParentId, const PolyArc& PA, int nRefType) ;
bool GetPolyLineFromCurve( int nId, const Frame3d& frDest, double dLinTol, PolyLine& PL) ;
bool GetPolyArcFromCurve( int nId, const Frame3d& frDest, double dLinTol, PolyArc& PA) ;
//--------------------------- GdbModify --------------------------------------
BOOL __stdcall EgtModifyText( int nId, const std::string& sNewText) ;
BOOL __stdcall EgtChangeTextFont( int nId, const std::string& sNewFont) ;
bool EgtChangeGroupFrame( int nId, const Frame3d& frNewRef, int nRefType) ;
bool EgtSurfTmDoSewing( const INTVECTOR& vIds, bool bErase) ;
bool EgtModifyText( int nId, const std::string& sNewText) ;
bool EgtChangeTextFont( int nId, const std::string& sNewFont) ;
//--------------------------- GdbModifyCurve ---------------------------------
bool EgtModifyCurveExtrusion( INTVECTOR& vIds, const Vector3d& vtExtr, int nRefType) ;
//--------------------------- GdbObjects -------------------------------------
int __stdcall EgtGetFirstNameInGroup( int nGroupId, const std::string& sName) ;
int __stdcall EgtGetNextName( int nId, const std::string& sName) ;
int EgtGetFirstNameInGroup( int nGroupId, const std::string& sName) ;
int EgtGetNextName( int nId, const std::string& sName) ;
//--------------------------- GdbObjAttribs ----------------------------------
bool __stdcall EgtSetName( int nId, const std::string& sName) ;
bool __stdcall EgtGetName( int nId, std::string& sName) ;
bool __stdcall EgtSetInfo( int nId, const std::string& sKey, const std::string& sInfo) ;
bool __stdcall EgtSetInfo( int nId, const std::string& sKey, int nInfo) ;
bool __stdcall EgtGetInfo( int nId, const std::string& sKey, std::string& sInfo) ;
bool __stdcall EgtGetInfo( int nId, const std::string& sKey, int& nInfo) ;
bool __stdcall EgtExistsInfo( int nId, const std::string& sKey) ;
bool __stdcall EgtRemoveInfo( int nId, const std::string& sKey) ;
bool EgtSetName( int nId, const std::string& sName) ;
bool EgtGetName( int nId, std::string& sName) ;
bool EgtSetInfo( int nId, const std::string& sKey, const std::string& sInfo) ;
bool EgtSetInfo( int nId, const std::string& sKey, int nInfo) ;
bool EgtGetInfo( int nId, const std::string& sKey, std::string& sInfo) ;
bool EgtGetInfo( int nId, const std::string& sKey, int& nInfo) ;
bool EgtExistsInfo( int nId, const std::string& sKey) ;
bool EgtRemoveInfo( int nId, const std::string& sKey) ;
//--------------------------- GeoSnap ----------------------------------------
bool __stdcall EgtStartPoint( int nId, int nRefId, Point3d& ptP) ;
bool __stdcall EgtEndPoint( int nId, int nRefId, Point3d& ptP) ;
bool __stdcall EgtMidPoint( int nId, int nRefId, Point3d& ptP) ;
bool __stdcall EgtCenterPoint( int nId, int nRefId, Point3d& ptP) ;
bool __stdcall EgtAtParamPoint( int nId, double dU, int nRefId, Point3d& ptP) ;
bool __stdcall EgtNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP) ;
bool __stdcall EgtIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Point3d& ptP) ;
bool __stdcall EgtStartVector( int nId, int nRefId, Vector3d& vtV) ;
bool __stdcall EgtEndVector( int nId, int nRefId, Vector3d& vtV) ;
bool __stdcall EgtMidVector( int nId, int nRefId, Vector3d& vtV) ;
bool __stdcall EgtAtParamVector( int nId, double dU, int nSide, int nRefId, Vector3d& vtV) ;
bool __stdcall EgtFrame( int nId, int nRefId, Frame3d& frFrame) ;
bool __stdcall EgtCurveExtrusion( int nId, int nRefId, Vector3d& vtExtr) ;
bool EgtStartPoint( int nId, int nRefId, Point3d& ptP) ;
bool EgtEndPoint( int nId, int nRefId, Point3d& ptP) ;
bool EgtMidPoint( int nId, int nRefId, Point3d& ptP) ;
bool EgtCenterPoint( int nId, int nRefId, Point3d& ptP) ;
bool EgtAtParamPoint( int nId, double dU, int nRefId, Point3d& ptP) ;
bool EgtNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP) ;
bool EgtIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Point3d& ptP) ;
bool EgtStartVector( int nId, int nRefId, Vector3d& vtV) ;
bool EgtEndVector( int nId, int nRefId, Vector3d& vtV) ;
bool EgtMidVector( int nId, int nRefId, Vector3d& vtV) ;
bool EgtAtParamVector( int nId, double dU, int nSide, int nRefId, Vector3d& vtV) ;
bool EgtFrame( int nId, int nRefId, Frame3d& frFrame) ;
bool EgtCurveExtrusion( int nId, int nRefId, Vector3d& vtExtr) ;
// EgtCurveThickness vedi EinAPI.h
bool __stdcall EgtCurveArcNormVersor( int nId, int nRefId, Vector3d& vtNorm) ;
bool __stdcall EgtExtTextNormVersor( int nId, int nRefId, Vector3d& vtNorm) ;
bool __stdcall EgtPointToIdGlob( Point3d& ptP, int nId) ;
bool __stdcall EgtPointToIdLoc( Point3d& ptP, int nId) ;
bool __stdcall EgtVectorToIdGlob( Vector3d& vtV, int nId) ;
bool __stdcall EgtVectorToIdLoc( Vector3d& vtV, int nId) ;
bool EgtCurveArcNormVersor( int nId, int nRefId, Vector3d& vtNorm) ;
bool EgtExtTextNormVersor( int nId, int nRefId, Vector3d& vtNorm) ;
bool EgtPointToIdGlob( Point3d& ptP, int nId) ;
bool EgtPointToIdLoc( Point3d& ptP, int nId) ;
bool EgtVectorToIdGlob( Vector3d& vtV, int nId) ;
bool EgtVectorToIdLoc( Vector3d& vtV, int nId) ;
//--------------------------- GeoTransform -----------------------------------
bool EgtMove( INTVECTOR& vIds, const Vector3d& vtMove, int nRefType) ;
bool EgtRotate( INTVECTOR& vIds, const Point3d& ptAx, const Vector3d& vtAx, double dAngRotDeg, int nRefType) ;
bool EgtScale( INTVECTOR& vIds, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ, int nRefType) ;
bool EgtMirror( INTVECTOR& vIds, const Point3d& ptP, const Vector3d& vtN, int nRefType) ;
bool EgtShear( INTVECTOR& vIds, const Point3d& ptP, const Vector3d& vtN,
const Vector3d& vtDir, double dCoeff, int nRefType) ;
//--------------------------- Scene ------------------------------------------
bool __stdcall EgtSetBackground( Color TopCol, Color BottomCol, bool bRedraw) ;
bool __stdcall EgtSetMarkAttribs( Color MarkCol) ;
bool __stdcall EgtSetSelSurfAttribs( Color SelSurfCol) ;
bool __stdcall EgtSetGeoLineAttribs( Color GlCol) ;
bool __stdcall EgtSetGeoTriaAttribs( Color GtCol) ;
bool __stdcall EgtSetWinRectAttribs( bool bOutline, Color WrCol) ;
bool EgtSetBackground( Color TopCol, Color BottomCol, bool bRedraw) ;
bool EgtSetMarkAttribs( Color MarkCol) ;
bool EgtSetSelSurfAttribs( Color SelSurfCol) ;
bool EgtSetGeoLineAttribs( Color GlCol) ;
bool EgtSetGeoTriaAttribs( Color GtCol) ;
bool EgtSetWinRectAttribs( bool bOutline, Color WrCol) ;
//--------------------------- Exchange ---------------------------------------
int __stdcall EgtGetFileType( const std::string& sFilePath) ;
bool __stdcall EgtImportDxf( const std::string& sFilePath) ;
bool __stdcall EgtImportStl( const std::string& sFilePath) ;
bool __stdcall EgtImportCnc( const std::string& sFilePath) ;
bool __stdcall EgtExportDxf( int nId, const std::string& sFilePath) ;
bool __stdcall EgtExportStl( int nId, const std::string& sFilePath) ;
int EgtGetFileType( const std::string& sFilePath) ;
bool EgtImportDxf( const std::string& sFilePath) ;
bool EgtImportStl( const std::string& sFilePath) ;
bool EgtImportCnc( const std::string& sFilePath) ;
bool EgtExportDxf( int nId, const std::string& sFilePath) ;
bool EgtExportStl( int nId, const std::string& sFilePath) ;
//--------------------------- TscExec ----------------------------------------
bool __stdcall EgtTscExecFile( const std::string& sFilePath) ;
bool EgtTscExecFile( const std::string& sFilePath) ;
+6 -6
View File
@@ -36,7 +36,7 @@ __stdcall EgtGetFileType( const wchar_t* wsFilePath)
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFileType( const string& sFilePath)
EgtGetFileType( const string& sFilePath)
{
// divido in nome e direttorio
string sFileDir, sFileName ;
@@ -78,7 +78,7 @@ __stdcall EgtImportDxf( const wchar_t* wsFilePath)
//-----------------------------------------------------------------------------
bool
__stdcall EgtImportDxf( const string& sFilePath)
EgtImportDxf( const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -101,7 +101,7 @@ __stdcall EgtImportStl( const wchar_t* wsFilePath)
//-----------------------------------------------------------------------------
bool
__stdcall EgtImportStl( const string& sFilePath)
EgtImportStl( const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -125,7 +125,7 @@ __stdcall EgtImportCnc( const wchar_t* wsFilePath)
//-----------------------------------------------------------------------------
bool
__stdcall EgtImportCnc( const string& sFilePath)
EgtImportCnc( const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -148,7 +148,7 @@ __stdcall EgtExportDxf( int nId, const wchar_t* wsFilePath)
//-----------------------------------------------------------------------------
bool
__stdcall EgtExportDxf( int nId, const string& sFilePath)
EgtExportDxf( int nId, const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -169,7 +169,7 @@ __stdcall EgtExportStl( int nId, const wchar_t* wsFilePath)
//-----------------------------------------------------------------------------
bool
__stdcall EgtExportStl( int nId, const string& sFilePath)
EgtExportStl( int nId, const string& sFilePath)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
+22 -30
View File
@@ -35,37 +35,29 @@ __stdcall EgtCreateGroup( int nParentId, const double ptOrig[3],
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
bool bOk = true ;
// porto in locale l'origine e i versori
Point3d ptOrigL( ptOrig) ;
Vector3d vtXL( vX) ;
Vector3d vtYL( vY) ;
Vector3d vtZL( vZ) ;
// costruisco il riferimento
Frame3d frFrameL ;
bOk = bOk && frFrameL.Set( ptOrig, vX, vY, vZ) ;
// lo porto in locale
if ( nRefType != RTY_LOC) {
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
if ( nRefType == RTY_GLOB) {
ptOrigL.ToLoc( frLoc) ;
vtXL.ToLoc( frLoc) ;
vtYL.ToLoc( frLoc) ;
vtZL.ToLoc( frLoc) ;
}
else /* RTY_GRID */ {
ptOrigL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
vtXL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
vtYL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
vtZL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
if ( nRefType == RTY_GLOB)
frFrameL.ToLoc( frLoc) ;
else /* RTY_GRID */
frFrameL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// costruisco il riferimento
Frame3d frFrame ;
bOk = bOk && frFrame.Set( ptOrigL, vtXL, vtYL, vtZL) ;
// creo il gruppo
int nId = ( bOk ? pGeomDB->AddGroup( GDB_ID_NULL, nParentId, frFrame) : GDB_ID_NULL) ;
int nId = ( bOk ? pGeomDB->AddGroup( GDB_ID_NULL, nParentId, frFrameL) : GDB_ID_NULL) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua ;
if ( AreSameFrame( frFrame, GLOB_FRM))
sLua = "EgtGroup(" + ToString( nParentId) + ")" +
if ( AreSamePointApprox( ORIG, ptOrig) &&
AreSameVectorExact( X_AX, vX) &&
AreSameVectorExact( Y_AX, vY) &&
AreSameVectorExact( Z_AX, vZ))
sLua = "EgtGroup(" + ToString( nParentId) + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
else
sLua = "EgtGroup(" + ToString( nParentId) + ",{{" +
@@ -228,8 +220,8 @@ __stdcall EgtCreateText( int nParentId, const double ptP[3], double dAngRotDeg,
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateText( int nParentId, const Point3d& ptP, double dAngRotDeg,
const string& sText, double dH, int nRefType)
EgtCreateText( int nParentId, const Point3d& ptP, double dAngRotDeg,
const string& sText, double dH, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -284,8 +276,8 @@ __stdcall EgtCreateTextEx( int nParentId, const double ptP[3], const double vtN[
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateTextEx( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
const string& sText, const string& sFont, bool bItalic, double dH, int nRefType)
EgtCreateTextEx( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
const string& sText, const string& sFont, bool bItalic, double dH, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -345,9 +337,9 @@ __stdcall EgtCreateTextAdv( int nParentId, const double ptP[3], const double vtN
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateTextAdv( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
const string& sText, const string& sFont,
int nW, bool bItalic, double dH, double dRat, double dAddAdv, int nInsPos, int nRefType)
EgtCreateTextAdv( int nParentId, const Point3d& ptP, const Vector3d& vtN, const Vector3d& vtD,
const string& sText, const string& sFont,
int nW, bool bItalic, double dH, double dRat, double dAddAdv, int nInsPos, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
+345 -152
View File
@@ -37,19 +37,21 @@
using namespace std ;
//-------------------------------------------------------------------------------
static ICurveLine* __stdcall CreateLinePointTgCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF) ;
static ICurveLine* __stdcall CreateLinePointPerpCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF) ;
static ICurveLine* __stdcall CreateLinePointMinDistCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF) ;
static ICurveLine* __stdcall CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF) ;
static ICurveLine* __stdcall CreateLinePerpTwoCurves( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF) ;
static ICurveLine* __stdcall CreateLineTgCurvePerpCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF) ;
static bool __stdcall SetExtrusionFromGridVersZ( IGeomDB* pGeomDB, int nParentId, ICurve* pCurve) ;
static ICurveLine* CreateLinePointTgCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF) ;
static ICurveLine* CreateLinePointPerpCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF) ;
static ICurveLine* CreateLinePointMinDistCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF) ;
static ICurveLine* CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF) ;
static ICurveLine* CreateLinePerpTwoCurves( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF) ;
static ICurveLine* CreateLineTgCurvePerpCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF) ;
static bool SetExtrusionFromGridVersZ( IGeomDB* pGeomDB, int nParentId, ICurve* pCurve) ;
static Vector3d CalcExtrusion( IGeomDB* pGeomDB, int nParentId, int nRefType) ;
//-------------------------------------------------------------------------------
int
@@ -238,8 +240,8 @@ __stdcall EgtCreateCurveLineEx( int nParentId, const double ptIni[3], int nSepI,
//-------------------------------------------------------------------------------
ICurveLine*
__stdcall CreateLinePointTgCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF)
CreateLinePointTgCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF)
{
// verifica preliminare Id curva
if ( nIdF == GDB_ID_NULL)
@@ -275,8 +277,8 @@ __stdcall CreateLinePointTgCurve( IGeomDB* pGeomDB, int nParentId,
//-------------------------------------------------------------------------------
ICurveLine*
__stdcall CreateLinePointPerpCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF)
CreateLinePointPerpCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF)
{
// verifica preliminare Id curva
if ( nIdF == GDB_ID_NULL)
@@ -312,8 +314,8 @@ __stdcall CreateLinePointPerpCurve( IGeomDB* pGeomDB, int nParentId,
//-------------------------------------------------------------------------------
ICurveLine*
__stdcall CreateLinePointMinDistCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF)
CreateLinePointMinDistCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, const Point3d& ptFin, int nIdF)
{
// verifica preliminare Id curva
if ( nIdF == GDB_ID_NULL)
@@ -349,8 +351,8 @@ __stdcall CreateLinePointMinDistCurve( IGeomDB* pGeomDB, int nParentId,
//-------------------------------------------------------------------------------
ICurveLine*
__stdcall CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF)
CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF)
{
// verifica preliminare Id curve
if ( nIdF == GDB_ID_NULL || nIdI == GDB_ID_NULL)
@@ -399,8 +401,8 @@ __stdcall CreateLineTgTwoCurves( IGeomDB* pGeomDB, int nParentId,
//-------------------------------------------------------------------------------
ICurveLine*
__stdcall CreateLinePerpTwoCurves( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF)
CreateLinePerpTwoCurves( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF)
{
// verifica preliminare Id curve
if ( nIdI == GDB_ID_NULL || nIdF == GDB_ID_NULL)
@@ -449,8 +451,8 @@ __stdcall CreateLinePerpTwoCurves( IGeomDB* pGeomDB, int nParentId,
//-------------------------------------------------------------------------------
ICurveLine*
__stdcall CreateLineTgCurvePerpCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF)
CreateLineTgCurvePerpCurve( IGeomDB* pGeomDB, int nParentId,
const Point3d& ptIni, int nIdI, const Point3d& ptFin, int nIdF)
{
// verifica preliminare Id curve
if ( nIdI == GDB_ID_NULL || nIdF == GDB_ID_NULL)
@@ -1029,88 +1031,144 @@ __stdcall EgtCreateCurveArc2PVN( int nParentId, const double ptStart[3], const d
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveBezier( int nParentId, int nDegree, const double ptCtrls[])
__stdcall EgtCreateCurveBezier( int nParentId, int nDegree, const double ptCtrls[], int nRefType)
{
PNTVECTOR vPnt ;
vPnt.reserve( nDegree + 1) ;
for ( int i = 0 ; i <= nDegree ; ++i) {
vPnt.push_back( Point3d( ptCtrls[3*i], ptCtrls[3*i+1], ptCtrls[3*i+2])) ;
}
return EgtCreateCurveBezier( nParentId, nDegree, vPnt) ;
return EgtCreateCurveBezier( nParentId, nDegree, vPnt, nRefType) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveBezier( int nParentId, int nDegree, const PNTVECTOR& vPnt)
EgtCreateCurveBezier( int nParentId, int nDegree, const PNTVECTOR& vPnt, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// il numero dei punti deve essere pari al grado + 1
if ( vPnt.size() != nDegree + 1)
return GDB_ID_NULL ;
bool bOk = true ;
// il numero dei punti deve essere pari al grado + 1
bOk = bOk && ( vPnt.size() == nDegree + 1) ;
// recupero il riferimento di immersione della curva
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// creo la curva di Bezier
PtrOwner<ICurveBezier> pCrvBez( CreateCurveBezier()) ;
if ( IsNull( pCrvBez))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvBez) ;
// inizializzo la curva di Bezier
if ( ! pCrvBez->Init( nDegree, false))
return GDB_ID_NULL ;
bOk = bOk && pCrvBez->Init( nDegree, false) ;
// setto i punti di controllo
for ( int i = 0 ; i <= nDegree ; ++ i) {
if ( ! pCrvBez->SetControlPoint( i, vPnt[i]))
return GDB_ID_NULL ;
for ( int i = 0 ; i <= nDegree && bOk ; ++ i) {
// eventuale trasformazione del punto nel riferimento locale
Point3d ptCtrl = vPnt[i] ;
if ( nRefType == RTY_GLOB)
ptCtrl.ToLoc( frLoc) ;
else if ( nRefType == RTY_GRID)
ptCtrl.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
// inserimento del punto di controllo
if ( ! pCrvBez->SetControlPoint( i, ptCtrl))
bOk = false ;
}
// se curva nulla (ovvero ridotta a punto), errore
if ( pCrvBez->IsAPoint())
return GDB_ID_NULL ;
bOk = bOk && ! pCrvBez->IsAPoint() ;
// assegno il versore estrusione
if ( ! SetExtrusionFromGridVersZ( pGeomDB, nParentId, Get( pCrvBez)))
return GDB_ID_NULL ;
Vector3d vtExtrL = Z_AX ;
if ( nRefType == RTY_GLOB)
vtExtrL.ToLoc( frLoc) ;
else if ( nRefType == RTY_GRID)
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
pCrvBez->SetExtrusion( vtExtrL) ;
// inserisco la curva nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) : GDB_ID_NULL) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sPC ;
for ( size_t i = 0 ; i < vPnt.size() ; ++ i) {
if ( i > 0)
sPC += "," ;
sPC += "{" + ToString( vPnt[i]) + "}" ;
}
string sLua = "EgtCurveBezier(" + ToString( nParentId) + "," +
ToString( nDegree) + ",{" +
sPC + "}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveBezierRational( int nParentId, int nDegree, const double ptCtrlWs[])
__stdcall EgtCreateCurveBezierRational( int nParentId, int nDegree, const double ptCtrlWs[], int nRefType)
{
PNTUVECTOR vPntW ;
vPntW.reserve( nDegree + 1) ;
for ( int i = 0 ; i <= nDegree ; ++i) {
vPntW.push_back( make_pair( Point3d( ptCtrlWs[4*i], ptCtrlWs[4*i+1], ptCtrlWs[4*i+2]), ptCtrlWs[4*i+3])) ;
}
return EgtCreateCurveBezierRational( nParentId, nDegree, vPntW) ;
return EgtCreateCurveBezierRational( nParentId, nDegree, vPntW, nRefType) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveBezierRational( int nParentId, int nDegree, const PNTUVECTOR& vPntW)
EgtCreateCurveBezierRational( int nParentId, int nDegree, const PNTUVECTOR& vPntW, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
bool bOk = true ;
// il numero dei punti deve essere pari al grado + 1
if ( vPntW.size() != nDegree + 1)
return GDB_ID_NULL ;
bOk = bOk && ( vPntW.size() == nDegree + 1) ;
// recupero il riferimento di immersione della curva
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
// creo la curva di Bezier
PtrOwner<ICurveBezier> pCrvBez( CreateCurveBezier()) ;
if ( IsNull( pCrvBez))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvBez) ;
// inizializzo la curva di Bezier
if ( ! pCrvBez->Init( nDegree, true))
return GDB_ID_NULL ;
bOk = bOk && pCrvBez->Init( nDegree, true) ;
// setto i punti di controllo
for ( int i = 0 ; i <= nDegree ; ++ i) {
if ( ! pCrvBez->SetControlPoint( i, vPntW[i].first, vPntW[i].second))
for ( int i = 0 ; i <= nDegree && bOk ; ++ i) {
// eventuale trasformazione del punto nel riferimento locale
Point3d ptCtrl = vPntW[i].first ;
if ( nRefType == RTY_GLOB)
ptCtrl.ToLoc( frLoc) ;
else if ( nRefType == RTY_GRID)
ptCtrl.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
// inserimento del punto di controllo con peso
if ( ! pCrvBez->SetControlPoint( i, ptCtrl, vPntW[i].second))
return GDB_ID_NULL ;
}
// se curva nulla (ovvero ridotta a punto), errore
if ( pCrvBez->IsAPoint())
return GDB_ID_NULL ;
bOk = bOk && ! pCrvBez->IsAPoint() ;
// assegno il versore estrusione
if ( ! SetExtrusionFromGridVersZ( pGeomDB, nParentId, Get( pCrvBez)))
return GDB_ID_NULL ;
Vector3d vtExtrL = Z_AX ;
if ( nRefType == RTY_GLOB)
vtExtrL.ToLoc( frLoc) ;
else if ( nRefType == RTY_GRID)
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
pCrvBez->SetExtrusion( vtExtrL) ;
// inserisco la curva nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) : GDB_ID_NULL) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sPC ;
for ( size_t i = 0 ; i < vPntW.size() ; ++ i) {
if ( i > 0)
sPC += "," ;
sPC += "{" + ToString( vPntW[i].first, vPntW[i].second) + "}" ;
}
string sLua = "EgtCurveBezierRat(" + ToString( nParentId) + "," +
ToString( nDegree) + ",{" +
sPC + "}," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
@@ -1119,35 +1177,30 @@ __stdcall EgtCreateCurveBezierFromArc( int nParentId, int nArcId, BOOL bErase)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
bool bOk = true ;
// creo la curva di Bezier
PtrOwner<ICurveBezier> pCrvBez( CreateCurveBezier()) ;
if ( IsNull( pCrvBez))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvBez) ;
// recupero l'arco
const ICurveArc* pCrvArc = GetCurveArc( pGeomDB->GetGeoObj( nArcId)) ;
if ( pCrvArc == nullptr)
return GDB_ID_NULL ;
bOk = bOk && ( pCrvArc != nullptr) ;
// ne deduco la curva di Bezier
if ( ! pCrvBez->FromArc( *pCrvArc))
return GDB_ID_NULL ;
bOk = bOk && pCrvBez->FromArc( *pCrvArc) ;
// recupero il riferimento dell'arco
Frame3d frSou ;
if ( ! pGeomDB->GetGlobFrame( nArcId, frSou))
return GDB_ID_NULL ;
bOk = bOk && pGeomDB->GetGlobFrame( nArcId, frSou) ;
// recupero il riferimento del gruppo destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
return GDB_ID_NULL ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frDest) ;
// porto la curva di Bezier dal riferimento dell'arco a quello di inserimento
if ( ! AreSameFrame( frSou, frDest)) {
if ( bOk && ! AreSameFrame( frSou, frDest)) {
pCrvBez->ToGlob( frSou) ;
pCrvBez->ToLoc( frDest) ;
}
// se curva nulla (ovvero ridotta a punto), errore
if ( pCrvBez->IsAPoint())
return GDB_ID_NULL ;
bOk = bOk && ! pCrvBez->IsAPoint() ;
// inserisco la curva nel DB
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) : GDB_ID_NULL) ;
if ( nId != GDB_ID_NULL) {
// se richiesto, cancello l'arco originale
if ( bErase) {
@@ -1155,6 +1208,15 @@ __stdcall EgtCreateCurveBezierFromArc( int nParentId, int nArcId, BOOL bErase)
return GDB_ID_NULL ;
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCurveBezierFromArc(" + ToString( nParentId) + "," +
ToString( nArcId) + "," +
( bErase ? "true" : "false") + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
@@ -1171,8 +1233,8 @@ __stdcall EgtCreateCurveCompo( int nParentId, int nNumId, const int nIds[], BOOL
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase)
static int
MyCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1183,7 +1245,10 @@ __stdcall EgtCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase
// recupero il riferimento del gruppo destinazione
Frame3d frDest ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
return false ;
return GDB_ID_NULL ;
// estrusione e spessore
Vector3d vtExtr = CalcExtrusion( pGeomDB, nParentId, RTY_GRID) ;
double dThick = 0 ;
// esecuzione
INTVECTOR::const_iterator Iter ;
for ( Iter = vIds.begin() ; Iter != vIds.end() ; ++Iter) {
@@ -1191,33 +1256,33 @@ __stdcall EgtCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase
int nIdCrv = *Iter ;
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nIdCrv)) ;
if ( pCrv == nullptr)
return false ;
return GDB_ID_NULL ;
// recupero il riferimento della curva
Frame3d frSou ;
if ( ! pGeomDB->GetGlobFrame( nIdCrv, frSou))
return false ;
// se i riferimenti sono uguali
if ( AreSameFrame( frSou, frDest)) {
// aggiungo direttamente questa curva
if ( ! pCrvCompo->AddCurve( *pCrv))
return false ;
}
// altrimenti devo prima trasformare la curva
else {
// creo una copia della curva
PtrOwner<ICurve> pModCrv( pCrv->Clone()) ;
if ( IsNull( pModCrv))
return false ;
// eseguo la trasformazione
pModCrv->LocToLoc( frSou, frDest) ;
// aggiungo la curva modificata
if ( ! pCrvCompo->AddCurve( Release( pModCrv)))
return false ;
return GDB_ID_NULL ;
// creo una copia della curva
PtrOwner<ICurve> pCopCrv( pCrv->Clone()) ;
if ( IsNull( pCopCrv))
return GDB_ID_NULL ;
// se i riferimenti sono diversi, eseguo la trasformazione
if ( ! AreSameFrame( frSou, frDest))
pCopCrv->LocToLoc( frSou, frDest) ;
// recupero eventuali estrusione (già nel riferimento destinazione) e spessore
Vector3d vtTemp ;
if ( pCopCrv->GetExtrusion( vtTemp)) {
vtExtr = vtTemp ;
double dTemp ;
if ( pCopCrv->GetThickness( dTemp) && fabs( dTemp) > fabs( dThick))
dThick = dTemp ;
}
// aggiungo alla composita
if ( ! pCrvCompo->AddCurve( Release( pCopCrv)))
return GDB_ID_NULL ;
}
// assegno il versore estrusione
if ( ! SetExtrusionFromGridVersZ( pGeomDB, nParentId, Get( pCrvCompo)))
return GDB_ID_NULL ;
// imposto estrusione e spessore
pCrvCompo->SetExtrusion( vtExtr) ;
pCrvCompo->SetThickness( dThick) ;
// inserisco la curva composita nel DB
int nId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) ;
// se ok e richiesto, cancello le curve originali
@@ -1227,24 +1292,51 @@ __stdcall EgtCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase
return GDB_ID_NULL ;
}
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoByChain( int nParentId, int nNumId, const int nIds[], const double ptNear[3], BOOL bErase)
EgtCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool bErase)
{
// eseguo
int nId = MyCreateCurveCompo( nParentId, vIds, bErase) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sIds ;
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
if ( i > 0)
sIds += "," ;
sIds += ToString( vIds[i]) ;
}
string sLua = "EgtCurveCompo(" + ToString( nParentId) + ",{" +
sIds + "}," +
( bErase ? "true" : "false") + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoByChain( int nParentId, int nNumId, const int nIds[],
const double ptNear[3], BOOL bErase, int nRefType)
{
INTVECTOR vIds ;
vIds.reserve( nNumId) ;
for ( int i = 0 ; i < nNumId ; ++i) {
vIds.push_back( nIds[i]) ;
}
return EgtCreateCurveCompoByChain( nParentId, vIds, ptNear, ( bErase != FALSE)) ;
return EgtCreateCurveCompoByChain( nParentId, vIds, ptNear, ( bErase != FALSE), nRefType) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, const Point3d& ptNear, bool bErase)
static int
MyCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds,
const Point3d& ptNear, bool bErase, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -1284,16 +1376,19 @@ __stdcall EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, cons
}
// recupero i percorsi concatenati
int nFirstId = GDB_ID_NULL ;
Point3d ptNearStart( ptNear) ;
Point3d ptNearL( ptNear) ;
if ( nRefType == RTY_GLOB)
ptNearL.ToLoc( frDest) ;
else if ( nRefType == RTY_GRID)
ptNearL.LocToLoc( pGeomDB->GetGridFrame(), frDest) ;
INTVECTOR vId2s ;
while ( chainC.GetChainFromNear( ptNearStart, vId2s)) {
while ( chainC.GetChainFromNear( ptNearL, vId2s)) {
// creo una curva composita
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo))
return GDB_ID_NULL ;
// eventuali estrusione e spessore
bool bExtr = false ;
Vector3d vtExtr ;
// estrusione e spessore
Vector3d vtExtr = CalcExtrusion( pGeomDB, nParentId, nRefType) ;
double dThick = 0 ;
// recupero le curve semplici e le inserisco nella curva composita
INTVECTOR::iterator Iter ;
@@ -1317,8 +1412,9 @@ __stdcall EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, cons
// la sistemo per i riferimenti
pCopCrv->LocToLoc( frCrv, frDest) ;
// recupero eventuali estrusione (già nel riferimento destinazione) e spessore
if ( pCopCrv->GetExtrusion( vtExtr)) {
bExtr = true ;
Vector3d vtTemp ;
if ( pCopCrv->GetExtrusion( vtTemp)) {
vtExtr = vtTemp ;
double dTemp ;
if ( pCopCrv->GetThickness( dTemp) && fabs( dTemp) > fabs( dThick))
dThick = dTemp ;
@@ -1330,13 +1426,11 @@ __stdcall EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, cons
// se non sono state inserite curve, vado oltre
if ( pCrvCompo->GetCurveNumber() == 0)
continue ;
// se necessario, imposto estrusione e spessore
if ( bExtr) {
pCrvCompo->SetExtrusion( vtExtr) ;
pCrvCompo->SetThickness( dThick) ;
}
// imposto estrusione e spessore
pCrvCompo->SetExtrusion( vtExtr) ;
pCrvCompo->SetThickness( dThick) ;
// aggiorno il nuovo punto vicino
pCrvCompo->GetEndPoint( ptNearStart) ;
pCrvCompo->GetEndPoint( ptNearL) ;
// inserisco la curva composita nel gruppo destinazione
int nNewId = pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, ::Release( pCrvCompo)) ;
if ( nNewId == GDB_ID_NULL)
@@ -1351,6 +1445,17 @@ __stdcall EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, cons
return GDB_ID_NULL ;
}
}
// restituisco l'identificativo della prima nuova entità
return nFirstId ;
}
//-------------------------------------------------------------------------------
int
EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds,
const Point3d& ptNear, bool bErase, int nRefType)
{
// eseguo
int nFirstId = MyCreateCurveCompoByChain( nParentId, vIds, ptNear, bErase, nRefType) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sIds ;
@@ -1361,8 +1466,9 @@ __stdcall EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, cons
}
string sLua = "EgtCurveCompoByChain(" + ToString( nParentId) + ",{" +
sIds + "},{" +
ToString( Point3d( ptNear)) + "}," +
( bErase ? "true" : "false") + ")" +
ToString( ptNear) + "}," +
( bErase ? "true" : "false") + "," +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nFirstId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -1372,64 +1478,109 @@ __stdcall EgtCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, cons
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoFromPoints( int nParentId, int nP, const double ptPs[])
__stdcall EgtCreateCurveCompoFromPoints( int nParentId, int nP, const double ptPs[], int nRefType)
{
PolyLine PL ;
for ( int i = 0 ; i < nP ; ++i) {
PL.AddUPoint( 0, Point3d( ptPs[3*i], ptPs[3*i+1], ptPs[3*i+2])) ;
}
return EgtCreateCurveCompoFromPoints( nParentId, PL) ;
return EgtCreateCurveCompoFromPoints( nParentId, PL, nRefType) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoFromPoints( int nParentId, const PolyLine& PL)
EgtCreateCurveCompoFromPoints( int nParentId, const PolyLine& PL, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
bool bOk = true ;
// recupero il riferimento del gruppo destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frDest) ;
// creo la curva composita
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvCompo) ;
// inserisco i segmenti che uniscono i punti
if ( ! pCrvCompo->FromPolyLine( PL))
return GDB_ID_NULL ;
bOk = bOk && pCrvCompo->FromPolyLine( PL) ;
// assegno il versore estrusione
if ( ! SetExtrusionFromGridVersZ( pGeomDB, nParentId, Get( pCrvCompo)))
return GDB_ID_NULL ;
bOk = bOk && pCrvCompo->SetExtrusion( Z_AX) ;
// eventuale trasformazione per riferimento di espressione dei punti
if ( bOk && nRefType == RTY_GLOB)
pCrvCompo->ToLoc( frDest) ;
else if ( bOk && nRefType == RTY_GRID)
pCrvCompo->LocToLoc( pGeomDB->GetGridFrame(), frDest) ;
// inserisco la curva composita nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) : GDB_ID_NULL) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sPnt ;
Point3d ptP ;
if ( PL.GetFirstPoint( ptP))
sPnt += "{" + ToString( ptP) + "}" ;
while ( PL.GetNextPoint( ptP))
sPnt += ",{" + ToString( ptP) + "}" ;
string sLua = "EgtCurveCompoFromPoints(" + ToString( nParentId) + ",{" +
sPnt + "},{" +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoFromPointBulges( int nParentId, int nPB, const double ptPBs[])
__stdcall EgtCreateCurveCompoFromPointBulges( int nParentId, int nPB, const double ptPBs[], int nRefType)
{
PolyArc PA ;
for ( int i = 0 ; i < nPB ; ++i) {
PA.AddUPoint( 0, Point3d( ptPBs[4*i], ptPBs[4*i+1], ptPBs[4*i+2]), ptPBs[4*i+3]) ;
}
return EgtCreateCurveCompoFromPointBulges( nParentId, PA) ;
return EgtCreateCurveCompoFromPointBulges( nParentId, PA, nRefType) ;
}
//-------------------------------------------------------------------------------
int
__stdcall EgtCreateCurveCompoFromPointBulges( int nParentId, const PolyArc& PA)
EgtCreateCurveCompoFromPointBulges( int nParentId, const PolyArc& PA, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
bool bOk = true ;
// recupero il riferimento del gruppo destinazione
Frame3d frDest ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frDest) ;
// creo la curva composita
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo))
return GDB_ID_NULL ;
bOk = bOk && ! IsNull( pCrvCompo) ;
// inserisco i segmenti e gli archi che uniscono i punti
if ( ! pCrvCompo->FromPolyArc( PA))
return GDB_ID_NULL ;
bOk = bOk && pCrvCompo->FromPolyArc( PA) ;
// assegno il versore estrusione
if ( ! SetExtrusionFromGridVersZ( pGeomDB, nParentId, Get( pCrvCompo)))
return GDB_ID_NULL ;
bOk = bOk && pCrvCompo->SetExtrusion( Z_AX) ;
// eventuale trasformazione per riferimento di espressione dei punti
if ( bOk && nRefType == RTY_GLOB)
pCrvCompo->ToLoc( frDest) ;
else if ( bOk && nRefType == RTY_GRID)
pCrvCompo->LocToLoc( pGeomDB->GetGridFrame(), frDest) ;
// inserisco la curva composita nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvCompo)) : GDB_ID_NULL) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sPnt ;
double dB ;
Point3d ptP ;
if ( PA.GetFirstPoint( ptP, dB))
sPnt += "{" + ToString( ptP) + "," + ToString( dB) + "}" ;
while ( PA.GetNextPoint( ptP, dB))
sPnt += ",{" + ToString( ptP) + "," + ToString( dB) + "}" ;
string sLua = "EgtCurveCompoFromPointBulges(" + ToString( nParentId) + ",{" +
sPnt + "},{" +
RefTypeToString( nRefType) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
@@ -1438,28 +1589,50 @@ __stdcall EgtCreateCurveCompoByApprox( int nParentId, int nSouId, BOOL bArcsVsLi
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
bool bOk = true ;
// recupero il riferimento di inserimento
Frame3d frEnt ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frEnt))
return GDB_ID_NULL ;
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frEnt) ;
// eseguo l'approssimazione
PtrOwner<ICurveComposite> pCC( CreateCurveComposite()) ;
if ( IsNull( pCC))
return false ;
bOk = bOk && ! IsNull( pCC) ;
if ( ! bArcsVsLines) { // con linee
PolyLine PL ;
if ( ! GetPolyLineFromCurve( nSouId, frEnt, dLinTol, PL) ||
! pCC->FromPolyLine( PL))
return false ;
bOk = bOk && GetPolyLineFromCurve( nSouId, frEnt, dLinTol, PL) && pCC->FromPolyLine( PL) ;
}
else { // con bi-archi
PolyArc PA ;
if ( ! GetPolyArcFromCurve( nSouId, frEnt, dLinTol, PA) ||
! pCC->FromPolyArc( PA))
return false ;
bOk = bOk && GetPolyArcFromCurve( nSouId, frEnt, dLinTol, PA) && pCC->FromPolyArc( PA) ;
}
// copio estrusione e spessore della curva sorgente
const ICurve* pSouCrv = GetCurve( pGeomDB->GetGeoObj( nSouId)) ;
if ( bOk && pSouCrv != nullptr) {
// recupero estrusione e spessore
Vector3d vtExtr ;
pSouCrv->GetExtrusion( vtExtr) ;
double dThick ;
pSouCrv->GetThickness( dThick) ;
// sistemo per eventuale cambio di riferimento
Frame3d frSou ;
bOk = bOk && pGeomDB->GetGlobFrame( nSouId, frSou) ;
vtExtr.LocToLoc( frSou, frEnt) ;
// assegno
pCC->SetExtrusion( vtExtr) ;
pCC->SetThickness( dThick) ;
}
// inserisco la curva composita nel DB
return pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCC)) ;
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCC)) : GDB_ID_NULL) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtCurveCompoByApprox(" + ToString( nParentId) + "," +
ToString( nSouId) + "," +
( bArcsVsLines ? "ARCS" : "LINES") +
ToString( dLinTol) + ")" +
" -- Id=" + ToString( nId) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco l'identificativo della nuova entità
return nId ;
}
//-------------------------------------------------------------------------------
@@ -1507,7 +1680,7 @@ __stdcall EgtCreateRectangle3P( int nParentId, const double ptIni[3],
PL.AddUPoint( 3, Point3d( ptCrossL) - vtLatoX) ;
PL.AddUPoint( 4, ptIniL) ;
// creo la curva e la inserisco nel GDB
nId = EgtCreateCurveCompoFromPoints( nParentId, PL) ;
nId = EgtCreateCurveCompoFromPoints( nParentId, PL, RTY_LOC) ;
// ne sistemo il vettore estrusione
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCurve != nullptr)
@@ -1582,9 +1755,29 @@ __stdcall EgtCreatePolygonFromSide( int nParentId, int nNumSides, const double p
return nId ;
}
//-------------------------------------------------------------------------------
Vector3d
CalcExtrusion( IGeomDB* pGeomDB, int nParentId, int nRefType)
{
// verifica sul parametro
if ( pGeomDB == nullptr)
return Z_AX ;
// riferimento dell'entità
Frame3d frEnt ;
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frEnt))
return false ;
// versore estrusione
Vector3d vtExtr = Z_AX ;
if ( nRefType == RTY_GLOB)
vtExtr.ToLoc( frEnt) ;
else if ( nRefType == RTY_GRID)
vtExtr.LocToLoc( pGeomDB->GetGridFrame(), frEnt) ;
return vtExtr ;
}
//-------------------------------------------------------------------------------
bool
__stdcall SetExtrusionFromGridVersZ( IGeomDB* pGeomDB, int nParentId, ICurve* pCurve)
SetExtrusionFromGridVersZ( IGeomDB* pGeomDB, int nParentId, ICurve* pCurve)
{
// verifiche sui parametri
if ( pGeomDB == nullptr || pCurve == nullptr)
@@ -1600,7 +1793,7 @@ __stdcall SetExtrusionFromGridVersZ( IGeomDB* pGeomDB, int nParentId, ICurve* pC
//----------------------------------------------------------------------------
bool
__stdcall GetPolyLineFromCurve( int nId, const Frame3d& frDest, double dLinTol, PolyLine& PL)
GetPolyLineFromCurve( int nId, const Frame3d& frDest, double dLinTol, PolyLine& PL)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -1637,7 +1830,7 @@ __stdcall GetPolyLineFromCurve( int nId, const Frame3d& frDest, double dLinTol,
//----------------------------------------------------------------------------
bool
__stdcall GetPolyArcFromCurve( int nId, const Frame3d& frDest, double dLinTol, PolyArc& PA)
GetPolyArcFromCurve( int nId, const Frame3d& frDest, double dLinTol, PolyArc& PA)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
+8 -1
View File
@@ -121,17 +121,24 @@ __stdcall EgtCreateSurfTriMeshByScrewing( int nParentId, int nCrvId,
ptAxL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
vtAxL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// limite minimo su tolleranza
dLinTol = max( dLinTol, EPS_SMALL) ;
// calcolo la polilinea che approssima la curva
PolyLine PL ;
bOk = bOk && GetPolyLineFromCurve( nCrvId, frLoc, dLinTol, PL) ;
// calcolo lo step di rotazione
double dMaxRad = 0 ;
bOk = bOk && PL.GetMaxDistanceFromLine( dMaxRad, ptAx, vtAx, 1, false) ;
bOk = bOk && PL.GetMaxDistanceFromLine( dMaxRad, ptAxL, vtAxL, 1, false) ;
if ( dMaxRad < EPS_SMALL) {
bOk = false ;
dMaxRad = EPS_SMALL ;
}
double dStepRotDeg = sqrt( 8 * dLinTol / dMaxRad) * RADTODEG ;
// se superficie rototraslata, necessari limiti sulla lunghezza dei segmenti
if ( fabs( dAngRotDeg) > EPS_ANG_SMALL && fabs( dMove) > EPS_SMALL){
double dLenMax = 2 * fabs( dMove) * dStepRotDeg / dAngRotDeg ;
bOk = bOk && PL.AdjustForMaxSegmentLen( dLenMax) ;
}
// creo e setto la superficie trimesh
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
bOk = bOk && ! IsNull( pSTM) ;
+144 -28
View File
@@ -16,7 +16,9 @@
#include "stdafx.h"
#include "API.h"
#include "API_Macro.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EgkGeoPoint3d.h"
#include "/EgtDev/Include/EgkGeoVector3d.h"
#include "/EgtDev/Include/EgkSurfTriMesh.h"
@@ -30,35 +32,87 @@ using namespace std ;
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtChangeGroupFrame( int nId,
double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3])
__stdcall EgtChangeGroupFrame( int nId, double ptOrig[3],
double vtX[3], double vtY[3], double vtZ[3], int nRefType)
{
// costruisco il riferimento
Frame3d frFrame ;
if ( ! frFrame.Set( ptOrig, vtX, vtY, vtZ))
return FALSE ;
// eseguo
return ( EgtChangeGroupFrame( nId, frFrame, nRefType) ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
bool
EgtChangeGroupFrame( int nId, const Frame3d& frNewRef, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// recupero il riferimento del gruppo
Frame3d* pFrame = pGeomDB->GetGroupFrame( nId) ;
if ( pFrame == nullptr)
return FALSE ;
// imposto il nuovo riferimento
Frame3d frNew ;
if ( ! frNew.Set( ptOrig, vtX, vtY, vtZ))
return FALSE ;
*pFrame = frNew ;
return TRUE ;
bOk = bOk && ( pFrame != nullptr) ;
// porto il nuovo riferimento in locale
Frame3d frNewL = frNewRef ;
if ( nRefType != RTY_LOC) {
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
if ( nRefType == RTY_GLOB)
frNewL.ToLoc( frLoc) ;
else /* RTY_GRID */
frNewL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// aggiorno il gruppo
if ( bOk)
*pFrame = frNewL ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtChangeGroupFrame(" + ToString( nId) + ",{" +
ToString( frNewRef.Orig()) + "},{" +
ToString( frNewRef.VersX()) + "},{" +
ToString( frNewRef.VersY()) + "},{" +
ToString( frNewRef.VersZ()) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtChangeVectorBase( int nId, const double ptB[3])
__stdcall EgtChangeVectorBase( int nId, const double ptB[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// recupero il vettore
IGeoVector3d* pGVect = GetGeoVector3d( pGeomDB->GetGeoObj( nId)) ;
if ( pGVect == nullptr)
return FALSE ;
bOk = bOk && ( pGVect != nullptr) ;
// porto il nuovo punto base in locale
Point3d ptBL( ptB) ;
if ( nRefType != RTY_LOC) {
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
if ( nRefType == RTY_GLOB)
ptBL.ToLoc( frLoc) ;
else /* RTY_GRID */
ptBL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// imposto il nuovo punto di base
return ( pGVect->ChangeBase( ptB) ? TRUE : FALSE) ;
bOk = bOk && pGVect->ChangeBase( ptBL) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtChangeVectorBase(" + ToString( nId) + ",{" +
ToString( Point3d( ptB)) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
@@ -97,46 +151,108 @@ __stdcall EgtInvertSurface( int nId)
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
//----------------------------------------------------------------------------
BOOL
__stdcall EgtModifyText( int nId, const wchar_t* wsNewText)
__stdcall EgtSurfTmDoSewing( int nNumId, const int nIds[], BOOL bErase)
{
return EgtModifyText( nId, wstrztoA( wsNewText)) ;
INTVECTOR vIds ;
vIds.reserve( nNumId) ;
for ( int i = 0 ; i < nNumId ; ++i) {
vIds.push_back( nIds[i]) ;
}
return ( EgtSurfTmDoSewing( vIds, ( bErase != FALSE)) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
bool
EgtSurfTmDoSewing( const INTVECTOR& vIds, bool bErase)
{
// --- tutte le superfici vengono cucite alla prima ---
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// almeno un oggetto nell'elenco
bool bOk = ( vIds.size() > 0) ;
// recupero la prima superficie
ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( vIds[0])) ;
bOk = bOk && ( pStm != nullptr) ;
// ne recupero il riferimento
Frame3d frStm ;
bOk = bOk && pGeomDB->GetGlobFrame( vIds[0], frStm) ;
// esecuzione
for ( size_t i = 1 ; bOk && i < vIds.size() ; ++ i) {
// recupero la superficie da cucire
const ISurfTriMesh* pStmS = GetSurfTriMesh( pGeomDB->GetGeoObj( vIds[i])) ;
bOk = bOk && ( pStmS != nullptr) ;
// recupero il riferimento
Frame3d frStmS ;
bOk = bOk && pGeomDB->GetGlobFrame( vIds[i], frStmS) ;
// lo esprimo rispetto a quello della prima superficie
frStmS.ToLoc( frStm) ;
// eseguo la cucitura
bOk = bOk && pStm->DoSewing( *pStmS, frStm) ;
}
// se richiesto, cancello le superfici cucite alla prima
if ( bOk && bErase) {
for ( size_t i = 1 ; i < vIds.size() ; ++ i)
pGeomDB->Erase( vIds[i]) ;
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sIds ;
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
if ( i > 0)
sIds += "," ;
sIds += vIds[i] ;
}
string sLua = "EgtSurfTmDoSewing({" + sIds + "}," +
( bErase ? "true" : "false") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return bOk ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtModifyText( int nId, const string& sNewText)
__stdcall EgtModifyText( int nId, const wchar_t* wsNewText)
{
return ( EgtModifyText( nId, wstrztoA( wsNewText)) ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
bool
EgtModifyText( int nId, const string& sNewText)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
VERIFY_GEOMDB( pGeomDB, false)
// recupero il testo
IExtText* pTXT = GetExtText( pGeomDB->GetGeoObj( nId)) ;
if ( pTXT == nullptr)
return FALSE ;
return false ;
// eseguo l'operazione
return ( pTXT->ModifyText( sNewText) ? TRUE : FALSE) ;
return pTXT->ModifyText( sNewText) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtChangeTextFont( int nId, const wchar_t* wsNewFont)
{
return EgtChangeTextFont( nId, wstrztoA( wsNewFont)) ;
return ( EgtChangeTextFont( nId, wstrztoA( wsNewFont)) ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtChangeTextFont( int nId, const string& sNewFont)
bool
EgtChangeTextFont( int nId, const string& sNewFont)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
VERIFY_GEOMDB( pGeomDB, false)
// recupero il testo
IExtText* pTXT = GetExtText( pGeomDB->GetGeoObj( nId)) ;
if ( pTXT == nullptr)
return FALSE ;
return false ;
// eseguo l'operazione
return ( pTXT->ChangeFont( sNewFont) ? TRUE : FALSE) ;
return pTXT->ChangeFont( sNewFont) ;
}
//-------------------------------------------------------------------------------
+181 -129
View File
@@ -15,7 +15,9 @@
#include "stdafx.h"
#include "API.h"
#include "API_Macro.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveBezier.h"
@@ -94,174 +96,169 @@ __stdcall EgtOffsetCurve( int nId, double dDist, int nType)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtModifyCurveStartPoint( int nId, const double ptP[3])
__stdcall EgtModifyCurveStartPoint( int nId, const double ptP[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCurve == nullptr)
return FALSE ;
bOk = bOk && ( pCurve != nullptr) ;
// porto in locale il nuovo punto iniziale
Point3d ptPL( ptP) ;
if ( nRefType != RTY_LOC) {
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
if ( nRefType == RTY_GLOB)
ptPL.ToLoc( frLoc) ;
else /* RTY_GRID */
ptPL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// ne modifico il punto iniziale
return ( pCurve->ModifyStart( ptP) ? TRUE : FALSE) ;
bOk = bOk && pCurve->ModifyStart( ptPL) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtModifyCurveStartPoint(" + ToString( nId) + ",{" +
ToString( Point3d( ptP)) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return ( bOk ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtModifyCurveEndPoint( int nId, const double ptP[3])
__stdcall EgtModifyCurveEndPoint( int nId, const double ptP[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
if ( pCurve == nullptr)
return FALSE ;
bOk = bOk && ( pCurve != nullptr) ;
// porto in locale il nuovo punto iniziale
Point3d ptPL( ptP) ;
if ( nRefType != RTY_LOC) {
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
if ( nRefType == RTY_GLOB)
ptPL.ToLoc( frLoc) ;
else /* RTY_GRID */
ptPL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// ne modifico il punto finale
return ( pCurve->ModifyEnd( ptP) ? TRUE : FALSE) ;
bOk = bOk && pCurve->ModifyEnd( ptPL) ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtModifyCurveEndPoint(" + ToString( nId) + ",{" +
ToString( Point3d( ptP)) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco il risultato
return ( bOk ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
static bool
__stdcall ModifyOneCurveExtrusion( IGeomDB* pGeomDB, int nId, const Vector3d& vtExtr)
ModifyOneCurveExtrusion( IGeomDB* pGeomDB, int nId, const Vector3d& vtExtr, int nRefType)
{
// porto in locale il versore estrusione
Vector3d vtExtrL( vtExtr) ;
if ( nRefType != RTY_LOC) {
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( nId, frLoc) &&
! pGeomDB->GetGlobFrame( nId, frLoc))
return false ;
if ( nRefType == RTY_GLOB)
vtExtrL.ToLoc( frLoc) ;
else /* RTY_GRID */
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// se gruppo, agisco sulle sole curve componenti
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP) {
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( pGeomDB)) ;
if ( IsNull( pIter))
return false ;
bool bOk = true ;
for ( bool bFound = pIter->GoToFirstInGroup( nId) ;
bFound ;
bFound = pIter->GoToNext()) {
// recupero la curva e ne modifico il vettore estrusione
ICurve* pCurve = GetCurve( pIter->GetGeoObj()) ;
if ( pCurve != nullptr && ! pCurve->SetExtrusion( vtExtr))
bOk = false ;
if ( pCurve != nullptr && ! pCurve->SetExtrusion( vtExtrL))
return false ;
}
return bOk ;
return true ;
}
// se oggetto geometrico
else {
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
// ne modifico il vettore estrusione
return ( pCurve == nullptr || pCurve->SetExtrusion( vtExtr)) ;
return ( pCurve == nullptr || pCurve->SetExtrusion( vtExtrL)) ;
}
}
//----------------------------------------------------------------------------
BOOL
__stdcall EgtModifyCurveExtrusion( int nId, const double vtExtr[3])
__stdcall EgtModifyCurveExtrusion( int nId, const double vtExtr[3], int nRefType)
{
INTVECTOR vIds ;
vIds.push_back( nId) ;
return ( EgtModifyCurveExtrusion( vIds, vtExtr, nRefType) ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
bool
EgtModifyCurveExtrusion( INTVECTOR& vIds, const Vector3d& vtExtr, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// eseguo impostazione estrusione singola
if ( nId != GDB_ID_SEL) {
bOk = ModifyOneCurveExtrusion( pGeomDB, nId, vtExtr) ;
}
// eseguo impostazione estrusione dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! ModifyOneCurveExtrusion( pGeomDB, nI, vtExtr))
bOk = false ;
// passo alla successiva
nI = pGeomDB->GetNextSelectedObj() ;
// se estrusione espressa in locale, verifico che tutte le curve siano nello stesso riferimento
if ( nRefType == RTY_LOC)
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
// ciclo sul vettore degli identificativi
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
// impostazione estrusione singola
if ( vIds[i] != GDB_ID_SEL) {
bOk = bOk && ModifyOneCurveExtrusion( pGeomDB, vIds[i], vtExtr, nRefType) ;
}
// impostazione estrusione dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! ModifyOneCurveExtrusion( pGeomDB, nI, vtExtr, nRefType))
bOk = false ;
// passo alla successiva
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtModifyCurveExtrusion(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ",{" +
ToString( Vector3d( vtExtr)) + "})" +
" -- Ok=" + ToString( bOk) ;
string sIds ;
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
if ( i > 0)
sIds += "," ;
sIds += ( vIds[i] != GDB_ID_SEL ? ToString( vIds[i]) : "GDB_ID_SEL") ;
}
string sLua = "EgtModifyCurveExtrusion({" + sIds + "},{" +
ToString( Vector3d( vtExtr)) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
return bOk ;
}
//----------------------------------------------------------------------------
static bool
__stdcall SetOneCurveExtrusionFromGrid( IGeomDB* pGeomDB, int nId, const Vector3d& vtExtrGlob)
{
// se gruppo, agisco sulle sole curve componenti
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP) {
// recupero il riferimento definito dal gruppo
Frame3d frFrame ;
if ( ! pGeomDB->GetGroupGlobFrame( nId, frFrame))
return false ;
// esprimo il versore estrusione in questo riferimento
Vector3d vtExtr = vtExtrGlob ;
vtExtr.ToLoc( frFrame) ;
// ciclo sulle curve del gruppo
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( pGeomDB)) ;
if ( IsNull( pIter))
return false ;
bool bOk = true ;
for ( bool bFound = pIter->GoToFirstInGroup( nId) ;
bFound ;
bFound = pIter->GoToNext()) {
// recupero la curva e ne modifico il vettore estrusione
ICurve* pCurve = GetCurve( pIter->GetGeoObj()) ;
if ( pCurve != nullptr && ! pCurve->SetExtrusion( vtExtr))
bOk = false ;
}
return bOk ;
}
// se oggetto geometrico
else {
// recupero il riferimento definito dal gruppo
Frame3d frFrame ;
if ( ! pGeomDB->GetGlobFrame( nId, frFrame))
return false ;
// esprimo il versore estrusione in questo riferimento
Vector3d vtExtr = vtExtrGlob ;
vtExtr.ToLoc( frFrame) ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
// ne modifico il vettore estrusione
return ( pCurve == nullptr || pCurve->SetExtrusion( vtExtr)) ;
}
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtSetCurveExtrusionFromGrid( int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// recupero il versore Z della griglia corrente (in globale)
Vector3d vtExtrGlob = pGeomDB->GetGridFrame().VersZ() ;
// eseguo impostazione estrusione singola
if ( nId != GDB_ID_SEL) {
bOk = SetOneCurveExtrusionFromGrid( pGeomDB, nId, vtExtrGlob) ;
}
// eseguo impostazione estrusione dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! SetOneCurveExtrusionFromGrid( pGeomDB, nI, vtExtrGlob))
bOk = false ;
// passo alla successiva
nI = pGeomDB->GetNextSelectedObj() ;
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSetCurveExtrusionFromGrid(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
}
//----------------------------------------------------------------------------
static bool
__stdcall ModifyOneCurveThickness( IGeomDB* pGeomDB, int nId, double dThick)
ModifyOneCurveThickness( IGeomDB* pGeomDB, int nId, double dThick)
{
// se gruppo, agisco sulle sole curve componenti
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP) {
@@ -420,17 +417,27 @@ __stdcall EgtExtendCurveEndByLen( int nId, double dLen)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtTrimExtendCurveByLen( int nId, double dLen, const double ptNear[3])
__stdcall EgtTrimExtendCurveByLen( int nId, double dLen, const double ptNear[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pCurve != nullptr) ;
// porto in locale il punto
Point3d ptNearL( ptNear) ;
if ( nRefType != RTY_LOC) {
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
if ( nRefType == RTY_GLOB)
ptNearL.ToLoc( frLoc) ;
else /* RTY_GRID */
ptNearL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// cerco l'estremo più vicino al punto passato
Point3d ptStart, ptEnd ;
if ( bOk && pCurve->GetStartPoint( ptStart) && pCurve->GetEndPoint( ptEnd)) {
if ( SqDist( ptStart, ptNear) < SqDist( ptEnd, ptNear)) {
if ( SqDist( ptStart, ptNearL) < SqDist( ptEnd, ptNearL)) {
if ( dLen < - EPS_SMALL)
bOk = pCurve->TrimStartAtLen( - dLen) ;
else if ( dLen > EPS_SMALL)
@@ -451,7 +458,8 @@ __stdcall EgtTrimExtendCurveByLen( int nId, double dLen, const double ptNear[3])
if ( IsCmdLog()) {
string sLua = "EgtTrimExtendCurveByLen(" + ToString( nId) + "," +
ToString( dLen) + ",{" +
ToString( Point3d( ptNear)) + "})" +
ToString( Point3d( ptNear)) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -461,17 +469,27 @@ __stdcall EgtTrimExtendCurveByLen( int nId, double dLen, const double ptNear[3])
//----------------------------------------------------------------------------
BOOL
__stdcall EgtSplitCurveAtPoint( int nId, double ptOn[3])
__stdcall EgtSplitCurveAtPoint( int nId, double ptOn[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bool bOk = ( pCurve != nullptr) ;
// porto in locale il punto
Point3d ptOnL( ptOn) ;
if ( nRefType != RTY_LOC) {
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
if ( nRefType == RTY_GLOB)
ptOnL.ToLoc( frLoc) ;
else /* RTY_GRID */
ptOnL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// determino la posizione parametrica del punto sulla curva (con tolleranza)
double dU = 0 ;
if ( bOk) {
DistPointCurve dstPC( ptOn, *pCurve) ;
DistPointCurve dstPC( ptOnL, *pCurve) ;
int nFlag ;
if ( ! dstPC.GetParamAtMinDistPoint( 0, dU, nFlag) || nFlag != MDPCI_NORMAL)
bOk = false ;
@@ -502,7 +520,8 @@ __stdcall EgtSplitCurveAtPoint( int nId, double ptOn[3])
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtSplitCurveAtPoint(" + ToString( nId) + ",{" +
ToString( Point3d( ptOn)) + "})" +
ToString( Point3d( ptOn)) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -512,7 +531,7 @@ __stdcall EgtSplitCurveAtPoint( int nId, double ptOn[3])
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtModifyCurveCircleCPN( int nId, const double ptOn[3])
__stdcall EgtModifyCurveCircleCPN( int nId, const double ptOn[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -523,8 +542,19 @@ __stdcall EgtModifyCurveCircleCPN( int nId, const double ptOn[3])
Point3d ptCen = pArc->GetCenter() ;
Vector3d vtN = pArc->GetNormVersor() ;
double dOldRad = pArc->GetRadius() ;
// porto in locale il nuovo punto
Point3d ptOnL( ptOn) ;
if ( nRefType != RTY_LOC) {
Frame3d frLoc ;
if ( ! pGeomDB->GetGlobFrame( nId, frLoc))
return FALSE ;
if ( nRefType == RTY_GLOB)
ptOnL.ToLoc( frLoc) ;
else /* RTY_GRID */
ptOnL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// calcolo il nuovo raggio
double dRad = (( Point3d( ptOn) - ptCen) ^ vtN).Len() ;
double dRad = (( Point3d( ptOnL) - ptCen) ^ vtN).Len() ;
// imposto il nuovo raggio
if ( pArc->Set( ptCen, vtN, dRad))
return TRUE ;
@@ -558,7 +588,7 @@ __stdcall EgtModifyCurveArcRadius( int nId, double dRad)
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtModifyCurveArcC2PN( int nId, const double ptEnd[3])
__stdcall EgtModifyCurveArcC2PN( int nId, const double ptEnd[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -571,8 +601,19 @@ __stdcall EgtModifyCurveArcC2PN( int nId, const double ptEnd[3])
Point3d ptStart, ptOldEnd ;
if ( ! pArc->GetStartPoint( ptStart) || ! pArc->GetEndPoint( ptOldEnd))
return FALSE ;
// porto in locale il nuovo punto finale
Point3d ptEndL( ptEnd) ;
if ( nRefType != RTY_LOC) {
Frame3d frLoc ;
if ( ! pGeomDB->GetGlobFrame( nId, frLoc))
return FALSE ;
if ( nRefType == RTY_GLOB)
ptEndL.ToLoc( frLoc) ;
else /* RTY_GRID */
ptEndL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// imposto il nuovo punto finale
if ( pArc->SetC2PN( ptCen, ptStart, ptEnd, vtN))
if ( pArc->SetC2PN( ptCen, ptStart, ptEndL, vtN))
return TRUE ;
// in caso di errore, ripristino i vecchi dati
else {
@@ -583,7 +624,7 @@ __stdcall EgtModifyCurveArcC2PN( int nId, const double ptEnd[3])
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtModifyCurveArc3P( int nId, const double ptMid[3])
__stdcall EgtModifyCurveArc3P( int nId, const double ptMid[3], int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -593,9 +634,20 @@ __stdcall EgtModifyCurveArc3P( int nId, const double ptMid[3])
return FALSE ;
Point3d ptStart, ptOldMid, ptEnd ;
if ( ! pArc->GetStartPoint( ptStart) || ! pArc->GetMidPoint( ptOldMid) || ! pArc->GetEndPoint( ptEnd))
return false ;
return FALSE ;
// porto in locale il nuovo punto medio
Point3d ptMidL( ptMid) ;
if ( nRefType != RTY_LOC) {
Frame3d frLoc ;
if ( ! pGeomDB->GetGlobFrame( nId, frLoc))
return FALSE ;
if ( nRefType == RTY_GLOB)
ptMidL.ToLoc( frLoc) ;
else /* RTY_GRID */
ptMidL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
}
// imposto il nuovo punto medio
if ( pArc->Set3P( ptStart, ptMid, ptEnd))
if ( pArc->Set3P( ptStart, ptMidL, ptEnd))
return TRUE ;
// in caso di errore, ripristino i vecchi dati
else {
@@ -640,7 +692,7 @@ __stdcall EgtExplodeCurveCompo( int nId)
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtExplodeCurveBezier( int nId, double dLinTol, BOOL bArcsVsLines)
__stdcall EgtExplodeCurveBezier( int nId, BOOL bArcsVsLines, double dLinTol)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -684,8 +736,8 @@ __stdcall EgtExplodeCurveBezier( int nId, double dLinTol, BOOL bArcsVsLines)
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtExplodeCurveBezier(" + ToString( nId) + "," +
ToString( dLinTol) + "," +
( bArcsVsLines ? "true" : "false") + ")"
( bArcsVsLines ? "true" : "false") + "," +
ToString( dLinTol) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
+8 -8
View File
@@ -346,7 +346,7 @@ __stdcall EgtSetName( int nId, const wchar_t* wsName)
//-----------------------------------------------------------------------------
bool
__stdcall EgtSetName( int nId, const string& sName)
EgtSetName( int nId, const string& sName)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -378,7 +378,7 @@ __stdcall EgtGetName( int nId, wchar_t*& wsName)
//-----------------------------------------------------------------------------
bool
__stdcall EgtGetName( int nId, string& sName)
EgtGetName( int nId, string& sName)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -423,7 +423,7 @@ __stdcall EgtSetInfo( int nId, const wchar_t* wsKey, const wchar_t* wsInfo)
//-----------------------------------------------------------------------------
bool
__stdcall EgtSetInfo( int nId, const string& sKey, const string& sInfo)
EgtSetInfo( int nId, const string& sKey, const string& sInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -450,7 +450,7 @@ __stdcall EgtSetInfoInt( int nId, const wchar_t* wsKey, int nInfo)
//-----------------------------------------------------------------------------
bool
__stdcall EgtSetInfo( int nId, const string& sKey, int nInfo)
EgtSetInfo( int nId, const string& sKey, int nInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -471,7 +471,7 @@ __stdcall EgtGetInfo( int nId, const wchar_t* wsKey, wchar_t*& wsInfo)
//-----------------------------------------------------------------------------
bool
__stdcall EgtGetInfo( int nId, const string& sKey, string& sInfo)
EgtGetInfo( int nId, const string& sKey, string& sInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -492,7 +492,7 @@ __stdcall EgtGetInfoInt( int nId, const wchar_t* wsKey, int* pnInfo)
//-----------------------------------------------------------------------------
bool
__stdcall EgtGetInfo( int nId, const string& sKey, int& nInfo)
EgtGetInfo( int nId, const string& sKey, int& nInfo)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -509,7 +509,7 @@ __stdcall EgtExistsInfo( int nId, const wchar_t* wsKey)
//-----------------------------------------------------------------------------
bool
__stdcall EgtExistsInfo( int nId, const string& sKey)
EgtExistsInfo( int nId, const string& sKey)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -526,7 +526,7 @@ __stdcall EgtRemoveInfo( int nId, const wchar_t* wsKey)
//-----------------------------------------------------------------------------
bool
__stdcall EgtRemoveInfo( int nId, const string& sKey)
EgtRemoveInfo( int nId, const string& sKey)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
+2 -2
View File
@@ -153,7 +153,7 @@ __stdcall EgtGetPrevGroup( int nId)
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstNameInGroup( int nGroupId, const string& sName)
EgtGetFirstNameInGroup( int nGroupId, const string& sName)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
@@ -167,7 +167,7 @@ __stdcall EgtGetFirstNameInGroup( int nGroupId, const string& sName)
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNextName( int nId, const string& sName)
EgtGetNextName( int nId, const string& sName)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
+10 -1
View File
@@ -204,7 +204,7 @@ __stdcall EgtGetVersionInfo( wchar_t*& wsVer)
//-----------------------------------------------------------------------------
bool
__stdcall EgtGetVersionInfo( string& sVer, const char* szNewLine)
EgtGetVersionInfo( string& sVer, const char* szNewLine)
{
// verifico il parametro
if ( &sVer == nullptr)
@@ -234,6 +234,15 @@ __stdcall EgtFreeMemory( void* pMem)
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtOutLog( const wchar_t* sMsg)
{
LOG_INFO( s_pGenLog, LPSTR( WtoA( sMsg)))
return ( s_pGenLog != nullptr) ;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
ILogger*
GetLogger( void)
+49 -49
View File
@@ -112,11 +112,11 @@ TrasformFrame( IGeomDB* pGeomDB, int nId, int nRefId, Frame3d& frF)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtStartPoint( int nId, double ptP[3])
__stdcall EgtStartPoint( int nId, int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptStart ;
if ( ! EgtStartPoint( nId, nId, ptStart))
if ( ! EgtStartPoint( nId, nRefId, ptStart))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptStart)
@@ -125,7 +125,7 @@ __stdcall EgtStartPoint( int nId, double ptP[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtStartPoint( int nId, int nRefId, Point3d& ptP)
EgtStartPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -178,11 +178,11 @@ __stdcall EgtStartPoint( int nId, int nRefId, Point3d& ptP)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtEndPoint( int nId, double ptP[3])
__stdcall EgtEndPoint( int nId, int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptEnd ;
if ( ! EgtEndPoint( nId, nId, ptEnd))
if ( ! EgtEndPoint( nId, nRefId, ptEnd))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptEnd)
@@ -191,7 +191,7 @@ __stdcall EgtEndPoint( int nId, double ptP[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtEndPoint( int nId, int nRefId, Point3d& ptP)
EgtEndPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -221,11 +221,11 @@ __stdcall EgtEndPoint( int nId, int nRefId, Point3d& ptP)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtMidPoint( int nId, double ptP[3])
__stdcall EgtMidPoint( int nId, int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptMid ;
if ( ! EgtMidPoint( nId, nId, ptMid))
if ( ! EgtMidPoint( nId, nRefId, ptMid))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptMid)
@@ -234,7 +234,7 @@ __stdcall EgtMidPoint( int nId, double ptP[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtMidPoint( int nId, int nRefId, Point3d& ptP)
EgtMidPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -266,11 +266,11 @@ __stdcall EgtMidPoint( int nId, int nRefId, Point3d& ptP)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCenterPoint( int nId, double ptP[3])
__stdcall EgtCenterPoint( int nId, int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptCent ;
if ( ! EgtCenterPoint( nId, nId, ptCent))
if ( ! EgtCenterPoint( nId, nRefId, ptCent))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptCent)
@@ -279,7 +279,7 @@ __stdcall EgtCenterPoint( int nId, double ptP[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtCenterPoint( int nId, int nRefId, Point3d& ptP)
EgtCenterPoint( int nId, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -311,11 +311,11 @@ __stdcall EgtCenterPoint( int nId, int nRefId, Point3d& ptP)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtAtParamPoint( int nId, double dU, double ptP[3])
__stdcall EgtAtParamPoint( int nId, double dU, int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptAtPar ;
if ( ! EgtAtParamPoint( nId, dU, nId, ptAtPar))
if ( ! EgtAtParamPoint( nId, dU, nRefId, ptAtPar))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptAtPar)
@@ -324,7 +324,7 @@ __stdcall EgtAtParamPoint( int nId, double dU, double ptP[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtAtParamPoint( int nId, double dU, int nRefId, Point3d& ptP)
EgtAtParamPoint( int nId, double dU, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -347,11 +347,11 @@ __stdcall EgtAtParamPoint( int nId, double dU, int nRefId, Point3d& ptP)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtNearPoint( int nId, const double ptNear[3], double ptP[3])
__stdcall EgtNearPoint( int nId, const double ptNear[3], int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptInt ;
if ( ! EgtNearPoint( nId, ptNear, nId, ptInt))
if ( ! EgtNearPoint( nId, ptNear, nRefId, ptInt))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptInt)
@@ -360,7 +360,7 @@ __stdcall EgtNearPoint( int nId, const double ptNear[3], double ptP[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP)
EgtNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -386,11 +386,11 @@ __stdcall EgtNearPoint( int nId, const Point3d& ptNear, int nRefId, Point3d& ptP
//----------------------------------------------------------------------------
BOOL
__stdcall EgtIntersectionPoint( int nId1, int nId2, const double ptNear[3], double ptP[3])
__stdcall EgtIntersectionPoint( int nId1, int nId2, const double ptNear[3], int nRefId, double ptP[3])
{
// recupero il punto
Point3d ptInt ;
if ( ! EgtIntersectionPoint( nId1, nId2, ptNear, nId1, ptInt))
if ( ! EgtIntersectionPoint( nId1, nId2, ptNear, nRefId, ptInt))
return FALSE ;
// ritorno il punto
VEC_FROM_3D( ptP, ptInt)
@@ -399,7 +399,7 @@ __stdcall EgtIntersectionPoint( int nId1, int nId2, const double ptNear[3], doub
//----------------------------------------------------------------------------
bool
__stdcall EgtIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Point3d& ptP)
EgtIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int nRefId, Point3d& ptP)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -447,11 +447,11 @@ __stdcall EgtIntersectionPoint( int nId1, int nId2, const Point3d& ptNear, int n
//----------------------------------------------------------------------------
BOOL
__stdcall EgtStartVector( int nId, double vtV[3])
__stdcall EgtStartVector( int nId, int nRefId, double vtV[3])
{
// recupero il vettore
Vector3d vtStart ;
if ( ! EgtStartVector( nId, nId, vtStart))
if ( ! EgtStartVector( nId, nRefId, vtStart))
return FALSE ;
// ritorno il vettore
VEC_FROM_3D( vtV, vtStart)
@@ -460,7 +460,7 @@ __stdcall EgtStartVector( int nId, double vtV[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtStartVector( int nId, int nRefId, Vector3d& vtV)
EgtStartVector( int nId, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -498,11 +498,11 @@ __stdcall EgtStartVector( int nId, int nRefId, Vector3d& vtV)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtEndVector( int nId, double vtV[3])
__stdcall EgtEndVector( int nId, int nRefId, double vtV[3])
{
// recupero il vettore
Vector3d vtEnd ;
if ( ! EgtEndVector( nId, nId, vtEnd))
if ( ! EgtEndVector( nId, nRefId, vtEnd))
return FALSE ;
// ritorno il vettore
VEC_FROM_3D( vtV, vtEnd)
@@ -511,7 +511,7 @@ __stdcall EgtEndVector( int nId, double vtV[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtEndVector( int nId, int nRefId, Vector3d& vtV)
EgtEndVector( int nId, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -535,11 +535,11 @@ __stdcall EgtEndVector( int nId, int nRefId, Vector3d& vtV)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtMidVector( int nId, double vtV[3])
__stdcall EgtMidVector( int nId, int nRefId, double vtV[3])
{
// recupero il vettore
Vector3d vtMid ;
if ( ! EgtMidVector( nId, nId, vtMid))
if ( ! EgtMidVector( nId, nRefId, vtMid))
return FALSE ;
// ritorno il vettore
VEC_FROM_3D( vtV, vtMid)
@@ -548,7 +548,7 @@ __stdcall EgtMidVector( int nId, double vtV[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtMidVector( int nId, int nRefId, Vector3d& vtV)
EgtMidVector( int nId, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -572,11 +572,11 @@ __stdcall EgtMidVector( int nId, int nRefId, Vector3d& vtV)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtAtParamVector( int nId, double dU, int nSide, double vtV[3])
__stdcall EgtAtParamVector( int nId, double dU, int nSide, int nRefId, double vtV[3])
{
// recupero il vettore
Vector3d vtAtPar ;
if ( ! EgtAtParamVector( nId, dU, nSide, nId, vtAtPar))
if ( ! EgtAtParamVector( nId, dU, nSide, nRefId, vtAtPar))
return FALSE ;
// ritorno il vettore
VEC_FROM_3D( vtV, vtAtPar)
@@ -585,7 +585,7 @@ __stdcall EgtAtParamVector( int nId, double dU, int nSide, double vtV[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtAtParamVector( int nId, double dU, int nSide, int nRefId, Vector3d& vtV)
EgtAtParamVector( int nId, double dU, int nSide, int nRefId, Vector3d& vtV)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -614,11 +614,11 @@ __stdcall EgtAtParamVector( int nId, double dU, int nSide, int nRefId, Vector3d&
//----------------------------------------------------------------------------
BOOL
__stdcall EgtFrame( int nId, double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3])
__stdcall EgtFrame( int nId, int nRefId, double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3])
{
// recupero il frame
Frame3d frFrame ;
if ( ! EgtFrame( nId, nId, frFrame))
if ( ! EgtFrame( nId, nRefId, frFrame))
return FALSE ;
// assegno l'origine
VEC_FROM_3D( ptOrig, frFrame.Orig())
@@ -633,7 +633,7 @@ __stdcall EgtFrame( int nId, double ptOrig[3], double vtX[3], double vtY[3], dou
//----------------------------------------------------------------------------
bool
__stdcall EgtFrame( int nId, int nRefId, Frame3d& frFrame)
EgtFrame( int nId, int nRefId, Frame3d& frFrame)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -694,11 +694,11 @@ __stdcall EgtCurveLengthAtPoint( int nId, double ptOn[3], double* pdLen)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveExtrusion( int nId, double vtExtr[3])
__stdcall EgtCurveExtrusion( int nId, int nRefId, double vtExtr[3])
{
// recupero il vettore estrusione
Vector3d vtTmp ;
if ( ! EgtCurveExtrusion( nId, nId, vtTmp))
if ( ! EgtCurveExtrusion( nId, nRefId, vtTmp))
return FALSE ;
// lo assegno
VEC_FROM_3D( vtExtr, vtTmp)
@@ -707,7 +707,7 @@ __stdcall EgtCurveExtrusion( int nId, double vtExtr[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtCurveExtrusion( int nId, int nRefId, Vector3d& vtExtr)
EgtCurveExtrusion( int nId, int nRefId, Vector3d& vtExtr)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -786,11 +786,11 @@ __stdcall EgtGetMinDistPntSidePointCurve( const double ptP[3], int nId, double v
//----------------------------------------------------------------------------
BOOL
__stdcall EgtCurveArcNormVersor( int nId, double vtNorm[3])
__stdcall EgtCurveArcNormVersor( int nId, int nRefId, double vtNorm[3])
{
// recupero il vettore normale
Vector3d vtTmp ;
if ( ! EgtCurveArcNormVersor( nId, nId, vtTmp))
if ( ! EgtCurveArcNormVersor( nId, nRefId, vtTmp))
return FALSE ;
// lo assegno
VEC_FROM_3D( vtNorm, vtTmp)
@@ -799,7 +799,7 @@ __stdcall EgtCurveArcNormVersor( int nId, double vtNorm[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtCurveArcNormVersor( int nId, int nRefId, Vector3d& vtNorm)
EgtCurveArcNormVersor( int nId, int nRefId, Vector3d& vtNorm)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -815,11 +815,11 @@ __stdcall EgtCurveArcNormVersor( int nId, int nRefId, Vector3d& vtNorm)
//----------------------------------------------------------------------------
BOOL
__stdcall EgtExtTextNormVersor( int nId, double vtNorm[3])
__stdcall EgtExtTextNormVersor( int nId, int nRefId, double vtNorm[3])
{
// recupero il vettore normale
Vector3d vtTmp ;
if ( ! EgtExtTextNormVersor( nId, nId, vtTmp))
if ( ! EgtExtTextNormVersor( nId, nRefId, vtTmp))
return FALSE ;
// lo assegno
VEC_FROM_3D( vtNorm, vtTmp)
@@ -828,7 +828,7 @@ __stdcall EgtExtTextNormVersor( int nId, double vtNorm[3])
//----------------------------------------------------------------------------
bool
__stdcall EgtExtTextNormVersor( int nId, int nRefId, Vector3d& vtNorm)
EgtExtTextNormVersor( int nId, int nRefId, Vector3d& vtNorm)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
@@ -860,7 +860,7 @@ __stdcall EgtPointToIdGlob( double ptP[3], int nId)
//-------------------------------------------------------------------------------
bool
__stdcall EgtPointToIdGlob( Point3d& ptP, int nId)
EgtPointToIdGlob( Point3d& ptP, int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -893,7 +893,7 @@ __stdcall EgtPointToIdLoc( double ptP[3], int nId)
//-------------------------------------------------------------------------------
bool
__stdcall EgtPointToIdLoc( Point3d& ptP, int nId)
EgtPointToIdLoc( Point3d& ptP, int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -926,7 +926,7 @@ __stdcall EgtVectorToIdGlob( double vtV[3], int nId)
//-------------------------------------------------------------------------------
bool
__stdcall EgtVectorToIdGlob( Vector3d& vtV, int nId)
EgtVectorToIdGlob( Vector3d& vtV, int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -959,7 +959,7 @@ __stdcall EgtVectorToIdLoc( double vtV[3], int nId)
//-------------------------------------------------------------------------------
bool
__stdcall EgtVectorToIdLoc( Vector3d& vtV, int nId)
EgtVectorToIdLoc( Vector3d& vtV, int nId)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
+390 -313
View File
@@ -15,66 +15,429 @@
#include "stdafx.h"
#include "API.h"
#include "API_Macro.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
using namespace std ;
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtMove( int nId, double vVtMove[3])
__stdcall EgtMove( int nId, double vVtMove[3], int nRefType)
{
INTVECTOR vIds ;
vIds.push_back( nId) ;
return ( EgtMove( vIds, vVtMove, nRefType) ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
bool
EgtMove( INTVECTOR& vIds, const Vector3d& vtMove, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// eseguo traslazione singola
if ( nId != GDB_ID_SEL) {
bOk = pGeomDB->Translate( nId, vVtMove) ;
// se traslazione espressa in locale
if ( nRefType == RTY_LOC) {
// verifico che tutti gli oggetti siano nello stesso riferimento
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
// ciclo sul vettore degli identificativi
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
// eseguo traslazione singola
if ( vIds[i] != GDB_ID_SEL) {
bOk = pGeomDB->Translate( vIds[i], vtMove) ;
}
// eseguo traslazione dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->Translate( nI, vtMove))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
}
// eseguo traslazione dei selezionati
// altrimenti in globale o in griglia
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->Translate( nI, vVtMove))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
Vector3d vtMoveG = vtMove ;
// se griglia, porto il vettore in globale
if ( nRefType == RTY_GRID)
vtMoveG.ToGlob( pGeomDB->GetGridFrame()) ;
// ciclo sul vettore degli identificativi
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
// eseguo traslazione singola
if ( vIds[i] != GDB_ID_SEL) {
bOk = pGeomDB->TranslateGlob( vIds[i], vtMoveG) ;
}
// eseguo traslazione dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->TranslateGlob( nI, vtMoveG))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtMove(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ",{" +
ToString( Vector3d( vVtMove)) + "})" +
string sIds ;
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
if ( i > 0)
sIds += "," ;
sIds += ( vIds[i] != GDB_ID_SEL ? ToString( vIds[i]) : "GDB_ID_SEL") ;
}
string sLua = "EgtMove({" + sIds + "},{" +
ToString( vtMove) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
return bOk ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtMoveGlob( int nId, double vVtMove[3])
__stdcall EgtRotate( int nId, double vPtAx[3], double vVtAx[3], double dAngRotDeg, int nRefType)
{
INTVECTOR vIds ;
vIds.push_back( nId) ;
return ( EgtRotate( vIds, vPtAx, vVtAx, dAngRotDeg, nRefType) ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
bool
EgtRotate( INTVECTOR& vIds, const Point3d& ptAx, const Vector3d& vtAx, double dAngRotDeg, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// eseguo traslazione singola
if ( nId != GDB_ID_SEL) {
bOk = pGeomDB->TranslateGlob( nId, vVtMove) ;
// se rotazione espressa in locale
if ( nRefType == RTY_LOC) {
// verifico che tutti gli oggetti siano nello stesso riferimento
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
// ciclo sul vettore degli identificativi
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
// eseguo rotazione singola
if ( vIds[i] != GDB_ID_SEL) {
bOk = pGeomDB->Rotate( vIds[i], ptAx, vtAx, dAngRotDeg) ;
}
// eseguo rotazione dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->Rotate( nI, ptAx, vtAx, dAngRotDeg))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
}
// eseguo traslazione dei selezionati
// altrimenti in globale o in griglia
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->TranslateGlob( nI, vVtMove))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
Point3d ptAxG = ptAx ;
Vector3d vtAxG = vtAx ;
// se griglia, porto punto e vettore in globale
if ( nRefType == RTY_GRID) {
ptAxG.ToGlob( pGeomDB->GetGridFrame()) ;
vtAxG.ToGlob( pGeomDB->GetGridFrame()) ;
}
// ciclo sul vettore degli identificativi
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
// eseguo rotazione singola
if ( vIds[i] != GDB_ID_SEL) {
bOk = pGeomDB->RotateGlob( vIds[i], ptAxG, vtAxG, dAngRotDeg) ;
}
// eseguo rotazione dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->RotateGlob( nI, ptAxG, vtAxG, dAngRotDeg))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtMoveGlob(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ",{" +
ToString( Vector3d( vVtMove)) + "})" +
string sIds ;
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
if ( i > 0)
sIds += "," ;
sIds += ( vIds[i] != GDB_ID_SEL ? ToString( vIds[i]) : "GDB_ID_SEL") ;
}
string sLua = "EgtRotate({" + sIds + "},{" +
ToString( ptAx) + "},{" +
ToString( vtAx) + "}," +
ToString( dAngRotDeg) + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtScale( int nId, const double vOrig[3],
const double vX[3], const double vY[3], const double vZ[3],
double dCoeffX, double dCoeffY, double dCoeffZ, int nRefType)
{
INTVECTOR vIds ;
vIds.push_back( nId) ;
// costruisco il riferimento di scalatura
Frame3d frFrame ;
if ( ! frFrame.Set( vOrig, vX, vY, vZ))
return FALSE ;
// eseguo
return ( EgtScale( vIds, frFrame, dCoeffX, dCoeffY, dCoeffZ, nRefType) ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
bool
EgtScale( INTVECTOR& vIds, const Frame3d& frRef,
double dCoeffX, double dCoeffY, double dCoeffZ, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// se scalatura espressa in locale
if ( nRefType == RTY_LOC) {
// verifico che tutti gli oggetti siano nello stesso riferimento
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
// ciclo sul vettore degli identificativi
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
// eseguo scalatura singola
if ( vIds[i] != GDB_ID_SEL) {
bOk = bOk && pGeomDB->Scale( vIds[i], frRef, dCoeffX, dCoeffY, dCoeffZ) ;
}
// eseguo scalatura dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->Scale( nI, frRef, dCoeffX, dCoeffY, dCoeffZ))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
}
// altrimenti in globale o in griglia
else {
Frame3d frRefG = frRef ;
// se griglia, porto riferimento in globale
if ( nRefType == RTY_GRID)
frRefG.ToGlob( pGeomDB->GetGridFrame()) ;
// ciclo sul vettore degli identificativi
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
// eseguo scalatura singola
if ( vIds[i] != GDB_ID_SEL) {
bOk = bOk && pGeomDB->ScaleGlob( vIds[i], frRefG, dCoeffX, dCoeffY, dCoeffZ) ;
}
// eseguo scalatura dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->ScaleGlob( nI, frRefG, dCoeffX, dCoeffY, dCoeffZ))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sIds ;
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
if ( i > 0)
sIds += "," ;
sIds += ( vIds[i] != GDB_ID_SEL ? ToString( vIds[i]) : "GDB_ID_SEL") ;
}
string sLua = "EgtScale({" + sIds + "},{{" +
ToString( frRef.Orig()) + "},{" +
ToString( frRef.VersX()) + "},{" +
ToString( frRef.VersY()) + "},{" +
ToString( frRef.VersZ()) + "}}," +
ToString( dCoeffX) + "," +
ToString( dCoeffY) + "," +
ToString( dCoeffZ) + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtMirror( int nId, const double vPnt[3], const double vN[3], int nRefType)
{
INTVECTOR vIds ;
vIds.push_back( nId) ;
return ( EgtMirror( vIds, vPnt, vN, nRefType) ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
bool
EgtMirror( INTVECTOR& vIds, const Point3d& ptP, const Vector3d& vtN, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// se specularità espressa in locale
if ( nRefType == RTY_LOC) {
// verifico che tutti gli oggetti siano nello stesso riferimento
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
// ciclo sul vettore degli identificativi
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
// eseguo specularità singola
if ( vIds[i] != GDB_ID_SEL) {
bOk = pGeomDB->Mirror( vIds[i], ptP, vtN) ;
}
// eseguo specularità dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->Mirror( nI, ptP, vtN))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
}
// altrimenti in globale o in griglia
else {
Point3d ptPG = ptP ;
Vector3d vtNG = vtN ;
// se griglia, porto riferimento in globale
if ( nRefType == RTY_GRID) {
ptPG.ToGlob( pGeomDB->GetGridFrame()) ;
vtNG.ToGlob( pGeomDB->GetGridFrame()) ;
}
// ciclo sul vettore degli identificativi
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
// eseguo specularità singola
if ( vIds[i] != GDB_ID_SEL) {
bOk = pGeomDB->MirrorGlob( vIds[i], ptPG, vtNG) ;
}
// eseguo specularità dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->MirrorGlob( nI, ptPG, vtNG))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sIds ;
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
if ( i > 0)
sIds += "," ;
sIds += ( vIds[i] != GDB_ID_SEL ? ToString( vIds[i]) : "GDB_ID_SEL") ;
}
string sLua = "EgtMirror({" + sIds + "},{" +
ToString( ptP) + "},{" +
ToString( vtN) + "}," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return bOk ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtShear( int nId, const double vPnt[3], const double vN[3],
const double vDir[3], double dCoeff, int nRefType)
{
INTVECTOR vIds ;
vIds.push_back( nId) ;
return ( EgtShear( vIds, vPnt, vN, vDir, dCoeff, nRefType) ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
bool
EgtShear( INTVECTOR& vIds, const Point3d& ptP, const Vector3d& vtN,
const Vector3d& vtDir, double dCoeff, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// se stiramento espresso in locale
if ( nRefType == RTY_LOC) {
// verifico che tutti gli oggetti siano nello stesso riferimento
bOk = bOk && VerifySameFrame( pGeomDB, vIds) ;
// ciclo sul vettore degli identificativi
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
// eseguo stiramento singolo
if ( vIds[i] != GDB_ID_SEL) {
bOk = pGeomDB->Shear( vIds[i], ptP, vtN, vtDir, dCoeff) ;
}
// eseguo stiramento dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->Shear( nI, ptP, vtN, vtDir, dCoeff))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
}
// altrimenti in globale o in griglia
else {
Point3d ptPG = ptP ;
Vector3d vtNG = vtN ;
Vector3d vtDirG = vtDir ;
// se griglia, porto riferimento in globale
if ( nRefType == RTY_GRID) {
ptPG.ToGlob( pGeomDB->GetGridFrame()) ;
vtNG.ToGlob( pGeomDB->GetGridFrame()) ;
vtDirG.ToGlob( pGeomDB->GetGridFrame()) ;
}
// ciclo sul vettore degli identificativi
for ( size_t i = 0 ; i < vIds.size() && bOk ; ++ i) {
// eseguo stiramento singolo
if ( vIds[i] != GDB_ID_SEL) {
bOk = pGeomDB->ShearGlob( vIds[i], ptPG, vtNG, vtDirG, dCoeff) ;
}
// eseguo stiramento dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->ShearGlob( nI, ptPG, vtNG, vtDirG, dCoeff))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sIds ;
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
if ( i > 0)
sIds += "," ;
sIds += ( vIds[i] != GDB_ID_SEL ? ToString( vIds[i]) : "GDB_ID_SEL") ;
}
string sLua = "EgtShear({" + sIds + "},{" +
ToString( ptP) + "},{" +
ToString( vtN) + "},{" +
ToString( vtDir) + "}," +
ToString( dCoeff) + "," +
RefTypeToString( nRefType) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
@@ -106,72 +469,6 @@ __stdcall EgtMoveGroup( int nId, double vVtMove[3])
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtRotate( int nId, double vPtAx[3], double vVtAx[3], double dAngRotDeg)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// eseguo rotazione singola
if ( nId != GDB_ID_SEL) {
bOk = pGeomDB->Rotate( nId, vPtAx, vVtAx, dAngRotDeg) ;
}
// eseguo rotazione dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->Rotate( nI, vPtAx, vVtAx, dAngRotDeg))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtRotate(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ",{" +
ToString( Point3d( vPtAx)) + "},{" +
ToString( Vector3d( vVtAx)) + "}," +
ToString( dAngRotDeg) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtRotateGlob( int nId, double vPtAx[3], double vVtAx[3], double dAngRotDeg)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// eseguo rotazione singola
if ( nId != GDB_ID_SEL) {
bOk = pGeomDB->RotateGlob( nId, vPtAx, vVtAx, dAngRotDeg) ;
}
// eseguo rotazione dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->RotateGlob( nI, vPtAx, vVtAx, dAngRotDeg))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtRotateGlob(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ",{" +
ToString( Point3d( vPtAx)) + "},{" +
ToString( Vector3d( vVtAx)) + "}," +
ToString( dAngRotDeg) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtRotateGroup( int nId, double vPtAx[3], double vVtAx[3], double dAngRotDeg)
@@ -196,92 +493,6 @@ __stdcall EgtRotateGroup( int nId, double vPtAx[3], double vVtAx[3], double dAng
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtScale( int nId, const double vOrig[3],
const double vX[3], const double vY[3], const double vZ[3],
double dCoeffX, double dCoeffY, double dCoeffZ)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// costruisco il riferimento di scalatura
Frame3d frFrame ;
if ( ! frFrame.Set( vOrig, vX, vY, vZ))
bOk = false ;
// eseguo scalatura singola
if ( nId != GDB_ID_SEL) {
bOk = bOk && pGeomDB->Scale( nId, frFrame, dCoeffX, dCoeffY, dCoeffZ) ;
}
// eseguo scalatura dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->Scale( nI, frFrame, dCoeffX, dCoeffY, dCoeffZ))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtScale(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ",{{" +
ToString( frFrame.Orig()) + "},{" +
ToString( frFrame.VersX()) + "},{" +
ToString( frFrame.VersY()) + "},{" +
ToString( frFrame.VersZ()) + "}}," +
ToString( dCoeffX) + "," +
ToString( dCoeffY) + "," +
ToString( dCoeffZ) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtScaleGlob( int nId, const double vOrig[3],
const double vX[3], const double vY[3], const double vZ[3],
double dCoeffX, double dCoeffY, double dCoeffZ)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// costruisco il riferimento di scalatura
Frame3d frFrame ;
if ( ! frFrame.Set( vOrig, vX, vY, vZ))
bOk = false ;
// eseguo scalatura singola
if ( nId != GDB_ID_SEL) {
bOk = bOk && pGeomDB->ScaleGlob( nId, frFrame, dCoeffX, dCoeffY, dCoeffZ) ;
}
// eseguo scalatura dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->ScaleGlob( nI, frFrame, dCoeffX, dCoeffY, dCoeffZ))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtScaleGlob(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ",{{" +
ToString( frFrame.Orig()) + "},{" +
ToString( frFrame.VersX()) + "},{" +
ToString( frFrame.VersY()) + "},{" +
ToString( frFrame.VersZ()) + "}}," +
ToString( dCoeffX) + "," +
ToString( dCoeffY) + "," +
ToString( dCoeffZ) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtScaleGroup( int nId, const double vOrig[3],
@@ -312,70 +523,6 @@ __stdcall EgtScaleGroup( int nId, const double vOrig[3],
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtMirror( int nId, const double vPnt[3], const double vN[3])
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// eseguo specularità singola
if ( nId != GDB_ID_SEL) {
bOk = pGeomDB->Mirror( nId, vPnt, vN) ;
}
// eseguo specularità dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->Mirror( nI, vPnt, vN))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtMirror(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ",{" +
ToString( Point3d( vPnt)) + "},{" +
ToString( Vector3d( vN)) + "})" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtMirrorGlob( int nId, const double vPnt[3], const double vN[3])
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// eseguo specularità singola
if ( nId != GDB_ID_SEL) {
bOk = pGeomDB->MirrorGlob( nId, vPnt, vN) ;
}
// eseguo specularità dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->MirrorGlob( nI, vPnt, vN))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtMirrorGlob(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ",{" +
ToString( Point3d( vPnt)) + "},{" +
ToString( Vector3d( vN)) + "})" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtMirrorGroup( int nId, const double vPnt[3], const double vN[3])
@@ -400,76 +547,6 @@ __stdcall EgtMirrorGroup( int nId, const double vPnt[3], const double vN[3])
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtShear( int nId, const double vPnt[3], const double vN[3],
const double vDir[3], double dCoeff)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// eseguo stiramento singolo
if ( nId != GDB_ID_SEL) {
bOk = pGeomDB->Shear( nId, vPnt, vN, vDir, dCoeff) ;
}
// eseguo stiramento dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->Shear( nI, vPnt, vN, vDir, dCoeff))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtShear(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ",{" +
ToString( Point3d( vPnt)) + "},{" +
ToString( Vector3d( vN)) + "},{" +
ToString( Vector3d( vDir)) + "}," +
ToString( dCoeff) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtShearGlob( int nId, const double vPnt[3], const double vN[3],
const double vDir[3], double dCoeff)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, FALSE)
bool bOk = true ;
// eseguo stiramento singolo
if ( nId != GDB_ID_SEL) {
bOk = pGeomDB->ShearGlob( nId, vPnt, vN, vDir, dCoeff) ;
}
// eseguo stiramento dei selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL && bOk) {
if ( ! pGeomDB->ShearGlob( nI, vPnt, vN, vDir, dCoeff))
bOk = false ;
nI = pGeomDB->GetNextSelectedObj() ;
}
}
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
string sLua = "EgtShearGlob(" + ( nId != GDB_ID_SEL ? ToString( nId) : "GDB_ID_SEL") + ",{" +
ToString( Point3d( vPnt)) + "},{" +
ToString( Vector3d( vN)) + "},{" +
ToString( Vector3d( vDir)) + "}," +
ToString( dCoeff) + ")" +
" -- Ok=" + ToString( bOk) ;
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
}
// restituisco risultato
return ( bOk ? TRUE : FALSE) ;
}
//-------------------------------------------------------------------------------
BOOL
__stdcall EgtShearGroup( int nId, const double vPnt[3], const double vN[3],
+6 -6
View File
@@ -97,7 +97,7 @@ __stdcall EgtSetGridFrame( const double ptOrig[3], const double vX[3], const dou
//-----------------------------------------------------------------------------
bool
__stdcall EgtSetGridFrame( const Frame3d& frFrame)
EgtSetGridFrame( const Frame3d& frFrame)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -135,7 +135,7 @@ __stdcall EgtGetGridFrame( double ptOrig[3], double vX[3], double vY[3], double
//-----------------------------------------------------------------------------
bool
__stdcall EgtGetGridFrame( int nRefId, Frame3d& frFrame)
EgtGetGridFrame( int nRefId, Frame3d& frFrame)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -155,7 +155,7 @@ __stdcall EgtGetGridFrame( int nRefId, Frame3d& frFrame)
//-----------------------------------------------------------------------------
bool
__stdcall EgtGetGridVersZ( int nRefId, Vector3d& vtVersZ)
EgtGetGridVersZ( int nRefId, Vector3d& vtVersZ)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
@@ -194,7 +194,7 @@ __stdcall EgtOpenFile( const wchar_t* wsFilePath)
//-----------------------------------------------------------------------------
bool
__stdcall EgtOpenFile( const string& sFilePath)
EgtOpenFile( const string& sFilePath)
{
// reinizializzazione (con pulizia) del DB geometrico
if ( ! EgtNewFile())
@@ -212,7 +212,7 @@ __stdcall EgtImportFile( const wchar_t* wsFilePath)
//-----------------------------------------------------------------------------
bool
__stdcall EgtImportFile( const string& sFilePath)
EgtImportFile( const string& sFilePath)
{
// carico il file
return GetCurrGeomDB()->Load( sFilePath) ;
@@ -227,7 +227,7 @@ __stdcall EgtSaveFile( const wchar_t* wsFilePath, int nFlag)
//-----------------------------------------------------------------------------
bool
__stdcall EgtSaveFile( const string& sFilePath, int nFlag)
EgtSaveFile( const string& sFilePath, int nFlag)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
+6 -6
View File
@@ -80,7 +80,7 @@ __stdcall EgtSetBackground( const int TopCol[4], const int BottomCol[4], BOOL bR
//-----------------------------------------------------------------------------
bool
__stdcall EgtSetBackground( Color TopCol, Color BottomCol, bool bRedraw)
EgtSetBackground( Color TopCol, Color BottomCol, bool bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
@@ -100,7 +100,7 @@ __stdcall EgtSetMarkAttribs( const int MarkCol[4])
//-----------------------------------------------------------------------------
bool
__stdcall EgtSetMarkAttribs( Color MarkCol)
EgtSetMarkAttribs( Color MarkCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
@@ -117,7 +117,7 @@ __stdcall EgtSetSelSurfAttribs( const int SelSurfCol[4])
//-----------------------------------------------------------------------------
bool
__stdcall EgtSetSelSurfAttribs( Color SelSurfCol)
EgtSetSelSurfAttribs( Color SelSurfCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
@@ -134,7 +134,7 @@ __stdcall EgtSetGeoLineAttribs( const int GlCol[4])
//-----------------------------------------------------------------------------
bool
__stdcall EgtSetGeoLineAttribs( Color GlCol)
EgtSetGeoLineAttribs( Color GlCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
@@ -151,7 +151,7 @@ __stdcall EgtSetGeoTriaAttribs( const int GtCol[4])
//-----------------------------------------------------------------------------
bool
__stdcall EgtSetGeoTriaAttribs( Color GtCol)
EgtSetGeoTriaAttribs( Color GtCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
@@ -168,7 +168,7 @@ __stdcall EgtSetWinRectAttribs( BOOL bOutline, const int WrCol[4])
//-----------------------------------------------------------------------------
bool
__stdcall EgtSetWinRectAttribs( bool bOutline, Color WrCol)
EgtSetWinRectAttribs( bool bOutline, Color WrCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
+1 -1
View File
@@ -85,7 +85,7 @@ __stdcall EgtTscExecFile( const wchar_t* wsFilePath)
//-----------------------------------------------------------------------------
bool
__stdcall EgtTscExecFile( const string& sFilePath)
EgtTscExecFile( const string& sFilePath)
{
ICmdParser* pTscExec = GetCurrTscExecutor() ;
VERIFY_TSCEXEC( pTscExec, FALSE)
+70 -6
View File
@@ -13,6 +13,7 @@
#include "stdafx.h"
#include "AuxTools.h"
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EgkExtText.h"
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EGnStringUtils.h"
@@ -21,7 +22,7 @@ using namespace std ;
//----------------------------------------------------------------------------
const char*
__stdcall SepToString( int nSep)
SepToString( int nSep)
{
switch ( nSep) {
default :
@@ -34,7 +35,7 @@ __stdcall SepToString( int nSep)
//----------------------------------------------------------------------------
int
__stdcall StringToSep( const string& sSep)
StringToSep( const string& sSep)
{
string sTmp = sSep ;
ToUpper( sTmp) ;
@@ -52,7 +53,7 @@ __stdcall StringToSep( const string& sSep)
//----------------------------------------------------------------------------
const char*
__stdcall RefTypeToString( int nRefType)
RefTypeToString( int nRefType)
{
switch ( nRefType) {
case RTY_GLOB : return "'GLOB'" ;
@@ -64,7 +65,7 @@ __stdcall RefTypeToString( int nRefType)
//----------------------------------------------------------------------------
int
__stdcall StringToRefType( const string& sRefType)
StringToRefType( const string& sRefType)
{
string sTmp = sRefType ;
ToUpper( sTmp) ;
@@ -78,9 +79,23 @@ __stdcall StringToRefType( const string& sRefType)
return RTY_LOC ;
}
//----------------------------------------------------------------------------
int
StringToRefId( const string& sRefId)
{
string sTmp = sRefId ;
ToUpper( sTmp) ;
if ( sTmp == "GLOB")
return GDB_ID_ROOT ;
else if ( sTmp == "GRID")
return GDB_ID_GRID ;
// default
return GDB_ID_ROOT ;
}
//----------------------------------------------------------------------------
const char*
__stdcall ETxtInsPosToString( int nETxtInsPos)
ETxtInsPosToString( int nETxtInsPos)
{
switch ( nETxtInsPos) {
case ETXT_IPTL : return "'TL'" ;
@@ -98,7 +113,7 @@ __stdcall ETxtInsPosToString( int nETxtInsPos)
//----------------------------------------------------------------------------
int
__stdcall ETxtInsPosToString( const string& sETxtInsPos)
ETxtInsPosToString( const string& sETxtInsPos)
{
string sInsPos = sETxtInsPos ;
ToUpper( sInsPos) ;
@@ -122,4 +137,53 @@ __stdcall ETxtInsPosToString( const string& sETxtInsPos)
return ETXT_IPBR ;
// default
return ETXT_IPBL ;
}
//----------------------------------------------------------------------------
bool
VerifySameFrame( IGeomDB* pGeomDB, INTVECTOR& vIds)
{
// verifico puntatore a GeomDB
if ( pGeomDB == nullptr)
return false ;
// ciclo sul vettore degli identificativi
bool bFirst = true ;
Frame3d frFirst ;
for ( size_t i = 0 ; i < vIds.size() ; ++ i) {
// se si deve agire su un singolo oggetto ( gruppo o entità)
if ( vIds[i] != GDB_ID_SEL) {
Frame3d frLoc ;
if ( ! pGeomDB->GetGroupGlobFrame( vIds[i], frLoc) &&
! pGeomDB->GetGlobFrame( vIds[i], frLoc))
return false ;
if ( bFirst) {
frFirst = frLoc ;
bFirst = false ;
}
else {
if ( ! AreSameFrame( frFirst, frLoc))
return false ;
}
}
// altrimenti si deve agire sugli oggetti selezionati
else {
int nI = pGeomDB->GetFirstSelectedObj() ;
while ( nI != GDB_ID_NULL) {
Frame3d frLoc ;
if ( ! pGeomDB->GetGlobFrame( nI, frLoc))
return false ;
if ( bFirst) {
frFirst = frLoc ;
return false ;
}
else {
if ( ! AreSameFrame( frFirst, frLoc))
return false ;
}
// passo alla successiva
nI = pGeomDB->GetNextSelectedObj() ;
}
}
}
return true ;
}
+14 -6
View File
@@ -12,14 +12,22 @@
//----------------------------------------------------------------------------
#include <string>
#include "/EgtDev/Include/EgtNumCollection.h"
class IGeomDB ;
//----------------------------------------------------------------------------
// Tipo punto per creazione rette e archi
const char* __stdcall SepToString( int nSep) ;
int __stdcall StringToSep( const std::string& sSep) ;
const char* SepToString( int nSep) ;
int StringToSep( const std::string& sSep) ;
// Tipo riferimento in cui sono espressi i dati geometrici
const char* __stdcall RefTypeToString( int nRefType) ;
int __stdcall StringToRefType( const std::string& sRefType) ;
const char* RefTypeToString( int nRefType) ;
int StringToRefType( const std::string& sRefType) ;
// Indice equivalente a riferimento in cui restituire il dato geometrico
int StringToRefId( const std::string& sRefId) ;
// Posizione inserimento testo
const char* __stdcall ETxtInsPosToString( int nETxtInsPos) ;
int __stdcall ETxtInsPosToString( const std::string& sETxtInsPos) ;
const char* ETxtInsPosToString( int nETxtInsPos) ;
int ETxtInsPosToString( const std::string& sETxtInsPos) ;
// Verifica che tutti gli oggetti dell'insieme abbiano lo stesso riferimento
bool VerifySameFrame( IGeomDB* pGeomDB, INTVECTOR& vIds) ;
BIN
View File
Binary file not shown.
+1
View File
@@ -49,6 +49,7 @@ bool LuaGetParam( lua_State* L, int nInd, INTVECTOR& vPar) ;
bool LuaGetParam( lua_State* L, int nInd, PNTVECTOR& vPar) ;
bool LuaGetParam( lua_State* L, int nInd, PNTUVECTOR& vParW) ;
bool LuaGetRefType( lua_State* L, int nInd, int& nRefType) ;
bool LuaGetRefId( lua_State* L, int nInd, int& nRefId) ;
bool LuaClearStack( lua_State* L) ;
//
bool LuaSetReturn( lua_State* L /*, nil */) ;
+17
View File
@@ -287,6 +287,23 @@ LuaGetRefType( lua_State* L, int nInd, int& nRefType)
return true ;
}
//----------------------------------------------------------------------------
bool
LuaGetRefId( lua_State* L, int nInd, int& nRefId)
{
// se parametro è numero intero
if ( LuaGetParam( L, nInd, nRefId))
return true ;
// se parametro è stringa
string sFlag ;
if ( LuaGetParam( L, nInd, sFlag)) {
nRefId = StringToRefId( sFlag) ;
return true ;
}
// non trovato
return false ;
}
//----------------------------------------------------------------------------
bool
LuaClearStack( lua_State* L)
+30 -22
View File
@@ -332,19 +332,18 @@ LuaCreateCurveArc2PVN( lua_State* L)
static int
LuaCreateCurveBezier( lua_State* L)
{
// 3 parametri : ParentId, Degree, CtrlPnts
// 3 o 4 parametri : ParentId, Degree, CtrlPnts [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nDegree ;
LuaCheckParam( L, 2, nDegree)
PNTVECTOR vPnt ;
LuaCheckParam( L, 3, vPnt)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 4, nRefType) ;
LuaClearStack( L) ;
// il numero dei punti deve essere pari al grado + 1
if ( vPnt.size() != nDegree + 1)
return luaL_error( L, "Wrong Control Points Number") ;
// creo la curva
int nId = EgtCreateCurveBezier( nParentId, nDegree, vPnt) ;
int nId = EgtCreateCurveBezier( nParentId, nDegree, vPnt, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -357,19 +356,18 @@ LuaCreateCurveBezier( lua_State* L)
static int
LuaCreateCurveBezierRational( lua_State* L)
{
// 3 parametri : ParentId, Degree, CtrlPntWs
// 3 o 4 parametri : ParentId, Degree, CtrlPntWs [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nDegree ;
LuaCheckParam( L, 2, nDegree)
PNTUVECTOR vPntW ;
LuaCheckParam( L, 3, vPntW)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 4, nRefType) ;
LuaClearStack( L) ;
// il numero dei punti deve essere pari al grado + 1
if ( vPntW.size() != nDegree + 1)
return luaL_error( L, "Wrong Control Points Number") ;
// creo la curva
int nId = EgtCreateCurveBezierRational( nParentId, nDegree, vPntW) ;
int nId = EgtCreateCurveBezierRational( nParentId, nDegree, vPntW, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -382,7 +380,7 @@ LuaCreateCurveBezierRational( lua_State* L)
static int
LuaCreateCurveBezierFromArc( lua_State* L)
{
// 3 parametri : ParentId, ArcId[ , Erase]
// 2 o 3 parametri : ParentId, ArcId[ , Erase]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nArcId ;
@@ -428,7 +426,7 @@ LuaCreateCurveCompo( lua_State* L)
static int
LuaCreateCurveCompoByChain( lua_State* L)
{
// 3 o 4 parametri : ParentId, nIds, PtNear [, Erase]
// 3 o 4 o 5 parametri : ParentId, nIds, PtNear [, Erase] [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
INTVECTOR vIds ;
@@ -436,11 +434,14 @@ LuaCreateCurveCompoByChain( lua_State* L)
Point3d ptNear ;
LuaCheckParam( L, 3, ptNear)
bool bErase = true ;
if ( lua_gettop( L) >= 4)
LuaCheckParam( L, 4, bErase) ;
int nRefType = RTY_DEFAULT ;
if ( LuaGetParam( L, 4, bErase))
LuaGetRefType( L, 5, nRefType) ;
else
LuaGetRefType( L, 4, nRefType) ;
LuaClearStack( L) ;
// creo la curva composita
int nId = EgtCreateCurveCompoByChain( nParentId, vIds, ptNear, ( bErase ? TRUE : FALSE)) ;
int nId = EgtCreateCurveCompoByChain( nParentId, vIds, ptNear, bErase, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -453,17 +454,20 @@ LuaCreateCurveCompoByChain( lua_State* L)
static int
LuaCreateCurveCompoFromPoints( lua_State* L)
{
// 2 parametri : ParentId, ptPs
// 2 o 3 parametri : ParentId, ptPs [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
PNTVECTOR vPnt ;
LuaCheckParam( L, 2, vPnt)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 3, nRefType) ;
LuaClearStack( L) ;
PolyLine PL ;
// creo una polilinea a partire dai punti
for ( size_t i = 0 ; i < vPnt.size() ; ++ i)
PL.AddUPoint( 0, vPnt[i]) ;
// creo la curva composita
int nId = EgtCreateCurveCompoFromPoints( nParentId, PL) ;
int nId = EgtCreateCurveCompoFromPoints( nParentId, PL, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -476,17 +480,20 @@ LuaCreateCurveCompoFromPoints( lua_State* L)
static int
LuaCreateCurveCompoFromPointBulges( lua_State* L)
{
// 2 parametri : ParentId, ptPBs
// 2 o 3 parametri : ParentId, ptPBs [, sRefType]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
PNTUVECTOR vPntB ;
LuaCheckParam( L, 2, vPntB)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 3, nRefType) ;
LuaClearStack( L) ;
// creo un poliarco a partire dai punti con bulge
PolyArc PA ;
for ( size_t i = 0 ; i < vPntB.size() ; ++ i)
PA.AddUPoint( 0, vPntB[i].first, vPntB[i].second) ;
// creo la curva composita
int nId = EgtCreateCurveCompoFromPointBulges( nParentId, PA) ;
int nId = EgtCreateCurveCompoFromPointBulges( nParentId, PA, nRefType) ;
// restituisco il risultato
if ( nId != GDB_ID_NULL)
LuaSetReturn( L, nId) ;
@@ -499,7 +506,7 @@ LuaCreateCurveCompoFromPointBulges( lua_State* L)
static int
LuaCreateCurveCompoByApprox( lua_State* L)
{
// 4 parametri : ParentId, nSouId, sType, dLinTol
// 3 o 4 parametri : ParentId, nSouId, sType [, dLinTol]
int nParentId ;
LuaCheckParam( L, 1, nParentId)
int nSouId ;
@@ -510,8 +517,9 @@ LuaCreateCurveCompoByApprox( lua_State* L)
ToUpper( sTemp) ;
if ( sTemp == "LINES")
bArcsVsLines = false ;
double dLinTol ;
LuaCheckParam( L, 4, dLinTol)
double dLinTol = 0.01 ;
if ( lua_gettop( L) >= 4)
LuaCheckParam( L, 4, dLinTol)
LuaClearStack( L) ;
// creo la curva composita
int nId = EgtCreateCurveCompoByApprox( nParentId, nSouId, bArcsVsLines, dLinTol) ;
+46 -5
View File
@@ -16,23 +16,44 @@
#include "LUA.h"
#include "API.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EgnStringUtils.h"
#include "/EgtDev/Extern/Lua/Include/lua.hpp"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaChangeGroupFrame( lua_State* L)
{
// 2 o 3 parametri : Id, frNewRef [, sRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Frame3d frNewRef ;
LuaCheckParam( L, 2, frNewRef)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 3, nRefType) ;
LuaClearStack( L) ;
// modifica del riferimento
bool bOk = ( EgtChangeGroupFrame( nId, frNewRef, nRefType) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaChangeVectorBase( lua_State* L)
{
// 2 parametri : Id, ptBase
// 2 o 3 parametri : Id, ptBase [, sRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptBase ;
LuaCheckParam( L, 2, ptBase)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 3, nRefType) ;
LuaClearStack( L) ;
// modifica del testo
bool bOk = ( EgtChangeVectorBase( nId, ptBase.v) != FALSE) ;
// modifica del punto base
bool bOk = ( EgtChangeVectorBase( nId, ptBase.v, nRefType) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
@@ -56,6 +77,24 @@ LuaInvertSurf( lua_State* L)
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSurfTmDoSewing( lua_State* L)
{
// 1 o 2 parametri : Id/s [, bErase]
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
bool bErase = true ;
if ( lua_gettop( L) >= 2)
LuaCheckParam( L, 2, bErase) ;
LuaClearStack( L) ;
// eseguo inversione superfici
bool bOk = EgtSurfTmDoSewing( vId, bErase) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaModifyText( lua_State* L)
@@ -67,7 +106,7 @@ LuaModifyText( lua_State* L)
LuaCheckParam( L, 2, sNewText)
LuaClearStack( L) ;
// modifica del testo
bool bOk = ( EgtModifyText( nId, sNewText) != FALSE) ;
bool bOk = EgtModifyText( nId, sNewText) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
@@ -83,7 +122,7 @@ LuaChangeTextFont( lua_State* L)
LuaCheckParam( L, 2, sNewFont)
LuaClearStack( L) ;
// modifica del testo
bool bOk = ( EgtChangeTextFont( nId, sNewFont) != FALSE) ;
bool bOk = EgtChangeTextFont( nId, sNewFont) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
@@ -157,8 +196,10 @@ bool
LuaInstallGdbModify( lua_State* L)
{
try {
lua_register( L, "EgtChangeGroupFrame", LuaChangeGroupFrame) ;
lua_register( L, "EgtChangeVectorBase", LuaChangeVectorBase) ;
lua_register( L, "EgtInvertSurf", LuaInvertSurf) ;
lua_register( L, "EgtSurfTmDoSewing", LuaSurfTmDoSewing) ;
lua_register( L, "EgtModifyText", LuaModifyText) ;
lua_register( L, "EgtChangeTextFont", LuaChangeTextFont) ;
lua_register( L, "EgtFlipText", LuaFlipText) ;
+27 -39
View File
@@ -16,6 +16,7 @@
#include "LUA.h"
#include "API.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Extern/Lua/Include/lua.hpp"
@@ -69,14 +70,16 @@ LuaOffsetCurve( lua_State* L)
static int
LuaModifyCurveStartPoint( lua_State* L)
{
// 2 parametri : Id, NewStart
// 2 o 3 parametri : Id, NewStart [, sRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptStart ;
LuaCheckParam( L, 2, ptStart)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 3, nRefType) ;
LuaClearStack( L) ;
// modifico il punto iniziale
bool bOk = ( EgtModifyCurveStartPoint( nId, ptStart.v) ? true : false) ;
bool bOk = ( EgtModifyCurveStartPoint( nId, ptStart.v, nRefType) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
@@ -85,14 +88,16 @@ LuaModifyCurveStartPoint( lua_State* L)
static int
LuaModifyCurveEndPoint( lua_State* L)
{
// 2 parametri : Id, NewEnd
// 2 o 3 parametri : Id, NewEnd [, sRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptEnd ;
LuaCheckParam( L, 2, ptEnd)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 3, nRefType) ;
LuaClearStack( L) ;
// modifico il punto finale
bool bOk = ( EgtModifyCurveEndPoint( nId, ptEnd.v) != FALSE) ;
bool bOk = ( EgtModifyCurveEndPoint( nId, ptEnd.v, nRefType) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
@@ -101,37 +106,16 @@ LuaModifyCurveEndPoint( lua_State* L)
static int
LuaModifyCurveExtrusion( lua_State* L)
{
// 2 parametri : Id/s, vtExtr
// 2 o 3 parametri : Id/s, vtExtr [, sRefType]
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Vector3d vtExtr ;
LuaCheckParam( L, 2, vtExtr)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 3, nRefType) ;
LuaClearStack( L) ;
// modifico il vettore estrusione
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( EgtModifyCurveExtrusion( vId[i], vtExtr.v) == FALSE)
bOk = false ;
}
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//----------------------------------------------------------------------------
static int
LuaSetCurveExtrusionFromGrid( lua_State* L)
{
// 1 parametro : Id/s
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
LuaClearStack( L) ;
// modifico il vettore estrusione
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( EgtSetCurveExtrusionFromGrid( vId[i]) == FALSE)
bOk = false ;
}
bool bOk = EgtModifyCurveExtrusion( vId, vtExtr, nRefType) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
@@ -244,16 +228,18 @@ LuaTrimCurveStartEndAtParam( lua_State* L)
static int
LuaTrimExtendCurveByLen( lua_State* L)
{
// 3 parametri : Id, dLen, ptNear
// 3 o 4 parametri : Id, dLen, ptNear [, sRefType]
int nId ;
LuaCheckParam( L, 1, nId)
double dLen ;
LuaCheckParam( L, 2, dLen)
Point3d ptNear ;
LuaCheckParam( L, 3, ptNear)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 4, nRefType) ;
LuaClearStack( L) ;
// taglio o allungo la curva nell'estremo più vicino al punto
bool bOk = ( EgtTrimExtendCurveByLen( nId, dLen, ptNear.v) != FALSE) ;
bool bOk = ( EgtTrimExtendCurveByLen( nId, dLen, ptNear.v, nRefType) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
@@ -262,14 +248,16 @@ LuaTrimExtendCurveByLen( lua_State* L)
static int
LuaSplitCurveAtPoint( lua_State* L)
{
// 2 parametri : Id, ptOn
// 2 o 3 parametri : Id, ptOn [, sRefType]
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 3, nRefType) ;
LuaClearStack( L) ;
// divido la curva nel punto
bool bOk = ( EgtSplitCurveAtPoint( nId, ptOn.v) != FALSE) ;
bool bOk = ( EgtSplitCurveAtPoint( nId, ptOn.v, nRefType) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
@@ -308,16 +296,17 @@ LuaExplodeCurveCompo( lua_State* L)
static int
LuaExplodeCurveBezier( lua_State* L)
{
// 3 parametri : Id, dLinTol, bArcsVsLines
// 2 o 3 parametri : Id, bArcsVsLines [, dLinTol]
int nId ;
LuaCheckParam( L, 1, nId)
double dLinTol ;
LuaCheckParam( L, 2, dLinTol)
bool bArcsVsLines ;
LuaCheckParam( L, 3, bArcsVsLines)
LuaCheckParam( L, 2, bArcsVsLines)
double dLinTol = 0.01 ;
if ( lua_gettop( L) >= 3)
LuaCheckParam( L, 3, dLinTol)
LuaClearStack( L) ;
// esplosione della curva composita
bool bOk = ( EgtExplodeCurveBezier( nId, dLinTol, bArcsVsLines) != FALSE) ;
bool bOk = ( EgtExplodeCurveBezier( nId, bArcsVsLines, dLinTol) != FALSE) ;
LuaSetReturn( L, bOk) ;
return 1 ;
}
@@ -332,7 +321,6 @@ LuaInstallGdbModifyCurve( lua_State* L)
lua_register( L, "EgtModifyCurveStartPoint", LuaModifyCurveStartPoint) ;
lua_register( L, "EgtModifyCurveEndPoint", LuaModifyCurveEndPoint) ;
lua_register( L, "EgtModifyCurveExtrusion", LuaModifyCurveExtrusion) ;
lua_register( L, "EgtSetCurveExtrusionFromGrid", LuaSetCurveExtrusionFromGrid) ;
lua_register( L, "EgtModifyCurveThickness", LuaModifyCurveThickness) ;
lua_register( L, "EgtTrimCurveStartAtLen", LuaTrimCurveStartAtLen) ;
lua_register( L, "EgtTrimCurveEndAtLen", LuaTrimCurveEndAtLen) ;
+15 -120
View File
@@ -30,14 +30,7 @@ LuaStartPoint( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
int nRefId = nId ;
if ( lua_gettop( L) >= 2) {
if ( ! LuaGetParam( L, 2, nRefId)) {
string sFlag ;
LuaCheckParam( L, 2, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 2, nRefId) ;
LuaClearStack( L) ;
// recupero il punto iniziale dell'entità
Point3d ptP ;
@@ -56,14 +49,7 @@ LuaEndPoint( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
int nRefId = nId ;
if ( lua_gettop( L) >= 2) {
if ( ! LuaGetParam( L, 2, nRefId)) {
string sFlag ;
LuaCheckParam( L, 2, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 2, nRefId) ;
LuaClearStack( L) ;
// recupero il punto finale dell'entità
Point3d ptP ;
@@ -82,14 +68,7 @@ LuaMidPoint( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
int nRefId = nId ;
if ( lua_gettop( L) >= 2) {
if ( ! LuaGetParam( L, 2, nRefId)) {
string sFlag ;
LuaCheckParam( L, 2, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 2, nRefId) ;
LuaClearStack( L) ;
// recupero il punto centrale dell'entità
Point3d ptP ;
@@ -108,14 +87,7 @@ LuaCenterPoint( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
int nRefId = nId ;
if ( lua_gettop( L) >= 2) {
if ( ! LuaGetParam( L, 2, nRefId)) {
string sFlag ;
LuaCheckParam( L, 2, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 2, nRefId) ;
LuaClearStack( L) ;
// recupero il punto centrale dell'entità
Point3d ptP ;
@@ -136,14 +108,7 @@ LuaAtParamPoint( lua_State* L)
double dU ;
LuaCheckParam( L, 2, dU)
int nRefId = nId ;
if ( lua_gettop( L) >= 3) {
if ( ! LuaGetParam( L, 3, nRefId)) {
string sFlag ;
LuaCheckParam( L, 3, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero il punto in posizione parametrica U della curva
Point3d ptP ;
@@ -164,14 +129,7 @@ LuaNearPoint( lua_State* L)
Point3d ptNear ;
LuaCheckParam( L, 2, ptNear)
int nRefId = nId ;
if ( lua_gettop( L) >= 3) {
if ( ! LuaGetParam( L, 3, nRefId)) {
string sFlag ;
LuaCheckParam( L, 3, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 3, nRefId) ;
LuaClearStack( L) ;
// recupero il punto di intersezione tra le curve più vicino al punto passato
Point3d ptP ;
@@ -194,14 +152,7 @@ LuaIntersectionPoint( lua_State* L)
Point3d ptNear ;
LuaCheckParam( L, 3, ptNear)
int nRefId = nId1 ;
if ( lua_gettop( L) >= 4) {
if ( ! LuaGetParam( L, 4, nRefId)) {
string sFlag ;
LuaCheckParam( L, 4, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 4, nRefId) ;
LuaClearStack( L) ;
// recupero il punto di intersezione tra le curve più vicino al punto passato
Point3d ptP ;
@@ -220,14 +171,7 @@ LuaStartVector( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
int nRefId = nId ;
if ( lua_gettop( L) >= 2) {
if ( ! LuaGetParam( L, 2, nRefId)) {
string sFlag ;
LuaCheckParam( L, 2, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 2, nRefId) ;
LuaClearStack( L) ;
// recupero il vettore tangente all'inizio della curva
Vector3d vtV ;
@@ -246,14 +190,7 @@ LuaEndVector( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
int nRefId = nId ;
if ( lua_gettop( L) >= 2) {
if ( ! LuaGetParam( L, 2, nRefId)) {
string sFlag ;
LuaCheckParam( L, 2, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 2, nRefId) ;
LuaClearStack( L) ;
// recupero il vettore tangente alla fine della curva
Vector3d vtV ;
@@ -272,14 +209,7 @@ LuaMidVector( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
int nRefId = nId ;
if ( lua_gettop( L) >= 2) {
if ( ! LuaGetParam( L, 2, nRefId)) {
string sFlag ;
LuaCheckParam( L, 2, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 2, nRefId) ;
LuaClearStack( L) ;
// recupero il vettore tangente nel punto medio della curva
Vector3d vtV ;
@@ -305,14 +235,7 @@ LuaAtParamVector( lua_State* L)
if ( sSide == "-")
nSide = - 1 ;
int nRefId = nId ;
if ( lua_gettop( L) >= 4) {
if ( ! LuaGetParam( L, 4, nRefId)) {
string sFlag ;
LuaCheckParam( L, 4, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 4, nRefId) ;
LuaClearStack( L) ;
// recupero il punto in posizione parametrica U della curva
Vector3d vtV ;
@@ -331,14 +254,7 @@ LuaFrame( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
int nRefId = nId ;
if ( lua_gettop( L) >= 2) {
if ( ! LuaGetParam( L, 2, nRefId)) {
string sFlag ;
LuaCheckParam( L, 2, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 2, nRefId) ;
LuaClearStack( L) ;
// recupero il frame
Frame3d frFrame ;
@@ -357,14 +273,7 @@ LuaCurveExtrusion( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
int nRefId = nId ;
if ( lua_gettop( L) >= 2) {
if ( ! LuaGetParam( L, 2, nRefId)) {
string sFlag ;
LuaCheckParam( L, 2, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 2, nRefId) ;
LuaClearStack( L) ;
// recupero il versore
Vector3d vtExtr ;
@@ -401,14 +310,7 @@ LuaCurveArcNormVersor( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
int nRefId = nId ;
if ( lua_gettop( L) >= 2) {
if ( ! LuaGetParam( L, 2, nRefId)) {
string sFlag ;
LuaCheckParam( L, 2, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 2, nRefId) ;
LuaClearStack( L) ;
// recupero il versore
Vector3d vtNorm ;
@@ -427,14 +329,7 @@ LuaExtTextNormVersor( lua_State* L)
int nId ;
LuaCheckParam( L, 1, nId)
int nRefId = nId ;
if ( lua_gettop( L) >= 2) {
if ( ! LuaGetParam( L, 2, nRefId)) {
string sFlag ;
LuaCheckParam( L, 2, sFlag)
ToUpper( sFlag) ;
nRefId = (( sFlag == "GRID") ? GDB_ID_GRID : GDB_ID_ROOT) ;
}
}
LuaGetRefId( L, 2, nRefId) ;
LuaClearStack( L) ;
// recupero il versore
Vector3d vtNorm ;
+96 -258
View File
@@ -16,70 +16,26 @@
#include "LUA.h"
#include "API.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EInConst.h"
#include "/EgtDev/Include/EgnStringUtils.h"
#include "/EgtDev/Extern/Lua/Include/lua.hpp"
using namespace std ;
//-------------------------------------------------------------------------------
static int
LuaMove( lua_State* L)
{
// 2 parametri : Id/s, VtMove
// 2 o 3 parametri : Id/s, VtMove [, sRefType]
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Vector3d vtMove ;
LuaCheckParam( L, 2, vtMove)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 3, nRefType) ;
LuaClearStack( L) ;
// eseguo traslazione
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtMove( vId[i], vtMove.v))
bOk = false ;
}
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaMoveGlob( lua_State* L)
{
// 2 parametri : Id/s, VtMove
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Vector3d vtMove ;
LuaCheckParam( L, 2, vtMove)
LuaClearStack( L) ;
// eseguo traslazione
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtMoveGlob( vId[i], vtMove.v))
bOk = false ;
}
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaMoveGroup( lua_State* L)
{
// 2 parametri : Id/s, VtMove
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Vector3d vtMove ;
LuaCheckParam( L, 2, vtMove)
LuaClearStack( L) ;
// eseguo traslazione
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtMoveGroup( vId[i], vtMove.v))
bOk = false ;
}
bool bOk = EgtMove( vId, vtMove, nRefType) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
@@ -89,7 +45,7 @@ LuaMoveGroup( lua_State* L)
static int
LuaRotate( lua_State* L)
{
// 4 parametri : Id/s, PtAx, VtAx, dAngRotDeg
// 4 o 5 parametri : Id/s, PtAx, VtAx, dAngRotDeg [, sRefType]
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Point3d ptAx ;
@@ -98,63 +54,11 @@ LuaRotate( lua_State* L)
LuaCheckParam( L, 3, vtAx)
double dAngRotDeg ;
LuaCheckParam( L, 4, dAngRotDeg)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 5, nRefType) ;
LuaClearStack( L) ;
// eseguo rotazione
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtRotate( vId[i], ptAx.v, vtAx.v, dAngRotDeg))
bOk = false ;
}
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRotateGlob( lua_State* L)
{
// 4 parametri : Id/s, PtAx, VtAx, dAngRotDeg
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Point3d ptAx ;
LuaCheckParam( L, 2, ptAx)
Vector3d vtAx ;
LuaCheckParam( L, 3, vtAx)
double dAngRotDeg ;
LuaCheckParam( L, 4, dAngRotDeg)
LuaClearStack( L) ;
// eseguo rotazione
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtRotateGlob( vId[i], ptAx.v, vtAx.v, dAngRotDeg))
bOk = false ;
}
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRotateGroup( lua_State* L)
{
// 4 parametri : Id/s, PtAx, VtAx, dAngRotDeg
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Point3d ptAx ;
LuaCheckParam( L, 2, ptAx)
Vector3d vtAx ;
LuaCheckParam( L, 3, vtAx)
double dAngRotDeg ;
LuaCheckParam( L, 4, dAngRotDeg)
LuaClearStack( L) ;
// eseguo rotazione
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtRotateGroup( vId[i], ptAx.v, vtAx.v, dAngRotDeg))
bOk = false ;
}
bool bOk = EgtRotate( vId, ptAx, vtAx, dAngRotDeg, nRefType) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
@@ -164,7 +68,7 @@ LuaRotateGroup( lua_State* L)
static int
LuaScale( lua_State* L)
{
// 5 parametri : Id/s, Frame, CoeffX, CoeffY, CoeffZ
// 5 o 6 parametri : Id/s, Frame, CoeffX, CoeffY, CoeffZ [, sRefType]
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Frame3d frRef ;
@@ -175,73 +79,11 @@ LuaScale( lua_State* L)
LuaCheckParam( L, 4, dCoeffY)
double dCoeffZ ;
LuaCheckParam( L, 5, dCoeffZ)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 6, nRefType) ;
LuaClearStack( L) ;
// eseguo scalatura
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtScale( vId[i], frRef.Orig().v,
frRef.VersX().v, frRef.VersY().v, frRef.VersZ().v,
dCoeffX, dCoeffY, dCoeffZ))
bOk = false ;
}
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaScaleGlob( lua_State* L)
{
// 5 parametri : Id/s, Frame, CoeffX, CoeffY, CoeffZ
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Frame3d frRef ;
LuaCheckParam( L, 2, frRef)
double dCoeffX ;
LuaCheckParam( L, 3, dCoeffX)
double dCoeffY ;
LuaCheckParam( L, 4, dCoeffY)
double dCoeffZ ;
LuaCheckParam( L, 5, dCoeffZ)
LuaClearStack( L) ;
// eseguo scalatura
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtScaleGlob( vId[i], frRef.Orig().v,
frRef.VersX().v, frRef.VersY().v, frRef.VersZ().v,
dCoeffX, dCoeffY, dCoeffZ))
bOk = false ;
}
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaScaleGroup( lua_State* L)
{
// 5 parametri : Id/s, Frame, CoeffX, CoeffY, CoeffZ
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Frame3d frRef ;
LuaCheckParam( L, 2, frRef)
double dCoeffX ;
LuaCheckParam( L, 3, dCoeffX)
double dCoeffY ;
LuaCheckParam( L, 4, dCoeffY)
double dCoeffZ ;
LuaCheckParam( L, 5, dCoeffZ)
LuaClearStack( L) ;
// eseguo scalatura
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtScaleGroup( vId[i], frRef.Orig().v,
frRef.VersX().v, frRef.VersY().v, frRef.VersZ().v,
dCoeffX, dCoeffY, dCoeffZ))
bOk = false ;
}
bool bOk = EgtScale( vId, frRef, dCoeffX, dCoeffY, dCoeffZ, nRefType) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
@@ -251,66 +93,18 @@ LuaScaleGroup( lua_State* L)
static int
LuaMirror( lua_State* L)
{
// 3 parametri : Id/s, PtOn, VtN
// 3 o 4 parametri : Id/s, PtOn, VtN [, sRefType]
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 4, nRefType) ;
LuaClearStack( L) ;
// eseguo scalatura
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtMirror( vId[i], ptOn.v, vtN.v))
bOk = false ;
}
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaMirrorGlob( lua_State* L)
{
// 3 parametri : Id/s, PtOn, VtN
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
LuaClearStack( L) ;
// eseguo scalatura
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtMirrorGlob( vId[i], ptOn.v, vtN.v))
bOk = false ;
}
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaMirrorGroup( lua_State* L)
{
// 3 parametri : Id/s, PtOn, VtN
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
LuaClearStack( L) ;
// eseguo scalatura
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtMirrorGroup( vId[i], ptOn.v, vtN.v))
bOk = false ;
}
bool bOk = EgtMirror( vId, ptOn, vtN, nRefType) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
@@ -320,7 +114,7 @@ LuaMirrorGroup( lua_State* L)
static int
LuaShear( lua_State* L)
{
// 5 parametri : Id, PtOn, VtN, VtDir, Coeff
// 5 o 6 parametri : Id, PtOn, VtN, VtDir, Coeff [, sRefType]
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
Point3d ptOn ;
@@ -331,13 +125,11 @@ LuaShear( lua_State* L)
LuaCheckParam( L, 4, vtDir)
double dCoeff ;
LuaCheckParam( L, 5, dCoeff)
int nRefType = RTY_DEFAULT ;
LuaGetRefType( L, 6, nRefType) ;
LuaClearStack( L) ;
// eseguo scalatura
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtShear( vId[i], ptOn.v, vtN.v, vtDir.v, dCoeff))
bOk = false ;
}
bool bOk = EgtShear( vId, ptOn, vtN, vtDir, dCoeff, nRefType) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
@@ -345,26 +137,81 @@ LuaShear( lua_State* L)
//-------------------------------------------------------------------------------
static int
LuaShearGlob( lua_State* L)
LuaMoveGroup( lua_State* L)
{
// 5 parametri : Id, PtOn, VtN, VtDir, Coeff
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
// 2 parametri : Id, VtMove
int nId ;
LuaCheckParam( L, 1, nId)
Vector3d vtMove ;
LuaCheckParam( L, 2, vtMove)
LuaClearStack( L) ;
// eseguo traslazione
bool bOk = ( EgtMoveGroup( nId, vtMove.v) != FALSE) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaRotateGroup( lua_State* L)
{
// 4 parametri : Id, PtAx, VtAx, dAngRotDeg
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptAx ;
LuaCheckParam( L, 2, ptAx)
Vector3d vtAx ;
LuaCheckParam( L, 3, vtAx)
double dAngRotDeg ;
LuaCheckParam( L, 4, dAngRotDeg)
LuaClearStack( L) ;
// eseguo rotazione
bool bOk = ( EgtRotateGroup( nId, ptAx.v, vtAx.v, dAngRotDeg) != FALSE) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaScaleGroup( lua_State* L)
{
// 5 parametri : Id, Frame, CoeffX, CoeffY, CoeffZ
int nId ;
LuaCheckParam( L, 1, nId)
Frame3d frRef ;
LuaCheckParam( L, 2, frRef)
double dCoeffX ;
LuaCheckParam( L, 3, dCoeffX)
double dCoeffY ;
LuaCheckParam( L, 4, dCoeffY)
double dCoeffZ ;
LuaCheckParam( L, 5, dCoeffZ)
LuaClearStack( L) ;
// eseguo scalatura
bool bOk = ( EgtScaleGroup( nId, frRef.Orig().v,
frRef.VersX().v, frRef.VersY().v, frRef.VersZ().v,
dCoeffX, dCoeffY, dCoeffZ) != FALSE) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaMirrorGroup( lua_State* L)
{
// 3 parametri : Id, PtOn, VtN
int sId ;
LuaCheckParam( L, 1, sId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
LuaCheckParam( L, 3, vtN)
Vector3d vtDir ;
LuaCheckParam( L, 4, vtDir)
double dCoeff ;
LuaCheckParam( L, 5, dCoeff)
LuaClearStack( L) ;
// eseguo scalatura
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtShearGlob( vId[i], ptOn.v, vtN.v, vtDir.v, dCoeff))
bOk = false ;
}
bool bOk = ( EgtMirrorGroup( sId, ptOn.v, vtN.v) != FALSE) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
@@ -375,8 +222,8 @@ static int
LuaShearGroup( lua_State* L)
{
// 5 parametri : Id, PtOn, VtN, VtDir, Coeff
INTVECTOR vId ;
LuaCheckParam( L, 1, vId)
int nId ;
LuaCheckParam( L, 1, nId)
Point3d ptOn ;
LuaCheckParam( L, 2, ptOn)
Vector3d vtN ;
@@ -387,11 +234,7 @@ LuaShearGroup( lua_State* L)
LuaCheckParam( L, 5, dCoeff)
LuaClearStack( L) ;
// eseguo scalatura
bool bOk = true ;
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
if ( ! EgtShearGroup( vId[i], ptOn.v, vtN.v, vtDir.v, dCoeff))
bOk = false ;
}
bool bOk = ( EgtShearGroup( nId, ptOn.v, vtN.v, vtDir.v, dCoeff) != FALSE) ;
// restituisco il risultato
LuaSetReturn( L, bOk) ;
return 1 ;
@@ -403,19 +246,14 @@ LuaInstallGeoTransform( lua_State* L)
{
try {
lua_register( L, "EgtMove", LuaMove) ;
lua_register( L, "EgtMoveGlob", LuaMoveGlob) ;
lua_register( L, "EgtMoveGroup", LuaMoveGroup) ;
lua_register( L, "EgtRotate", LuaRotate) ;
lua_register( L, "EgtRotateGlob", LuaRotateGlob) ;
lua_register( L, "EgtRotateGroup", LuaRotateGroup) ;
lua_register( L, "EgtScale", LuaScale) ;
lua_register( L, "EgtScaleGlob", LuaScaleGlob) ;
lua_register( L, "EgtScaleGroup", LuaScaleGroup) ;
lua_register( L, "EgtMirror", LuaMirror) ;
lua_register( L, "EgtMirrorGlob", LuaMirrorGlob) ;
lua_register( L, "EgtMirrorGroup", LuaMirrorGroup) ;
lua_register( L, "EgtShear", LuaShear) ;
lua_register( L, "EgtShearGlob", LuaShearGlob) ;
lua_register( L, "EgtMoveGroup", LuaMoveGroup) ;
lua_register( L, "EgtRotateGroup", LuaRotateGroup) ;
lua_register( L, "EgtScaleGroup", LuaScaleGroup) ;
lua_register( L, "EgtMirrorGroup", LuaMirrorGroup) ;
lua_register( L, "EgtShearGroup", LuaShearGroup) ;
}
catch ( ...) {