EgtInterface 1.6b1 :
- gestione estrusione con facce di chiusura - gestione rivoluzione con facce di chiusura - razionalizzazione passaggio a locale.
This commit is contained in:
@@ -53,8 +53,6 @@ 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 EgtChangeGroupFrame( int nId, const Frame3d& frNewRef, int nRefType) ;
|
||||
|
||||
+44
-106
@@ -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/EgkGeoPoint3d.h"
|
||||
@@ -35,18 +36,17 @@ __stdcall EgtCreateGroup( int nParentId, const double ptOrig[3],
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale l'origine e i versori
|
||||
Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ; ;
|
||||
Vector3d vtXL = GetVectorLocal( pGeomDB, vX, nRefType, frLoc) ; ;
|
||||
Vector3d vtYL = GetVectorLocal( pGeomDB, vY, nRefType, frLoc) ; ;
|
||||
Vector3d vtZL = GetVectorLocal( pGeomDB, vZ, nRefType, frLoc) ; ;
|
||||
// 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)
|
||||
frFrameL.ToLoc( frLoc) ;
|
||||
else /* RTY_GRID */
|
||||
frFrameL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
bOk = bOk && frFrameL.Set( ptOrigL, vtXL, vtYL, vtZL) ;
|
||||
// creo il gruppo
|
||||
int nId = ( bOk ? pGeomDB->AddGroup( GDB_ID_NULL, nParentId, frFrameL) : GDB_ID_NULL) ;
|
||||
EgtSetModified() ;
|
||||
@@ -81,18 +81,11 @@ __stdcall EgtCreateGeoPoint( int nParentId, const double ptP[3], int nRefType)
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale il punto
|
||||
Point3d ptPL( ptP) ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptPL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptPL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frLoc) ; ;
|
||||
// creo il punto
|
||||
PtrOwner<IGeoPoint3d> pGeoPnt( CreateGeoPoint3d()) ;
|
||||
bOk = bOk && ! IsNull( pGeoPnt) ;
|
||||
@@ -120,21 +113,12 @@ __stdcall EgtCreateGeoVector( int nParentId, const double vtV[3], const double p
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale il vettore e il punto
|
||||
Vector3d vtVL( vtV) ;
|
||||
Point3d ptBL( ptB) ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
vtVL.ToLoc( frLoc) ;
|
||||
ptBL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
vtVL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptBL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Vector3d vtVL = GetVectorLocal( pGeomDB, vtV, nRefType, frLoc) ; ;
|
||||
Point3d ptBL = GetPointLocal( pGeomDB, ptB, nRefType, frLoc) ; ;
|
||||
// creo il vettore
|
||||
PtrOwner<IGeoVector3d> pGeoVct( CreateGeoVector3d()) ;
|
||||
bOk = bOk && ! IsNull( pGeoVct) ;
|
||||
@@ -171,27 +155,14 @@ __stdcall EgtCreateGeoFrame( int nParentId, const double ptOrig[3],
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale l'origine e i versori
|
||||
Point3d ptOrigL( ptOrig) ;
|
||||
Vector3d vtXL( vX) ;
|
||||
Vector3d vtYL( vY) ;
|
||||
Vector3d vtZL( vZ) ;
|
||||
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) ;
|
||||
}
|
||||
}
|
||||
Point3d ptOrigL = GetPointLocal( pGeomDB, ptOrig, nRefType, frLoc) ; ;
|
||||
Vector3d vtXL = GetVectorLocal( pGeomDB, vX, nRefType, frLoc) ; ;
|
||||
Vector3d vtYL = GetVectorLocal( pGeomDB, vY, nRefType, frLoc) ; ;
|
||||
Vector3d vtZL = GetVectorLocal( pGeomDB, vZ, nRefType, frLoc) ; ;
|
||||
// creo e setto il riferimento
|
||||
PtrOwner<IGeoFrame3d> pGeoFrm( CreateGeoFrame3d()) ;
|
||||
bOk = bOk & ! IsNull( pGeoFrm) ;
|
||||
@@ -230,24 +201,13 @@ EgtCreateText( int nParentId, const Point3d& ptP, double dAngRotDeg,
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale l'origine e i versori
|
||||
Point3d ptPL( ptP) ;
|
||||
Vector3d vtNL = Z_AX ;
|
||||
Vector3d vtDL = X_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptPL.ToLoc( frLoc) ;
|
||||
vtNL.ToLoc( frLoc) ;
|
||||
vtDL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptPL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtNL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtDL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP.v, nRefType, frLoc) ; ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ; ;
|
||||
Vector3d vtDL = GetVectorLocal( pGeomDB, X_AX.v, nRefType, frLoc) ; ;
|
||||
// creo il testo e lo riempio
|
||||
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
||||
bOk = bOk && ! IsNull( pTXT) ;
|
||||
@@ -287,24 +247,13 @@ EgtCreateTextEx( int nParentId, const Point3d& ptP, const Vector3d& vtN, const V
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale l'origine e i versori
|
||||
Point3d ptPL( ptP) ;
|
||||
Vector3d vtNL( vtN) ;
|
||||
Vector3d vtDL( vtD) ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptPL.ToLoc( frLoc) ;
|
||||
vtNL.ToLoc( frLoc) ;
|
||||
vtDL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptPL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtNL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtDL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP.v, nRefType, frLoc) ; ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN.v, nRefType, frLoc) ; ;
|
||||
Vector3d vtDL = GetVectorLocal( pGeomDB, vtD.v, nRefType, frLoc) ; ;
|
||||
// creo il testo e lo riempio
|
||||
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
||||
bOk = bOk && ! IsNull( pTXT) ;
|
||||
@@ -350,24 +299,13 @@ EgtCreateTextAdv( int nParentId, const Point3d& ptP, const Vector3d& vtN, const
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// porto in locale l'origine e i versori
|
||||
Point3d ptPL( ptP) ;
|
||||
Vector3d vtNL( vtN) ;
|
||||
Vector3d vtDL( vtD) ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptPL.ToLoc( frLoc) ;
|
||||
vtNL.ToLoc( frLoc) ;
|
||||
vtDL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptPL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtNL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtDL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Point3d ptPL = GetPointLocal( pGeomDB, ptP.v, nRefType, frLoc) ; ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN.v, nRefType, frLoc) ; ;
|
||||
Vector3d vtDL = GetVectorLocal( pGeomDB, vtD.v, nRefType, frLoc) ; ;
|
||||
// creo il testo e lo imposto
|
||||
PtrOwner<IExtText> pTXT( CreateExtText()) ;
|
||||
bOk = bOk && ! IsNull( pTXT) ;
|
||||
|
||||
+117
-386
@@ -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/EgkCurveLine.h"
|
||||
@@ -32,6 +33,7 @@
|
||||
#include "/EgtDev/Include/EgkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkCurveLocal.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -49,7 +51,6 @@ 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) ;
|
||||
|
||||
|
||||
@@ -63,25 +64,14 @@ __stdcall EgtCreateCurveLine( int nParentId, const double ptIni[3], const double
|
||||
PtrOwner<ICurveLine> pCrvLine( CreateCurveLine()) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti e il versore estrusione
|
||||
Point3d ptIniL( ptIni) ;
|
||||
Point3d ptFinL( ptFin) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptIniL.ToLoc( frLoc) ;
|
||||
ptFinL.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptIniL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptFinL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
||||
Point3d ptFinL = GetPointLocal( pGeomDB, ptFin, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// setto la linea
|
||||
if ( ! pCrvLine->Set( ptIniL, ptFinL))
|
||||
return GDB_ID_NULL ;
|
||||
@@ -112,25 +102,14 @@ __stdcall EgtCreateCurveLineEx( int nParentId, const double ptIni[3], int nSepI,
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// puntatore alla linea
|
||||
PtrOwner<ICurveLine> pCrvLine ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti e il versore estrusione
|
||||
Point3d ptIniL( ptIni) ;
|
||||
Point3d ptFinL( ptFin) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptIniL.ToLoc( frLoc) ;
|
||||
ptFinL.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptIniL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptFinL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
||||
Point3d ptFinL = GetPointLocal( pGeomDB, ptFin, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// 1 - se punti entrambi definiti
|
||||
if ( nSepI == SEP_STD && nSepF == SEP_STD) {
|
||||
pCrvLine.Set( CreateCurveLine()) ;
|
||||
@@ -508,25 +487,14 @@ __stdcall EgtCreateCurveLinePVL( int nParentId, const double ptIni[3],
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// porto in locale i punti e il versore estrusione
|
||||
Point3d ptIniL( ptIni) ;
|
||||
Vector3d vtDirL( vtDir) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptIniL.ToLoc( frLoc) ;
|
||||
vtDirL.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptIniL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtDirL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale il punto e i versori
|
||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
||||
Vector3d vtDirL = GetVectorLocal( pGeomDB, vtDir, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// creo la linea
|
||||
PtrOwner<ICurveLine> pCrvLine( CreateCurveLine()) ;
|
||||
if ( IsNull( pCrvLine))
|
||||
@@ -560,21 +528,13 @@ __stdcall EgtCreateCurveLineMinPointCurve( int nParentId,
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale il punto e il versore estrusione
|
||||
Point3d ptStartL( ptStart) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptStartL.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else if ( nRefType == RTY_GRID) {
|
||||
ptStartL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCurve ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nCrvId, frCurve))
|
||||
@@ -631,25 +591,14 @@ __stdcall EgtCreateCurveCircle( int nParentId, const double ptCen[3],
|
||||
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pCrvArc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale il centro, la normale e il versore estrusione
|
||||
Point3d ptCenL( ptCen) ;
|
||||
Vector3d vtNL( vtN) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptCenL.ToLoc( frLoc) ;
|
||||
vtNL.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptCenL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtNL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti e i versori
|
||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// setto la circonferenza
|
||||
if ( ! pCrvArc->Set( ptCenL, vtNL, dRad))
|
||||
return GDB_ID_NULL ;
|
||||
@@ -683,28 +632,15 @@ __stdcall EgtCreateCurveCircleCPN( int nParentId, const double ptCen[3],
|
||||
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pCrvArc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti, i versori e il versore estrusione
|
||||
Point3d ptCenL( ptCen) ;
|
||||
Point3d ptOnL( ptOn) ;
|
||||
Vector3d vtNL( vtN) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptCenL.ToLoc( frLoc) ;
|
||||
ptOnL.ToLoc( frLoc) ;
|
||||
vtNL.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptCenL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptOnL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtNL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti e i versori
|
||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
||||
Point3d ptOnL = GetPointLocal( pGeomDB, ptOn, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// calcolo il raggio
|
||||
double dRad = (( ptOnL - ptCenL) ^ vtNL).Len() ;
|
||||
// setto la circonferenza
|
||||
@@ -740,28 +676,15 @@ __stdcall EgtCreateCurveCircle3P( int nParentId, const double ptP1[3],
|
||||
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pCrvArc))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti e il versore estrusione
|
||||
Point3d ptP1L( ptP1) ;
|
||||
Point3d ptP2L( ptP2) ;
|
||||
Point3d ptP3L( ptP3) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptP1L.ToLoc( frLoc) ;
|
||||
ptP2L.ToLoc( frLoc) ;
|
||||
ptP3L.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptP1L.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptP2L.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptP3L.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
||||
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
||||
Point3d ptP3L = GetPointLocal( pGeomDB, ptP3, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// setto l'arco
|
||||
if ( ! pCrvArc->Set3P( ptP1L, ptP2L, ptP3L, true))
|
||||
return GDB_ID_NULL ;
|
||||
@@ -796,28 +719,15 @@ __stdcall EgtCreateCurveArc( int nParentId,
|
||||
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pCrvArc))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti, i versori e il versore estrusione
|
||||
Point3d ptCenL( ptCen) ;
|
||||
Vector3d vtNL( vtN) ;
|
||||
Vector3d vtSL( vtS) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptCenL.ToLoc( frLoc) ;
|
||||
vtNL.ToLoc( frLoc) ;
|
||||
vtSL.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptCenL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtNL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtSL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
|
||||
Vector3d vtSL = GetVectorLocal( pGeomDB, vtS, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// setto l'arco
|
||||
if ( ! pCrvArc->Set( ptCenL, vtNL, dRad, vtSL, dAngCenDeg, dDeltaN))
|
||||
return GDB_ID_NULL ;
|
||||
@@ -854,31 +764,16 @@ __stdcall EgtCreateCurveArcC2PN( int nParentId, const double ptCen[3], const dou
|
||||
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pCrvArc))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti, i versori e il versore estrusione
|
||||
Point3d ptCenL( ptCen) ;
|
||||
Point3d ptStartL( ptStart) ;
|
||||
Point3d ptNearEndL( ptNearEnd) ;
|
||||
Vector3d vtNormL( vtNorm) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptCenL.ToLoc( frLoc) ;
|
||||
ptStartL.ToLoc( frLoc) ;
|
||||
ptNearEndL.ToLoc( frLoc) ;
|
||||
vtNormL.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptCenL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptStartL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptNearEndL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtNormL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Point3d ptCenL = GetPointLocal( pGeomDB, ptCen, nRefType, frLoc) ;
|
||||
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
|
||||
Point3d ptNearEndL = GetPointLocal( pGeomDB, ptNearEnd, nRefType, frLoc) ;
|
||||
Vector3d vtNormL = GetVectorLocal( pGeomDB, vtNorm, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// setto l'arco
|
||||
if ( ! pCrvArc->SetC2PN( ptCenL, ptStartL, ptNearEndL, vtNormL))
|
||||
return GDB_ID_NULL ;
|
||||
@@ -913,28 +808,15 @@ __stdcall EgtCreateCurveArc3P( int nParentId, const double ptP1[3],
|
||||
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pCrvArc))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti e il versore estrusione
|
||||
Point3d ptP1L( ptP1) ;
|
||||
Point3d ptP2L( ptP2) ;
|
||||
Point3d ptP3L( ptP3) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptP1L.ToLoc( frLoc) ;
|
||||
ptP2L.ToLoc( frLoc) ;
|
||||
ptP3L.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptP1L.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptP2L.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptP3L.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Point3d ptP1L = GetPointLocal( pGeomDB, ptP1, nRefType, frLoc) ;
|
||||
Point3d ptP2L = GetPointLocal( pGeomDB, ptP2, nRefType, frLoc) ;
|
||||
Point3d ptP3L = GetPointLocal( pGeomDB, ptP3, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
int nId = GDB_ID_NULL ;
|
||||
// setto l'arco
|
||||
if ( pCrvArc->Set3P( ptP1L, ptP2L, ptP3L, false)) {
|
||||
@@ -980,31 +862,16 @@ __stdcall EgtCreateCurveArc2PVN( int nParentId, const double ptStart[3], const d
|
||||
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pCrvArc))
|
||||
return GDB_ID_NULL ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti, i versori e il versore estrusione
|
||||
Point3d ptStartL( ptStart) ;
|
||||
Point3d ptEndL( ptEnd) ;
|
||||
Vector3d vtDirSL( vtDirS) ;
|
||||
Vector3d vtNormL( vtNorm) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptStartL.ToLoc( frLoc) ;
|
||||
ptEndL.ToLoc( frLoc) ;
|
||||
vtDirSL.ToLoc( frLoc) ;
|
||||
vtNormL.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptStartL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptEndL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtDirSL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtNormL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
Point3d ptStartL = GetPointLocal( pGeomDB, ptStart, nRefType, frLoc) ;
|
||||
Point3d ptEndL = GetPointLocal( pGeomDB, ptEnd, nRefType, frLoc) ;
|
||||
Vector3d vtDirSL = GetVectorLocal( pGeomDB, vtDirS, nRefType, frLoc) ;
|
||||
Vector3d vtNormL = GetVectorLocal( pGeomDB, vtNorm, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
int nId = GDB_ID_NULL ;
|
||||
// setto l'arco
|
||||
if ( pCrvArc->Set2PVN( ptStartL, ptEndL, vtDirSL, vtNormL)) {
|
||||
@@ -1072,11 +939,7 @@ EgtCreateCurveBezier( int nParentId, int nDegree, const PNTVECTOR& vPnt, int nRe
|
||||
// setto i punti di controllo
|
||||
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) ;
|
||||
Point3d ptCtrl = GetPointLocal( pGeomDB, vPnt[i].v, nRefType, frLoc) ;
|
||||
// inserimento del punto di controllo
|
||||
if ( ! pCrvBez->SetControlPoint( i, ptCtrl))
|
||||
bOk = false ;
|
||||
@@ -1084,11 +947,7 @@ EgtCreateCurveBezier( int nParentId, int nDegree, const PNTVECTOR& vPnt, int nRe
|
||||
// se curva nulla (ovvero ridotta a punto), errore
|
||||
bOk = bOk && ! pCrvBez->IsAPoint() ;
|
||||
// assegno il versore estrusione
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType == RTY_GLOB)
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
else if ( nRefType == RTY_GRID)
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
pCrvBez->SetExtrusion( vtExtrL) ;
|
||||
// inserisco la curva nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) : GDB_ID_NULL) ;
|
||||
@@ -1144,11 +1003,7 @@ EgtCreateCurveBezierRational( int nParentId, int nDegree, const PNTUVECTOR& vPnt
|
||||
// setto i punti di controllo
|
||||
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) ;
|
||||
Point3d ptCtrl = GetPointLocal( pGeomDB, vPntW[i].first.v, nRefType, frLoc) ;
|
||||
// inserimento del punto di controllo con peso
|
||||
if ( ! pCrvBez->SetControlPoint( i, ptCtrl, vPntW[i].second))
|
||||
return GDB_ID_NULL ;
|
||||
@@ -1156,11 +1011,7 @@ EgtCreateCurveBezierRational( int nParentId, int nDegree, const PNTUVECTOR& vPnt
|
||||
// se curva nulla (ovvero ridotta a punto), errore
|
||||
bOk = bOk && ! pCrvBez->IsAPoint() ;
|
||||
// assegno il versore estrusione
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType == RTY_GLOB)
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
else if ( nRefType == RTY_GRID)
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
pCrvBez->SetExtrusion( vtExtrL) ;
|
||||
// inserisco la curva nel DB
|
||||
int nId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pCrvBez)) : GDB_ID_NULL) ;
|
||||
@@ -1206,10 +1057,8 @@ __stdcall EgtCreateCurveBezierFromArc( int nParentId, int nArcId, BOOL bErase)
|
||||
Frame3d frDest ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frDest) ;
|
||||
// porto la curva di Bezier dal riferimento dell'arco a quello di inserimento
|
||||
if ( bOk && ! AreSameFrame( frSou, frDest)) {
|
||||
pCrvBez->ToGlob( frSou) ;
|
||||
pCrvBez->ToLoc( frDest) ;
|
||||
}
|
||||
if ( bOk && ! AreSameFrame( frSou, frDest))
|
||||
pCrvBez->LocToLoc( frSou, frDest) ;
|
||||
// se curva nulla (ovvero ridotta a punto), errore
|
||||
bOk = bOk && ! pCrvBez->IsAPoint() ;
|
||||
// inserisco la curva nel DB
|
||||
@@ -1391,11 +1240,7 @@ MyCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds,
|
||||
}
|
||||
// recupero i percorsi concatenati
|
||||
int nFirstId = GDB_ID_NULL ;
|
||||
Point3d ptNearL( ptNear) ;
|
||||
if ( nRefType == RTY_GLOB)
|
||||
ptNearL.ToLoc( frDest) ;
|
||||
else if ( nRefType == RTY_GRID)
|
||||
ptNearL.LocToLoc( pGeomDB->GetGridFrame(), frDest) ;
|
||||
Point3d ptNearL = GetPointLocal( pGeomDB, ptNear.v, nRefType, frDest) ;
|
||||
INTVECTOR vId2s ;
|
||||
while ( chainC.GetChainFromNear( ptNearL, vId2s)) {
|
||||
// creo una curva composita
|
||||
@@ -1611,16 +1456,20 @@ __stdcall EgtCreateCurveCompoByApprox( int nParentId, int nSouId, BOOL bArcsVsLi
|
||||
// recupero il riferimento di inserimento
|
||||
Frame3d frEnt ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frEnt) ;
|
||||
// recupero la curva in locale
|
||||
CurveLocal CrvLoc( pGeomDB, nSouId, frEnt) ;
|
||||
bOk = bOk && ( CrvLoc.Get() != nullptr) ;
|
||||
// eseguo l'approssimazione
|
||||
PtrOwner<ICurveComposite> pCC( CreateCurveComposite()) ;
|
||||
bOk = bOk && ! IsNull( pCC) ;
|
||||
const double ANG_TOL_STD_DEG = 15 ;
|
||||
if ( ! bArcsVsLines) { // con linee
|
||||
PolyLine PL ;
|
||||
bOk = bOk && GetPolyLineFromCurve( nSouId, frEnt, dLinTol, PL) && pCC->FromPolyLine( PL) ;
|
||||
bOk = bOk && CrvLoc.Get()->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, PL) && pCC->FromPolyLine( PL) ;
|
||||
}
|
||||
else { // con bi-archi
|
||||
PolyArc PA ;
|
||||
bOk = bOk && GetPolyArcFromCurve( nSouId, frEnt, dLinTol, PA) && pCC->FromPolyArc( PA) ;
|
||||
bOk = bOk && CrvLoc.Get()->ApproxWithArcs( dLinTol, ANG_TOL_STD_DEG, PA) && pCC->FromPolyArc( PA) ;
|
||||
}
|
||||
// copio estrusione e spessore della curva sorgente
|
||||
const ICurve* pSouCrv = GetCurve( pGeomDB->GetGeoObj( nSouId)) ;
|
||||
@@ -1644,8 +1493,8 @@ __stdcall EgtCreateCurveCompoByApprox( int nParentId, int nSouId, BOOL bArcsVsLi
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtCurveCompoByApprox(" + ToString( nParentId) + "," +
|
||||
ToString( nSouId) + "," +
|
||||
( bArcsVsLines ? "ARCS" : "LINES") +
|
||||
ToString( nSouId) + ",'" +
|
||||
( bArcsVsLines ? "ARCS" : "LINES") + "'," +
|
||||
ToString( dLinTol) + ")" +
|
||||
" -- Id=" + ToString( nId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
@@ -1662,29 +1511,15 @@ __stdcall EgtCreateRectangle3P( int nParentId, const double ptIni[3],
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti, i versori e il versore estrusione
|
||||
Point3d ptIniL( ptIni) ;
|
||||
Point3d ptCrossL( ptCross) ;
|
||||
Point3d ptDirL( ptDir) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
if ( bOk) {
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptIniL.ToLoc( frLoc) ;
|
||||
ptCrossL.ToLoc( frLoc) ;
|
||||
ptDirL.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptIniL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptCrossL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptDirL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
||||
Point3d ptCrossL = GetPointLocal( pGeomDB, ptCross, nRefType, frLoc) ;
|
||||
Point3d ptDirL = GetPointLocal( pGeomDB, ptDir, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// calcolo il lato X
|
||||
Vector3d vtDirX = ptDirL - ptIniL ;
|
||||
bOk = bOk && vtDirX.Normalize() ;
|
||||
@@ -1727,29 +1562,15 @@ __stdcall EgtCreatePolygonFromSide( int nParentId, int nNumSides, const double p
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frLoc))
|
||||
return GDB_ID_NULL ;
|
||||
// porto in locale i punti, la normale e il versore estrusione
|
||||
Point3d ptIniL( ptIni) ;
|
||||
Point3d ptFinL( ptFin) ;
|
||||
Vector3d vtNL( vtN) ;
|
||||
Vector3d vtExtrL = Z_AX ;
|
||||
if ( nRefType != RTY_LOC) {
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
if ( bOk) {
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptIniL.ToLoc( frLoc) ;
|
||||
ptFinL.ToLoc( frLoc) ;
|
||||
vtNL.ToLoc( frLoc) ;
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else /* RTY_GRID */ {
|
||||
ptIniL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
ptFinL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtNL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
Point3d ptIniL = GetPointLocal( pGeomDB, ptIni, nRefType, frLoc) ;
|
||||
Point3d ptFinL = GetPointLocal( pGeomDB, ptFin, nRefType, frLoc) ;
|
||||
Vector3d vtNL = GetVectorLocal( pGeomDB, vtN, nRefType, frLoc) ;
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, Z_AX.v, nRefType, frLoc) ;
|
||||
// creo la curva composita
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
bOk = bOk && ! IsNull( pCrvCompo) ;
|
||||
@@ -1794,93 +1615,3 @@ CalcExtrusion( IGeomDB* pGeomDB, int nParentId, int nRefType)
|
||||
vtExtr.LocToLoc( pGeomDB->GetGridFrame(), frEnt) ;
|
||||
return vtExtr ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
SetExtrusionFromGridVersZ( IGeomDB* pGeomDB, int nParentId, ICurve* pCurve)
|
||||
{
|
||||
// verifiche sui parametri
|
||||
if ( pGeomDB == nullptr || pCurve == nullptr)
|
||||
return false ;
|
||||
// assegno il versore estrusione a partire dal versore Z della griglia corrente
|
||||
Vector3d vtExtr = pGeomDB->GetGridFrame().VersZ() ;
|
||||
Frame3d frEnt ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frEnt))
|
||||
return false ;
|
||||
vtExtr.ToLoc( frEnt) ;
|
||||
return pCurve->SetExtrusion( vtExtr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GetPolyLineFromCurve( int nId, const Frame3d& frDest, double dLinTol, PolyLine& PL)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frCrv))
|
||||
return false ;
|
||||
// calcolo la polilinea che approssima la curva
|
||||
const double ANG_TOL_STD_DEG = 15 ;
|
||||
// se i riferimenti sono uguali
|
||||
if ( AreSameFrame( frCrv, frDest)) {
|
||||
// ricavo l'approssimazione
|
||||
if ( ! pCrv->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, PL))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti devo prima trasformare la curva
|
||||
else {
|
||||
// creo una copia della curva (da buttare alla fine)
|
||||
PtrOwner<ICurve> pModCrv( pCrv->Clone()) ;
|
||||
if ( IsNull( pModCrv))
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
pModCrv->LocToLoc( frCrv, frDest) ;
|
||||
// ricavo l'approssimazione
|
||||
if ( ! pModCrv->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, PL))
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GetPolyArcFromCurve( int nId, const Frame3d& frDest, double dLinTol, PolyArc& PA)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, false)
|
||||
// recupero la curva
|
||||
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||
if ( pCrv == nullptr)
|
||||
return false ;
|
||||
// recupero il riferimento della curva
|
||||
Frame3d frCrv ;
|
||||
if ( ! pGeomDB->GetGlobFrame( nId, frCrv))
|
||||
return false ;
|
||||
// calcolo la polilinea che approssima la curva
|
||||
const double ANG_TOL_STD_DEG = 15 ;
|
||||
// se i riferimenti sono uguali
|
||||
if ( AreSameFrame( frCrv, frDest)) {
|
||||
// ricavo l'approssimazione
|
||||
if ( ! pCrv->ApproxWithArcs( dLinTol, ANG_TOL_STD_DEG, PA))
|
||||
return false ;
|
||||
}
|
||||
// altrimenti devo prima trasformare la curva
|
||||
else {
|
||||
// creo una copia della curva (da buttare alla fine)
|
||||
PtrOwner<ICurve> pModCrv( pCrv->Clone()) ;
|
||||
if ( IsNull( pModCrv))
|
||||
return false ;
|
||||
// eseguo la trasformazione
|
||||
pModCrv->LocToLoc( frCrv, frDest) ;
|
||||
// ricavo l'approssimazione
|
||||
if ( ! pModCrv->ApproxWithArcs( dLinTol, ANG_TOL_STD_DEG, PA))
|
||||
return false ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
+84
-83
@@ -16,11 +16,12 @@
|
||||
#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"
|
||||
#include "/EgtDev/Include/EgkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkStmFromCurves.h"
|
||||
#include "/EgtDev/Include/EgkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgkCurveLocal.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
|
||||
using namespace std ;
|
||||
@@ -32,20 +33,16 @@ __stdcall EgtCreateSurfTriMeshByContour( int nParentId, int nCrvId, double dLinT
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
bOk = false ;
|
||||
// calcolo la polilinea che approssima la curva
|
||||
PolyLine PL ;
|
||||
if ( ! GetPolyLineFromCurve( nCrvId, frDest, dLinTol, PL))
|
||||
bOk = false ;
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByFlatContour( PL))
|
||||
bOk = false ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// recupero la curva in locale
|
||||
CurveLocal CrvLoc( pGeomDB, nCrvId, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc.Get() != nullptr) ;
|
||||
// calcolo la superficie
|
||||
ISurfTriMesh* pSTM = ( bOk ? GetSurfTriMeshByContour( *CrvLoc.Get(), dLinTol) : nullptr) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
@@ -62,36 +59,30 @@ __stdcall EgtCreateSurfTriMeshByContour( int nParentId, int nCrvId, double dLinT
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateSurfTriMeshByExtrusion( int nParentId, int nCrvId, const double vtExtr[3],
|
||||
double dLinTol, int nRefType)
|
||||
BOOL bCapEnds, double dLinTol, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// porto in locale il vettore estrusione
|
||||
Vector3d vtExtrL( vtExtr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
vtExtrL.ToLoc( frLoc) ;
|
||||
}
|
||||
else if ( nRefType == RTY_GRID) {
|
||||
vtExtrL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
}
|
||||
// calcolo la polilinea che approssima la curva
|
||||
PolyLine PL ;
|
||||
bOk = bOk && GetPolyLineFromCurve( nCrvId, frLoc, dLinTol, PL) ;
|
||||
// creo e setto la superficie trimesh
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
bOk = bOk && ! IsNull( pSTM) ;
|
||||
bOk = bOk && pSTM->CreateByExtrusion( PL, vtExtrL) ;
|
||||
// recupero la curva in locale
|
||||
CurveLocal CrvLoc( pGeomDB, nCrvId, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc.Get() != nullptr) ;
|
||||
// porto in locale il vettore estrusione
|
||||
Vector3d vtExtrL = GetVectorLocal( pGeomDB, vtExtr, nRefType, frLoc) ;
|
||||
// calcolo la superficie
|
||||
ISurfTriMesh* pSTM = ( bOk ? GetSurfTriMeshByExtrusion( *CrvLoc.Get(), vtExtrL, ( bCapEnds != FALSE), dLinTol) : nullptr) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmByExtrusion(" + ToString( nParentId) + "," +
|
||||
ToString( nCrvId) + ",{" +
|
||||
ToString( Vector3d( vtExtr)) + "}," +
|
||||
( bCapEnds ? "true" : "false") + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
@@ -101,6 +92,45 @@ __stdcall EgtCreateSurfTriMeshByExtrusion( int nParentId, int nCrvId, const doub
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateSurfTriMeshByRevolve( int nParentId, int nCrvId,
|
||||
const double ptAx[3], const double vtAx[3],
|
||||
BOOL bCapEnds, double dLinTol, int nRefType)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// recupero la curva in locale
|
||||
CurveLocal CrvLoc( pGeomDB, nCrvId, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc.Get() != nullptr) ;
|
||||
// porto in locale punto e vettore asse
|
||||
Point3d ptAxL = GetPointLocal( pGeomDB, ptAx, nRefType, frLoc) ;
|
||||
Vector3d vtAxL = GetVectorLocal( pGeomDB, vtAx, nRefType, frLoc) ;
|
||||
// calcolo la superficie
|
||||
ISurfTriMesh* pSTM = ( bOk ? GetSurfTriMeshByRevolve( *CrvLoc.Get(), ptAxL, vtAxL, ( bCapEnds != FALSE), dLinTol) : nullptr) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtSurfTmByRevolve(" + ToString( nParentId) + "," +
|
||||
ToString( nCrvId) + ",{" +
|
||||
ToString( Point3d( ptAx)) + "},{" +
|
||||
ToString( Vector3d( vtAx)) + "}," +
|
||||
( bCapEnds ? "true" : "false") + "," +
|
||||
ToString( dLinTol) + "," +
|
||||
RefTypeToString( nRefType) + ")" +
|
||||
" -- Id=" + ToString( nNewId) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco l'identificativo della nuova entità
|
||||
return nNewId ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtCreateSurfTriMeshByScrewing( int nParentId, int nCrvId,
|
||||
@@ -110,43 +140,19 @@ __stdcall EgtCreateSurfTriMeshByScrewing( int nParentId, int nCrvId,
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// porto in locale punto e vettore asse
|
||||
Point3d ptAxL( ptAx) ;
|
||||
Vector3d vtAxL( vtAx) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
if ( nRefType == RTY_GLOB) {
|
||||
ptAxL.ToLoc( frLoc) ;
|
||||
vtAxL.ToLoc( frLoc) ;
|
||||
}
|
||||
else if ( nRefType == RTY_GRID) {
|
||||
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, 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) ;
|
||||
bOk = bOk && pSTM->CreateByScrewing( PL, ptAxL, vtAxL, dAngRotDeg, dStepRotDeg, dMove) ;
|
||||
// recupero la curva in locale
|
||||
CurveLocal CrvLoc( pGeomDB, nCrvId, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc.Get() != nullptr) ;
|
||||
// porto in locale punto e vettore asse
|
||||
Point3d ptAxL = GetPointLocal( pGeomDB, ptAx, nRefType, frLoc) ;
|
||||
Vector3d vtAxL = GetVectorLocal( pGeomDB, vtAx, nRefType, frLoc) ;
|
||||
// calcolo la superficie
|
||||
ISurfTriMesh* pSTM = ( bOk ? GetSurfTriMeshByScrewing( *CrvLoc.Get(), ptAxL, vtAxL, dAngRotDeg, dMove, dLinTol) : nullptr) ;
|
||||
// inserisco la superficie nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
@@ -172,24 +178,19 @@ __stdcall EgtCreateSurfTriMeshRuled( int nParentId, int nCrvId1, int nCrvId2, do
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
bool bOk = true ;
|
||||
// recupero il riferimento del gruppo destinazione
|
||||
Frame3d frDest ;
|
||||
if ( ! pGeomDB->GetGroupGlobFrame( nParentId, frDest))
|
||||
bOk = false ;
|
||||
// calcolo la polilinea che approssima la prima curva
|
||||
PolyLine PL1 ;
|
||||
if ( ! GetPolyLineFromCurve( nCrvId1, frDest, dLinTol, PL1))
|
||||
bOk = false ;
|
||||
// calcolo la polilinea che approssima la seconda curva
|
||||
PolyLine PL2 ;
|
||||
if ( ! GetPolyLineFromCurve( nCrvId2, frDest, dLinTol, PL2))
|
||||
bOk = false ;
|
||||
// creo la superficie trimesh e costruisco la rigata tra le due curve
|
||||
PtrOwner<ISurfTriMesh> pSTM( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pSTM) || ! pSTM->CreateByTwoCurves( PL1, PL2))
|
||||
bOk = false ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGroupGlobFrame( nParentId, frLoc) ;
|
||||
// recupero la prima curva in locale
|
||||
CurveLocal CrvLoc1( pGeomDB, nCrvId1, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc1.Get() != nullptr) ;
|
||||
// recupero la seconda curva in locale
|
||||
CurveLocal CrvLoc2( pGeomDB, nCrvId2, frLoc) ;
|
||||
bOk = bOk && ( CrvLoc2.Get() != nullptr) ;
|
||||
// calcolo la superficie
|
||||
ISurfTriMesh* pSTM = ( bOk ? GetSurfTriMeshRuled( *CrvLoc1.Get(), *CrvLoc2.Get(), dLinTol) : nullptr) ;
|
||||
// inserisco la superficie trimesh nel DB
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, Release( pSTM)) : GDB_ID_NULL) ;
|
||||
int nNewId = ( bOk ? pGeomDB->AddGeoObj( GDB_ID_NULL, nParentId, pSTM) : GDB_ID_NULL) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
|
||||
+6
-10
@@ -17,6 +17,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/EgkGeoPoint3d.h"
|
||||
@@ -91,16 +92,11 @@ __stdcall EgtChangeVectorBase( int nId, const double ptB[3], int nRefType)
|
||||
// recupero il vettore
|
||||
IGeoVector3d* pGVect = GetGeoVector3d( pGeomDB->GetGeoObj( nId)) ;
|
||||
bOk = bOk && ( pGVect != nullptr) ;
|
||||
// recupero il riferimento locale
|
||||
Frame3d frLoc ;
|
||||
bOk = bOk && pGeomDB->GetGlobFrame( nId, frLoc) ;
|
||||
// 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) ;
|
||||
}
|
||||
Point3d ptBL = GetPointLocal( pGeomDB, ptB, nRefType, frLoc) ;
|
||||
// imposto il nuovo punto di base
|
||||
bOk = bOk && pGVect->ChangeBase( ptBL) ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
@@ -359,4 +355,4 @@ __stdcall EgtSplitText( int nId)
|
||||
}
|
||||
// restituisco risultato
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
}
|
||||
}
|
||||
|
||||
+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()) ;
|
||||
|
||||
+46
-5
@@ -335,6 +335,13 @@ __stdcall EgtChangeId( int nId, int nNewId)
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// eseguo cambio di Id
|
||||
bool bOk = pGeomDB->ChangeId( nId, nNewId) ;
|
||||
// se pezzo corrente o layer corrente
|
||||
if ( bOk) {
|
||||
if ( nId == EgtGetCurrPart())
|
||||
EgtSetCurrPartLayer( nNewId, EgtGetCurrLayer()) ;
|
||||
else if ( nId == EgtGetCurrLayer())
|
||||
EgtSetCurrPartLayer( EgtGetCurrPart(), nNewId) ;
|
||||
}
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
@@ -365,20 +372,28 @@ __stdcall EgtErase( int nId)
|
||||
}
|
||||
// eseguo cancellazione dei selezionati
|
||||
else {
|
||||
int nCurrPartId = EgtGetCurrPart() ;
|
||||
int nCurrLayerId = EgtGetCurrLayer() ;
|
||||
bool bErasedCurrPart = false ;
|
||||
bool bErasedCurrLayer = false ;
|
||||
int nI = pGeomDB->GetFirstSelectedObj() ;
|
||||
while ( nI != GDB_ID_NULL && bOk) {
|
||||
// cancello
|
||||
if ( ! pGeomDB->Erase( nI))
|
||||
bOk = false ;
|
||||
// se cancellato pezzo corrente o layer corrente
|
||||
int nCurrPartId = EgtGetCurrPart() ;
|
||||
// verifico se cancellato pezzo corrente o layer corrente
|
||||
if ( nI == nCurrPartId)
|
||||
EgtResetCurrPartLayer() ;
|
||||
else if ( nI == EgtGetCurrLayer())
|
||||
EgtSetCurrPartLayer( nCurrPartId, EgtGetFirstVisibleLayer( nCurrPartId)) ;
|
||||
bErasedCurrPart = true ;
|
||||
else if ( nI == nCurrLayerId)
|
||||
bErasedCurrLayer = true ;
|
||||
// passo al successivo
|
||||
nI = pGeomDB->GetFirstSelectedObj() ;
|
||||
}
|
||||
// se cancellato pezzo corrente o layer corrente
|
||||
if ( bErasedCurrPart)
|
||||
EgtResetCurrPartLayer() ;
|
||||
else if ( bErasedCurrLayer)
|
||||
EgtSetCurrPartLayer( nCurrPartId, EgtGetFirstVisibleLayer( nCurrPartId)) ;
|
||||
}
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
@@ -391,6 +406,32 @@ __stdcall EgtErase( int nId)
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtEmptyGroup( int nId)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// svuoto il gruppo
|
||||
bool bOk = pGeomDB->EmptyGroup( nId) ;
|
||||
// se cancellato pezzo corrente o layer corrente
|
||||
int nCurrPartId = EgtGetCurrPart() ;
|
||||
int nCurrLayerId = EgtGetCurrLayer() ;
|
||||
if ( ! pGeomDB->ExistsObj( nCurrPartId))
|
||||
EgtResetCurrPartLayer() ;
|
||||
else if ( ! pGeomDB->ExistsObj( nCurrLayerId))
|
||||
EgtSetCurrPartLayer( nCurrPartId, EgtGetFirstVisibleLayer( nCurrPartId)) ;
|
||||
EgtSetModified() ;
|
||||
// se richiesto, salvo il comando Lua equivalente
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "EgtEmptyGroup(" + ToString( nId) + ")" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco risultato
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
__stdcall EgtGetType( int nId)
|
||||
|
||||
@@ -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/EGkStringUtils3d.h"
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#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"
|
||||
@@ -166,52 +165,3 @@ ETxtInsPosToString( const string& sETxtInsPos)
|
||||
// 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 ;
|
||||
}
|
||||
@@ -31,6 +31,4 @@ int StringToRefId( const std::string& sRefId) ;
|
||||
// Posizione inserimento testo
|
||||
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) ;
|
||||
|
||||
|
||||
Binary file not shown.
@@ -203,6 +203,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Include\EGkCurveLocal.h" />
|
||||
<ClInclude Include="..\Include\EGkGeomDB.h" />
|
||||
<ClInclude Include="..\Include\EInAPI.h" />
|
||||
<ClInclude Include="..\Include\EInConst.h" />
|
||||
@@ -210,6 +211,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="API.h" />
|
||||
<ClInclude Include="API_Macro.h" />
|
||||
<ClInclude Include="AuxTools.h" />
|
||||
<ClInclude Include="GeoTools.h" />
|
||||
<ClInclude Include="GseContext.h" />
|
||||
<ClInclude Include="LUA.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
@@ -236,6 +238,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClCompile Include="API_TscExec.cpp" />
|
||||
<ClCompile Include="AuxTools.cpp" />
|
||||
<ClCompile Include="EInDllMain.cpp" />
|
||||
<ClCompile Include="GeoTools.cpp" />
|
||||
<ClCompile Include="GseContext.cpp" />
|
||||
<ClCompile Include="LUA_Aux.cpp" />
|
||||
<ClCompile Include="LUA_GdbCreateCurve.cpp" />
|
||||
|
||||
@@ -60,6 +60,12 @@
|
||||
<ClInclude Include="AuxTools.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Include\EGkCurveLocal.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GeoTools.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="API_Exchange.cpp">
|
||||
@@ -179,6 +185,9 @@
|
||||
<ClCompile Include="API_GdbPartLayers.cpp">
|
||||
<Filter>File di origine\API</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeoTools.cpp">
|
||||
<Filter>File di origine\Global</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtInterface.rc">
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GeoTools.cpp Data : 01.02.15 Versione : 1.6b1
|
||||
// Contenuto : Funzioni geometriche ausiliarie.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.02.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GeoTools.h"
|
||||
#include "/EgtDev/Include/EInConst.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Vector3d
|
||||
GetVectorLocal( IGeomDB* pGeomDB, const double vtV[3], int nRefType, const Frame3d& frLoc)
|
||||
{
|
||||
Vector3d vtVL( vtV) ;
|
||||
if ( nRefType == RTY_GLOB)
|
||||
vtVL.ToLoc( frLoc) ;
|
||||
else if ( nRefType == RTY_GRID)
|
||||
vtVL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
return vtVL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Point3d
|
||||
GetPointLocal( IGeomDB* pGeomDB, const double ptP[3], int nRefType, const Frame3d& frLoc)
|
||||
{
|
||||
Point3d ptPL( ptP) ;
|
||||
if ( nRefType == RTY_GLOB)
|
||||
ptPL.ToLoc( frLoc) ;
|
||||
else if ( nRefType == RTY_GRID)
|
||||
ptPL.LocToLoc( pGeomDB->GetGridFrame(), frLoc) ;
|
||||
return ptPL ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
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 ;
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GeoTools.h Data : 01.02.15 Versione : 1.6b1
|
||||
// Contenuto : Prototipi funzioni geometriche ausiliarie.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 01.02.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
|
||||
class IGeomDB ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Vettore espresso nel riferimento desiderato partendo da vettore nel riferimento RefType
|
||||
Vector3d GetVectorLocal( IGeomDB* pGeomDB, const double vtV[3], int nRefType, const Frame3d& frLoc) ;
|
||||
// Punto espresso nel riferimento desiderato partendo da punto nel riferimento RefType
|
||||
Point3d GetPointLocal( IGeomDB* pGeomDB, const double ptP[3], int nRefType, const Frame3d& frLoc) ;
|
||||
// Verifica che tutti gli oggetti dell'insieme abbiano lo stesso riferimento
|
||||
bool VerifySameFrame( IGeomDB* pGeomDB, INTVECTOR& vIds) ;
|
||||
|
||||
+41
-5
@@ -50,22 +50,57 @@ LuaCreateSurfTriMeshByContour( lua_State* L)
|
||||
static int
|
||||
LuaCreateSurfTriMeshByExtrusion( lua_State* L)
|
||||
{
|
||||
// 3 o 4 o 5 parametri : ParentId, CrvId, vtExtr [, dTol] [, sRefType]
|
||||
// 4 o 5 o 6 parametri : ParentId, CrvId, vtExtr, bCapEnds [, dTol] [, sRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nCrvId ;
|
||||
LuaCheckParam( L, 2, nCrvId)
|
||||
Vector3d vtExtr ;
|
||||
LuaCheckParam( L, 3, vtExtr)
|
||||
bool bCapEnds ;
|
||||
LuaCheckParam( L, 4, bCapEnds)
|
||||
double dLinTol = 0.1 ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 4, dLinTol))
|
||||
LuaGetRefType( L, 5, nRefType) ;
|
||||
if ( LuaGetParam( L, 5, dLinTol))
|
||||
LuaGetRefType( L, 6, nRefType) ;
|
||||
else
|
||||
LuaGetRefType( L, 4, nRefType) ;
|
||||
LuaGetRefType( L, 5, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM riempiendo un contorno piano
|
||||
int nId = EgtCreateSurfTriMeshByExtrusion( nParentId, nCrvId, vtExtr.v, dLinTol, nRefType) ;
|
||||
int nId = EgtCreateSurfTriMeshByExtrusion( nParentId, nCrvId, vtExtr.v,
|
||||
( bCapEnds ? TRUE : FALSE), dLinTol, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCreateSurfTriMeshByRevolve( lua_State* L)
|
||||
{
|
||||
// 5 o 6 o 7 parametri : ParentId, CrvId, ptAx, vtAx, bCapEnds [, dTol] [, sRefType]
|
||||
int nParentId ;
|
||||
LuaCheckParam( L, 1, nParentId)
|
||||
int nCrvId ;
|
||||
LuaCheckParam( L, 2, nCrvId)
|
||||
Point3d ptAx ;
|
||||
LuaCheckParam( L, 3, ptAx)
|
||||
Vector3d vtAx ;
|
||||
LuaCheckParam( L, 4, vtAx)
|
||||
bool bCapEnds ;
|
||||
LuaCheckParam( L, 5, bCapEnds)
|
||||
double dLinTol = 0.1 ;
|
||||
int nRefType = RTY_DEFAULT ;
|
||||
if ( LuaGetParam( L, 6, dLinTol))
|
||||
LuaGetRefType( L, 7, nRefType) ;
|
||||
else
|
||||
LuaGetRefType( L, 6, nRefType) ;
|
||||
LuaClearStack( L) ;
|
||||
// creo STM riempiendo un contorno piano
|
||||
int nId = EgtCreateSurfTriMeshByRevolve( nParentId, nCrvId, ptAx.v, vtAx.v, bCapEnds, dLinTol, nRefType) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
@@ -140,6 +175,7 @@ LuaInstallGdbCreateSurf( lua_State* L)
|
||||
try {
|
||||
lua_register( L, "EgtSurfTmByContour", LuaCreateSurfTriMeshByContour) ;
|
||||
lua_register( L, "EgtSurfTmByExtrusion", LuaCreateSurfTriMeshByExtrusion) ;
|
||||
lua_register( L, "EgtSurfTmByRevolve", LuaCreateSurfTriMeshByRevolve) ;
|
||||
lua_register( L, "EgtSurfTmByScrewing", LuaCreateSurfTriMeshByScrewing) ;
|
||||
lua_register( L, "EgtSurfTmRuled", LuaCreateSurfTriMeshRuled) ;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EInConst.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
#include "/EgtDev/Include/EgnStringUtils.h"
|
||||
#include "/EgtDev/Extern/Lua/Include/lua.hpp"
|
||||
|
||||
using namespace std ;
|
||||
@@ -300,7 +301,11 @@ LuaExplodeCurveBezier( lua_State* L)
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
bool bArcsVsLines ;
|
||||
LuaCheckParam( L, 2, bArcsVsLines)
|
||||
string sTemp ;
|
||||
LuaCheckParam( L, 2, sTemp)
|
||||
ToUpper( sTemp) ;
|
||||
if ( sTemp == "LINES")
|
||||
bArcsVsLines = false ;
|
||||
double dLinTol = 0.01 ;
|
||||
if ( lua_gettop( L) >= 3)
|
||||
LuaCheckParam( L, 3, dLinTol)
|
||||
|
||||
@@ -314,6 +314,21 @@ LuaErase( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaEmptyGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : Id
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la cancellazione
|
||||
bool bOk = ( EgtEmptyGroup( nId) != FALSE) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallGdbObjects( lua_State* L)
|
||||
@@ -333,6 +348,7 @@ LuaInstallGdbObjects( lua_State* L)
|
||||
lua_register( L, "EgtRelocateGlob", LuaRelocateGlob) ;
|
||||
lua_register( L, "EgtChangeId", LuaChangeId) ;
|
||||
lua_register( L, "EgtErase", LuaErase) ;
|
||||
lua_register( L, "EgtEmptyGroup", LuaEmptyGroup) ;
|
||||
}
|
||||
catch ( ...) {
|
||||
return false ;
|
||||
|
||||
Reference in New Issue
Block a user