EgtExecutor :

- ora ModifyCurveStartPoint e ModifyCurveEndPoint quando necessario trasformano archi in rette.
This commit is contained in:
Dario Sassi
2025-07-18 10:39:55 +02:00
parent 0f039b809b
commit 901d6f7107
+22 -8
View File
@@ -22,7 +22,7 @@
#include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveBezier.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
@@ -363,17 +363,24 @@ ExeModifyCurveStartPoint( int nId, const Point3d& ptP, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pCurve != nullptr) ;
bool bOk = ( pCurve != nullptr) ;
// recupero il riferimento locale
Frame3d frLoc ;
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
// porto in locale il nuovo punto iniziale
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ;
// ne modifico il punto iniziale
bOk = bOk && pCurve->ModifyStart( ptPL) ;
if ( bOk && ! pCurve->ModifyStart( ptPL)) {
bOk = false ;
Point3d ptEnd ;
if ( pCurve->GetEndPoint( ptEnd) && ! AreSamePointApprox( ptPL, ptEnd)) {
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
if ( ! IsNull( pLine) && pLine->Set( ptPL, ptEnd))
bOk = pGeomDB->ReplaceGeoObj( nId, Release( pLine)) ;
}
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -393,17 +400,24 @@ ExeModifyCurveEndPoint( int nId, const Point3d& ptP, int nRefType)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
bool bOk = true ;
// recupero la curva
ICurve* pCurve = GetCurve( pGeomDB->GetGeoObj( nId)) ;
bOk = bOk && ( pCurve != nullptr) ;
bool bOk = ( pCurve != nullptr) ;
// 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) ;
if ( bOk && ! pCurve->ModifyEnd( ptPL)) {
bOk = false ;
Point3d ptStart ;
if ( pCurve->GetStartPoint( ptStart) && ! AreSamePointApprox( ptStart, ptPL)) {
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
if ( ! IsNull( pLine) && pLine->Set( ptStart, ptPL))
bOk = pGeomDB->ReplaceGeoObj( nId, Release( pLine)) ;
}
}
ExeSetModified() ;
// se richiesto, salvo il comando Lua equivalente
if ( IsCmdLog()) {
@@ -1713,7 +1727,7 @@ ExeCloseCurveCompo( int nId)
}
//-------------------------------------------------------------------------------
bool
static bool
MyAddCurveCompoCurve( int nId, int nAddCrvId, bool bEraseOrig, bool bEndVsStart)
{
IGeomDB* pGeomDB = GetCurrGeomDB() ;