EgtInterface 1.6b1 :
- gestione estrusione con facce di chiusura - gestione rivoluzione con facce di chiusura - razionalizzazione passaggio a locale.
This commit is contained in:
+42
-81
@@ -16,6 +16,7 @@
|
||||
#include "API.h"
|
||||
#include "API_Macro.h"
|
||||
#include "AuxTools.h"
|
||||
#include "GeoTools.h"
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EInConst.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
@@ -106,16 +107,11 @@ __stdcall EgtModifyCurveStartPoint( int nId, const double ptP[3], int nRefType)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pCurve != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// 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) ;
|
||||
}
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
|
||||
// ne modifico il punto iniziale
|
||||
bOk = bOk && pCurve->ModifyStart( ptPL) ;
|
||||
EgtSetModified() ;
|
||||
@@ -141,16 +137,11 @@ __stdcall EgtModifyCurveEndPoint( int nId, const double ptP[3], int nRefType)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
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) ;
|
||||
}
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// porto in locale il nuovo punto finale
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
|
||||
// ne modifico il punto finale
|
||||
bOk = bOk && pCurve->ModifyEnd( ptPL) ;
|
||||
EgtSetModified() ;
|
||||
@@ -170,18 +161,13 @@ __stdcall EgtModifyCurveEndPoint( int nId, const double ptP[3], int nRefType)
|
||||
static bool
|
||||
ModifyOneCurveExtrusion( IGeomDB* pGeomDB, int nId, const Vector3d& vtExtr, int nRefType)
|
||||
{
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nId, frLoc) &&
|
||||
! pGeomDB->GetGlobFrame( nId, frLoc))
|
||||
return false ;
|
||||
// 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) ;
|
||||
}
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, vtExtr.v, nRefType, frLoc) ;
|
||||
// se gruppo, agisco sulle sole curve componenti
|
||||
if ( pGeomDB->GetGdbType( nId) == GDB_TY_GROUP) {
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( pGeomDB)) ;
|
||||
@@ -444,16 +430,11 @@ __stdcall EgtTrimExtendCurveByLen( int nId, double dLen, const double ptNear[3],
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pCurve != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// 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) ;
|
||||
}
|
||||
Point3d ptNearL = GetPointLocal( pGeomDB, ptNear, nRefType, frLoc) ;
|
||||
// cerco l'estremo più vicino al punto passato
|
||||
Point3d ptStart, ptEnd ;
|
||||
if ( bOk && pCurve->GetStartPoint( ptStart) && pCurve->GetEndPoint( ptEnd)) {
|
||||
@@ -497,16 +478,11 @@ __stdcall EgtSplitCurveAtPoint( int nId, double ptOn[3], int nRefType)
|
||||
// recupero la curva
|
||||
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
bool bOk = ( pCurve != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// 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) ;
|
||||
}
|
||||
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
|
||||
// determino la posizione parametrica del punto sulla curva (con tolleranza)
|
||||
double dU = 0 ;
|
||||
if ( bOk) {
|
||||
@@ -564,19 +540,14 @@ __stdcall EgtModifyCurveCircleCPN( int nId, const double ptOn[3], int nRefType)
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
double dOldRad = pArc->GetRadius() ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frLoc))
|
||||
return FALSE ;
|
||||
// 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) ;
|
||||
}
|
||||
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
|
||||
// calcolo il nuovo raggio
|
||||
double dRad = (( Point3d( ptOnL) - ptCen) ^ vtN).Len() ;
|
||||
double dRad = (( ptOnL - ptCen) ^ vtN).Len() ;
|
||||
// imposto il nuovo raggio
|
||||
if ( pArc->Set( ptCen, vtN, dRad))
|
||||
return TRUE ;
|
||||
@@ -623,17 +594,12 @@ __stdcall EgtModifyCurveArcC2PN( int nId, const double ptEnd[3], int nRefType)
|
||||
Point3d ptStart, ptOldEnd ;
|
||||
if ( ! pArc->GetStartPoint( ptStart) || ! pArc->GetEndPoint( ptOldEnd))
|
||||
return FALSE ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frLoc))
|
||||
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) ;
|
||||
}
|
||||
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
|
||||
// imposto il nuovo punto finale
|
||||
if ( pArc->SetC2PN( ptCen, ptStart, ptEndL, vtN))
|
||||
return TRUE ;
|
||||
@@ -657,17 +623,12 @@ __stdcall EgtModifyCurveArc3P( int nId, const double ptMid[3], int nRefType)
|
||||
Point3d ptStart, ptOldMid, ptEnd ;
|
||||
if ( ! pArc->GetStartPoint( ptStart) || ! pArc->GetMidPoint( ptOldMid) || ! pArc->GetEndPoint( ptEnd))
|
||||
return FALSE ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frLoc))
|
||||
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) ;
|
||||
}
|
||||
Point3d ptMidL = GetPointLocal( pGeomDB, ptMid, nRefType, frLoc) ;
|
||||
// imposto il nuovo punto medio
|
||||
if ( pArc->Set3P( ptStart, ptMidL, ptEnd))
|
||||
return TRUE ;
|
||||
@@ -759,8 +720,8 @@ __stdcall EgtExplodeCurveBezier( int nId, BOOL bArcsVsLines, double dLinTol)
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtExplodeCurveBezier(" + ToString( nId) + "," +
|
||||
( bArcsVsLines ? "true" : "false") + "," +
|
||||
string sLua = "EgtExplodeCurveBezier(" + ToString( nId) + ",'" +
|
||||
( bArcsVsLines ? "ARCS" : "LINES") + "'," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
|
||||
Reference in New Issue
Block a user