EgtInterface 1.6b1 :
- gestione estrusione con facce di chiusura - gestione rivoluzione con facce di chiusura - razionalizzazione passaggio a locale.
This commit is contained in:
+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 ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user