EgtExchange :

- aggiunta in BTL gestione feature SimpleScarf, ScarfJoint, StepJoint, StepJointNotch.
This commit is contained in:
Dario Sassi
2017-09-28 08:18:42 +00:00
parent 92c8c19127
commit 1d4de8e9a3
3 changed files with 556 additions and 13 deletions
+8
View File
@@ -123,6 +123,14 @@ class BtlGeom
const INTVECTOR& vnDPar, int nSPar, const DBLVECTOR& vdPar, const std::string& sPar) ;
bool AddText( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, int nSPar, const DBLVECTOR& vdPar, const std::string& sPar) ;
bool AddSimpleScarf( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar) ;
bool AddScarfJoint( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar) ;
bool AddStepJoint( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar) ;
bool AddStepJointNotch( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar) ;
bool AddProfileHeadCoCo( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar) ;
bool AddProfileHeadCambered( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
+547 -13
View File
@@ -30,6 +30,7 @@
#include "/EgtDev/Include/EGkIntersLinePlane.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkIntervals.h"
#include "/EgtDev/Include/ENkPolynomialRoots.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -61,6 +62,10 @@ using namespace std ;
#define IS_DTMORTISE_FRONT( nG, nP) ( ( nGroup == 3 || nGroup == 4) && nProc == 56)
#define IS_MARKING( nG, nP) ( ( nGroup == 3 || nGroup == 4) && nProc == 60)
#define IS_TEXT( nG, nP) ( ( nGroup == 4) && nProc == 61)
#define IS_SIMPLESCARF( nG, nP) ( ( nGroup == 1 || nGroup == 2) && nProc == 70)
#define IS_SCARFJOINT( nG, nP) ( ( nGroup == 1 || nGroup == 2) && nProc == 71)
#define IS_STEPJOINT( nG, nP) ( ( nGroup == 1 || nGroup == 2) && nProc == 80)
#define IS_STEPJOINTNOTCH( nG, nP) ( ( nGroup == 3 || nGroup == 4) && nProc == 80)
#define IS_PROF_HEADCONCAVE( nG, nP) ( ( nGroup == 3 || nGroup == 4) && nProc == 101)
#define IS_PROF_HEADCONVEX( nG, nP) ( ( nGroup == 3 || nGroup == 4) && nProc == 102)
#define IS_PROF_HEADCAMBERED( nG, nP) ( ( nGroup == 3 || nGroup == 4) && nProc == 103)
@@ -457,6 +462,62 @@ BtlGeom::GetProcessParamInfos( int nGroup, int nProc, int nSide,
nSPar = 15 ; sPar.empty() ;
return true ;
}
// se giunto gerber
if ( IS_SIMPLESCARF( nGroup, nProc)) {
vnDPar.reserve( 6) ; vdPar.reserve( 6) ;
vnDPar.emplace_back( 1) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 11) ; vdPar.emplace_back( 20) ;
vnDPar.emplace_back( 12) ; vdPar.emplace_back( 20) ;
vnDPar.emplace_back( 13) ; vdPar.emplace_back( 200) ;
vnDPar.emplace_back( 14) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 15) ; vdPar.emplace_back( 0) ;
nSPar = 0 ; sPar.empty() ;
return true ;
}
// se giunto a dardo
if ( IS_SCARFJOINT( nGroup, nProc)) {
vnDPar.reserve( 9) ; vdPar.reserve( 9) ;
vnDPar.emplace_back( 1) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 7) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 9) ; vdPar.emplace_back( 1) ;
vnDPar.emplace_back( 10) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 11) ; vdPar.emplace_back( 20) ;
vnDPar.emplace_back( 12) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 13) ; vdPar.emplace_back( 200) ;
vnDPar.emplace_back( 14) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 15) ; vdPar.emplace_back( 0) ;
nSPar = 0 ; sPar.empty() ;
return true ;
}
// se incastro dietro
if ( IS_STEPJOINT( nGroup, nProc)) {
vnDPar.reserve( 7) ; vdPar.reserve( 7) ;
vnDPar.emplace_back( 1) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 4) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 7) ; vdPar.emplace_back( 45) ;
vnDPar.emplace_back( 11) ; vdPar.emplace_back( 20) ;
vnDPar.emplace_back( 12) ; vdPar.emplace_back( 20) ;
vnDPar.emplace_back( 14) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 15) ; vdPar.emplace_back( 0) ;
nSPar = 0 ; sPar.empty() ;
return true ;
}
// se incastro semplice
if ( IS_STEPJOINTNOTCH( nGroup, nProc)) {
vnDPar.reserve( 10) ; vdPar.reserve( 10) ;
vnDPar.emplace_back( 1) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 2) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 4) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 7) ; vdPar.emplace_back( 45) ;
vnDPar.emplace_back( 10) ; vdPar.emplace_back( GetSideWidth( nSide)) ;
vnDPar.emplace_back( 11) ; vdPar.emplace_back( 20) ;
vnDPar.emplace_back( 12) ; vdPar.emplace_back( 20) ;
vnDPar.emplace_back( 13) ; vdPar.emplace_back( 200) ;
vnDPar.emplace_back( 14) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 15) ; vdPar.emplace_back( 0) ;
nSPar = 0 ; sPar.empty() ;
return true ;
}
// se profilo concavo
if ( IS_PROF_HEADCONCAVE( nGroup, nProc)) {
vnDPar.reserve( 6) ; vdPar.reserve( 6) ;
@@ -605,6 +666,18 @@ BtlGeom::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int n
// se testo
if ( IS_TEXT( nGroup, nProc))
return AddText( nGroup, nProc, nSide, sDes, nProcId, vnDPar, nSPar, vdPar, sPar) ;
// se giunto gerber
if ( IS_SIMPLESCARF( nGroup, nProc))
return AddSimpleScarf( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar) ;
// se giunto a dardo
if ( IS_SCARFJOINT( nGroup, nProc))
return AddScarfJoint( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar) ;
// incastro dietro
if ( IS_STEPJOINT( nGroup, nProc))
return AddStepJoint( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar) ;
// se incastro semplice
if ( IS_STEPJOINTNOTCH( nGroup, nProc))
return AddStepJointNotch( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar) ;
// se profilo concavo
if ( IS_PROF_HEADCONCAVE( nGroup, nProc))
return AddProfileHeadCoCo( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar) ;
@@ -919,8 +992,102 @@ BtlGeom::AddSlot( int nGroup, int nProc, int nSide, const string& sDes, int nPro
if ( vdPar.size() < 14)
return false ;
// sistemo i dati
Point3d ptP( vdPar[0], vdPar[1], -vdPar[2]) ; // P01, P02, P03
int nFlag = lround( vdPar[3]) ; // P04
double dAngle = Clamp( vdPar[4], -90., 90.9) ; // P06
double dInclination = Clamp( vdPar[5], 0.1, 179.9) ; // P07
double dIntAngRef = Clamp( vdPar[6], 0.1, 179.9) ; // P08
double dIntAngOpp = Clamp( vdPar[7], 0.1, 179.9) ; // P09
double dAddAngOpp = Clamp( vdPar[8], 0.1-dIntAngOpp, 179.9-dIntAngOpp) ; // P10
double dDepth = Clamp( vdPar[9], 1., 50000.) ; // P11
double dLength = Clamp( vdPar[10], 1., 100000.) ; // P12
double dThick = Clamp( vdPar[11], 1., 50000.) ; // P13
double dDispEntRef = Clamp( vdPar[12], 0., 50000.) ; // P14
double dDispEntOpp = Clamp( vdPar[13], 0., 50000.) ; // P15
// costruzione delle normali delle facce
double dAngEff = ( nGroup == 4 ? dAngle : ANG_STRAIGHT - dAngle) ;
double dInclEff = ( nGroup == 4 ? dInclination : ANG_STRAIGHT - dInclination) ;
Vector3d vtN1 = Z_AX ;
vtN1.Rotate( Y_AX, dIntAngRef) ;
Vector3d vtN3 = - vtN1 ;
vtN3.Rotate( Y_AX, dAddAngOpp) ;
Vector3d vtNf = vtN1 ;
vtNf.Rotate( Y_AX, - dIntAngOpp) ;
vtNf.Rotate( X_AX, dInclEff - 90) ;
Vector3d vtN2 = - Z_AX ;
vtN2.Rotate( X_AX, dInclEff) ;
Vector3d vtN4 = - vtN2 ;
vtN1.Rotate( Z_AX, dAngEff) ;
vtN2.Rotate( Z_AX, dAngEff) ;
vtN3.Rotate( Z_AX, dAngEff) ;
vtN4.Rotate( Z_AX, dAngEff) ;
vtNf.Rotate( Z_AX, dAngEff) ;
// costruzione dei vettori edge faccia 1
Vector3d vtEv = vtN1 ^ vtN2 ;
vtEv.Normalize() ;
Vector3d vtEo = vtN1 ^ vtNf ;
vtEo.Normalize() ;
double dCoeff = vtEv.z ;
// se caso frontale
if ( abs( ptP.z) > EPS_SMALL) {
double dRotAng = ( nGroup == 4 ? - ANG_RIGHT : ANG_RIGHT) ;
vtN1.Rotate( Y_AX, dRotAng) ;
vtN2.Rotate( Y_AX, dRotAng) ;
vtN3.Rotate( Y_AX, dRotAng) ;
vtN4.Rotate( Y_AX, dRotAng) ;
vtNf.Rotate( Y_AX, dRotAng) ;
vtEv.Rotate( Y_AX, dRotAng) ;
vtEo.Rotate( Y_AX, dRotAng) ;
}
// calcolo del punto sul fondo
Point3d ptB = ptP - vtEv * ( dDepth / dCoeff) ;
// facce
Polygon3d plyFaceF ;
if ( ! CreatePolygonInBox( ptB, vtNf, nSide, plyFaceF))
return false ;
Polygon3d plyFace1 ;
if ( ! CreatePolygonInBox( ptB, vtN1, nSide, plyFace1))
return false ;
Polygon3d plyFace2 ;
if ( ! CreatePolygonInBox( ptB + vtEo * dThick / 2, vtN2, nSide, plyFace2))
return false ;
Polygon3d plyFace3 ;
if ( ! CreatePolygonInBox( ptB + vtN1 * dLength, vtN3, nSide, plyFace3))
return false ;
Polygon3d plyFace4 ;
if ( ! CreatePolygonInBox( ptB - vtEo * dThick / 2, vtN4, nSide, plyFace4))
return false ;
// trimmo tra loro le facce
if ( ! TrimPolygons( plyFaceF, plyFace1, false, false) ||
! TrimPolygons( plyFaceF, plyFace2, false, false) ||
! TrimPolygons( plyFaceF, plyFace3, false, false) ||
! TrimPolygons( plyFaceF, plyFace4, false, false))
return false ;
if ( ! TrimPolygons( plyFace1, plyFace2, false, false) ||
! TrimPolygons( plyFace2, plyFace3, false, false) ||
! TrimPolygons( plyFace3, plyFace4, false, false) ||
! TrimPolygons( plyFace4, plyFace1, false, false))
return false ;
// creo la trimesh dalle facce
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
if ( IsNull( pStm))
return false ;
if ( ! DoSewing( pStm, plyFaceF) || ! DoSewing( pStm, plyFace1) ||
! DoSewing( pStm, plyFace2) || ! DoSewing( pStm, plyFace3) ||
! DoSewing( pStm, plyFace4))
return false ;
pStm->DoCompacting() ;
// inserisco la superficie nel DB geometrico
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pStm)) ;
if ( nId == GDB_ID_NULL)
return false ;
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// parametri
SetParams( nId, vnDPar, vdPar) ;
// aggiusto l'outline
if ( UseProcessToTrimOutline( nId))
TrimOutline( nId) ;
return true ;
}
@@ -1265,6 +1432,8 @@ BtlGeom::AddLapJoint( int nGroup, int nProc, int nSide, const string& sDes, int
double dChAng = Clamp( vdPar[11], 0., 89.) ; // P13
double dWidth = ( ( vdPar[12] > EPS_SMALL) ? vdPar[12] : GetSideWidth( nSide) - dStartY) ; // P14
Point3d ptP( dStartX, dStartY, dStartZ) ;
// disabilito nFlag
nFlag = 0 ;
// faccia di inizio
Polygon3d plyStart ;
Vector3d vtN1 = FromSpherical( 1, 180 - dInclination, 90 - dAngle) ;
@@ -1744,11 +1913,11 @@ BtlGeom::AddDrill( int nGroup, int nProc, int nSide, const string& sDes, int nPr
if ( vdPar.size() < 7)
return false ;
// sistemo i dati
Point3d ptP( vdPar[0], vdPar[1], - vdPar[2]) ;
double dAngHor = Clamp( vdPar[3], 0., 360.) ;
double dAngVert = Clamp( vdPar[4], 1., 179.) ;
double dDepth = vdPar[5] / sin( dAngVert * DEGTORAD) ;
double dRad = vdPar[6] / 2 ;
Point3d ptP( vdPar[0], vdPar[1], - vdPar[2]) ; // P01, P02, P03
double dAngHor = Clamp( vdPar[3], 0., 360.) ; // P06
double dAngVert = Clamp( abs( vdPar[4]), 1., 179.) ; // P07
double dDepth = vdPar[5] / sin( dAngVert * DEGTORAD) ; // P11
double dRad = vdPar[6] / 2 ; // P12
// calcolo la direzione esterna del foro
Vector3d vtN = Z_AX ;
// foro su una delle facce laterali
@@ -1778,12 +1947,14 @@ BtlGeom::AddDrill( int nGroup, int nProc, int nSide, const string& sDes, int nPr
return false ;
pArc->SetExtrusion( vtN) ;
pArc->SetThickness( - dDepth) ;
// porto l'entità nel piano della faccia
// porto l'entità in globale
Frame3d frRef = GetSideFrame( nSide) ;
pArc->ToGlob( frRef) ;
Vector3d vtNG = pArc->GetNormVersor() ;
// verifico se inizio su faccia
// determino i punti iniziale e finale
Point3d ptStart = pArc->GetCenter() ;
Point3d ptEnd = ptStart - vtNG * dDepth ;
// verifico se inizio su faccia
bool bStartClosed = true ;
double dSinStart = 0 ;
for ( int i = BTL_SIDE_FRONT ; i <= BTL_SIDE_LEFT ; ++ i) {
@@ -1796,7 +1967,6 @@ BtlGeom::AddDrill( int nGroup, int nProc, int nSide, const string& sDes, int nPr
}
double dStartAgg = (( bStartClosed || dSinStart < EPS_SMALL) ? 0 : dRad * dSinStart + LEN_EXTRUS_AGG) ;
// verifico se fine su faccia
Point3d ptEnd = ptStart - vtNG * dDepth ;
bool bEndClosed = true ;
double dSinEnd = 0 ;
for ( int i = BTL_SIDE_FRONT ; i <= BTL_SIDE_LEFT ; ++ i) {
@@ -2863,9 +3033,9 @@ BtlGeom::AddMarking( int nGroup, int nProc, int nSide, const string& sDes, int n
// dati
double dLen = dQuadH / vtD.y ;
Vector3d vtE = vtD ; vtE.Rotate( Z_AX, (( nGroup == 3) ? dIntAng : - dIntAng)) ;
if ( abs( vtE.x) < EPS_ZERO)
return false ;
double dLen2 = dWidth / abs( vtE.x) ;
double dLen2 = GetSideWidth( nSide) ;
if ( abs( vtE.x) > EPS_SMALL)
dLen2 = dWidth / abs( vtE.x) ;
// creo la prima linea
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
if ( IsNull( pLine))
@@ -3012,6 +3182,370 @@ BtlGeom::AddText( int nGroup, int nProc, int nSide, const string& sDes, int nPro
return true ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::AddSimpleScarf( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar)
{
// verifica dei parametri
if ( vdPar.size() < 6)
return false ;
// sistemo i dati
double dStartX = vdPar[0] ; // P01
double dDepthRef = Clamp( vdPar[1], 0., 50000.) ; // P11
double dDepthOpp = Clamp( vdPar[2], 0., 50000.) ; // P12
double dLength = Clamp( vdPar[3], 0., 50000.) ; // P13
double dHoDiam1 = Clamp( vdPar[4], 0., 1000.) ; // P14
double dHoDiam2 = Clamp( vdPar[5], 0., 1000.) ; // P15
// calcolo la normale principale
Vector3d vtN = ( nGroup == 2 ? - X_AX : X_AX) ;
// punti di riferimento
Point3d ptP1( dStartX, 0, - dDepthRef) ;
Point3d ptP2( dStartX - vtN.x * dLength, 0, - GetSideHeight( nSide) + dDepthRef) ;
// creo il primo poligono di taglio
Polygon3d plyFace1 ;
if ( ! CreatePolygonInBox( ptP1, vtN, nSide, plyFace1))
return false ;
// creo il secondo poligono di taglio
Vector3d vtM = ptP2 - ptP1 ;
vtM.Normalize() ;
vtM.Rotate( Y_AX, ( nGroup == 2 ? ANG_RIGHT : - ANG_RIGHT)) ;
Polygon3d plyFace2 ;
if ( ! CreatePolygonInBox( ptP1, vtM, nSide, plyFace2))
return false ;
// creo il terzo poligono di taglio
Polygon3d plyFace3 ;
if ( ! CreatePolygonInBox( ptP2, vtN, nSide, plyFace3))
return false ;
// trim tra queste facce
if ( ! TrimPolygons( plyFace1, plyFace2, true, false) ||
! TrimPolygons( plyFace2, plyFace3, false, false))
return false ;
// creo la trimesh dalle facce
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
if ( IsNull( pStm))
return false ;
if ( ! DoSewing( pStm, plyFace1) ||
! DoSewing( pStm, plyFace2) ||
! DoSewing( pStm, plyFace3))
return false ;
pStm->DoCompacting() ;
// inserisco la superficie nel DB geometrico
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pStm)) ;
if ( nId == GDB_ID_NULL)
return false ;
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// parametri
SetParams( nId, vnDPar, vdPar) ;
// aggiusto l'outline
if ( UseProcessToTrimOutline( nId))
TrimOutline( nId) ;
return true ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::AddScarfJoint( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar)
{
// verifica dei parametri
if ( vdPar.size() < 9)
return false ;
// sistemo i dati
double dStartX = vdPar[0] ; // P01
double dInclination = Clamp( vdPar[1], 0., 90.) ; // P07
int nType = lround( vdPar[2]) ; // P09
double dLapLength = Clamp( vdPar[3], 0., 50000.) ; // P10
double dLapDepth = Clamp( vdPar[4], 0., 50000.) ; // P11
double dDepthOpp = Clamp( vdPar[5], 0., 50000.) ; // P12
double dLength = Clamp( vdPar[6], 0., 50000.) ; // P13
double dHoDiam1 = Clamp( vdPar[7], 0., 1000.) ; // P14
double dHoDiam2 = Clamp( vdPar[8], 0., 1000.) ; // P15
double dHeight = GetSideHeight( nSide) ;
// aggiustamenti
if ( nType == 0) {
// devo calcolare dInclination, dLapLength e dDepthOpp (vedi note in Wiki)
DBLVECTOR vdPoly( 3) ;
vdPoly[0] = - dLapDepth * dLapDepth * ( dLength * dLength + dHeight * dHeight) ;
vdPoly[1] = 2 * dHeight * dLapDepth * dLapDepth ;
vdPoly[2] = dLength * dLength - dLapDepth * dLapDepth ;
DBLVECTOR vdRoot ;
int nRoots = PolynomialRoots( 2, vdPoly, vdRoot) ;
if ( nRoots > 0 && vdRoot[0] > EPS_SMALL && vdRoot[0] < dHeight)
dDepthOpp = vdRoot[0] ;
else if ( nRoots > 1 && vdRoot[1] > EPS_SMALL && vdRoot[1] < dHeight)
dDepthOpp = vdRoot[1] ;
else
return false ;
dInclination = acos( dLapDepth / dDepthOpp) * RADTODEG ;
dLapLength = ( sqrt( dLength * dLength + ( dHeight - dDepthOpp) * ( dHeight - dDepthOpp)) - dDepthOpp * sin( dInclination * DEGTORAD)) / 2 ;
}
// calcolo la direzione principale e quella ortogonale
Vector3d vtV1 = - X_AX ;
vtV1.Rotate( Y_AX, dInclination) ;
Vector3d vtV2 = vtV1 ;
vtV2.Rotate( Y_AX, ANG_RIGHT) ;
// punti di riferimento
Point3d ptP( dStartX + dLength, 0, -dHeight) ;
Point3d ptQ = ptP + Z_AX * dDepthOpp ;
Point3d ptR = ptQ + vtV1 * dLapLength ;
Point3d ptS = ptR - vtV2 * dLapDepth ;
Point3d ptT = ptP + vtV1 * dLength / abs( vtV1.x) ;
Point3d ptU( dStartX, 0, 0) ;
if ( nType == -1) {
ptP = ptQ - vtV2 * dDepthOpp / vtV2.z ;
ptU = ptT + vtV2 * ( - ptT.z) / vtV2.z ;
}
// creo il profilo
PolyLine PL ;
PL.AddUPoint( 0, ptP) ;
PL.AddUPoint( 1, ptQ) ;
PL.AddUPoint( 2, ptR) ;
PL.AddUPoint( 3, ptS) ;
PL.AddUPoint( 4, ptT) ;
PL.AddUPoint( 5, ptU) ;
if ( nGroup == 1)
PL.Mirror( ptT, X_AX) ;
// lo porto in globale
Frame3d frSide = GetSideFrame( nSide) ;
PL.ToGlob( frSide) ;
// definisco la superficie
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
if ( IsNull( pStm) || ! pStm->CreateByExtrusion( PL, frSide.VersY() * GetSideWidth( nSide)))
return false ;
if ( nGroup == 1)
pStm->Invert() ;
// eseguo trim con le facce della trave
TrimSurfTmWithBox( pStm) ;
// inserisco la superficie nel DB geometrico
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pStm)) ;
if ( nId == GDB_ID_NULL)
return false ;
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// parametri
SetParams( nId, vnDPar, vdPar) ;
// aggiusto l'outline
if ( UseProcessToTrimOutline( nId))
TrimOutline( nId) ;
return true ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::AddStepJoint( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar)
{
// verifica dei parametri
if ( vdPar.size() < 7)
return false ;
// sistemo i dati
double dStartX = vdPar[0] ; // P01
int nType = lround( vdPar[1]) ; // P04
double dInclination = Clamp( vdPar[2], 0.1, 179.9) ; // P07
double dStepDepth = Clamp( vdPar[3], 0., 1000.) ; // P11
double dHeelDepth = Clamp( vdPar[4], 0., 1000.) ; // P12
double dTenHeight = Clamp( vdPar[5], 0., 1000.) ; // P14
double dTenWidth = Clamp( vdPar[6], 0., 1000.) ; // P15
// gestione angolo ottuso
bool bMirrZ = ( dInclination > ANG_RIGHT) ;
if ( bMirrZ) {
dInclination = ANG_STRAIGHT - dInclination ;
dStartX += ( nGroup == 2 ? -1 : 1) * GetSideHeight( nSide) / tan( dInclination * DEGTORAD) ;
}
// controllo del tipo
if ( dStepDepth > EPS_SMALL && dHeelDepth > EPS_SMALL)
nType = 0 ;
else if ( dHeelDepth <= EPS_SMALL || abs( dInclination - ANG_RIGHT) < EPS_ANG_SMALL ||
dHeelDepth / cos( dInclination * DEGTORAD) > GetSideHeight( nSide) - EPS_SMALL)
nType = 1 ;
// definizione punti notevoli
Point3d ptP( dStartX, 0, 0) ;
Vector3d vtV1 = - X_AX ;
vtV1.Rotate( Y_AX, dInclination) ;
Point3d ptQ = ptP - vtV1 * GetSideHeight( nSide) / vtV1.z ;
if ( dHeelDepth > EPS_SMALL)
ptQ += - X_AX * dHeelDepth / sin( dInclination * DEGTORAD) ;
Point3d ptS = ptQ ;
if ( nType == 0)
ptS += Z_AX * dHeelDepth / cos( dInclination * DEGTORAD) ;
Point3d ptT = ptP ;
if ( dStepDepth > EPS_SMALL) {
double dAngT = ( ANG_STRAIGHT - dInclination) / 2 ;
Vector3d vtV2 = vtV1 ;
vtV2.Rotate( Y_AX, dAngT) ;
ptT += - vtV2 * dStepDepth / sin( dAngT * DEGTORAD) ;
}
// creazione profilo
PolyLine PL ;
PL.AddUPoint( 0, ptP) ;
PL.AddUPoint( 0, ptT) ;
PL.AddUPoint( 0, ptS) ;
PL.AddUPoint( 0, ptQ) ;
if ( bMirrZ) {
PL.Mirror( Point3d( 0, 0, - GetSideHeight( nSide) / 2), Z_AX) ;
PL.Invert() ;
}
if ( nGroup == 1)
PL.Mirror( ptP, X_AX) ;
// lo porto in globale
Frame3d frSide = GetSideFrame( nSide) ;
PL.ToGlob( frSide) ;
// definisco la superficie
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
if ( IsNull( pStm) || ! pStm->CreateByExtrusion( PL, frSide.VersY() * GetSideWidth( nSide)))
return false ;
if ( nGroup == 2)
pStm->Invert() ;
// eseguo trim con le facce della trave
TrimSurfTmWithBox( pStm) ;
// inserisco la superficie trimesh nel DB geometrico
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pStm)) ;
if ( nId == GDB_ID_NULL)
return false ;
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// parametri
SetParams( nId, vnDPar, vdPar) ;
// aggiusto l'outline
if ( UseProcessToTrimOutline( nId))
TrimOutline( nId) ;
return true ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::AddStepJointNotch( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar)
{
// verifica dei parametri
if ( vdPar.size() < 7)
return false ;
// sistemo i dati
double dStartX = vdPar[0] ; // P01
double dStartY = vdPar[1] ; // P02
int nType = lround( vdPar[2]) ; // P04
double dInclination = Clamp( vdPar[3], 0.1, 179.9) ; // P07
double dWidth = Clamp( vdPar[4], 0., 50000.) ; // P10
double dStepDepth = Clamp( vdPar[5], 0., 1000.) ; // P11
double dHeelDepth = Clamp( vdPar[6], 0., 1000.) ; // P12
double dStructHeight = Clamp( vdPar[7], 0., 50000.) ; // P13
double dTenHeight = Clamp( vdPar[8], 0., 1000.) ; // P14
double dTenWidth = Clamp( vdPar[9], 0., 1000.) ; // P15
// gestione angolo ottuso
double dLen = dStructHeight / sin( dInclination * DEGTORAD) ;
bool bMirrX = ( dInclination > ANG_RIGHT) ;
if ( bMirrX) {
dInclination = ANG_STRAIGHT - dInclination ;
dStartX += ( nGroup == 4 ? dLen : - dLen) ;
}
// controllo del tipo
if ( dStepDepth > EPS_SMALL && dHeelDepth > EPS_SMALL)
nType = 0 ;
else if ( dHeelDepth <= EPS_SMALL || abs( dInclination - ANG_RIGHT) < EPS_ANG_SMALL ||
dHeelDepth / cos( dInclination * DEGTORAD) > dLen - EPS_SMALL)
nType = 1 ;
// riferimento della faccia
Frame3d frSide = GetSideFrame( nSide) ;
// definizione punti notevoli
Vector3d vtV1 = X_AX ;
vtV1.Rotate( Y_AX, - dInclination) ;
Point3d ptP( dStartX, dStartY, 0) ;
Point3d ptQ = ptP + X_AX * dLen ;
Point3d ptR = ptQ ;
if ( dHeelDepth > EPS_SMALL)
ptR += - vtV1 * dHeelDepth / sin( dInclination * DEGTORAD) ;
Point3d ptS ;
if ( nType == 0)
ptS = ptQ - X_AX * dHeelDepth / ( sin( dInclination * DEGTORAD) * cos( dInclination * DEGTORAD)) ;
else
ptS = ptR ;
Point3d ptT = ptP ;
if ( dStepDepth > EPS_SMALL) {
double dAngT = ( ANG_STRAIGHT - dInclination) / 2 ;
Vector3d vtV2 = vtV1 ;
vtV2.Rotate( Y_AX, - dAngT) ;
ptT += - vtV2 * dStepDepth / sin( dAngT * DEGTORAD) ;
}
// creazione profilo
double dU = 0 ;
PolyLine PL ;
if ( ! AreSamePointApprox( ptP, ptT)) {
PL.AddUPoint( dU, ptP) ;
PL.AddUPoint( ++dU, ptT) ;
// se doppio lobo laterale, abbasso il centro per non avere problemi
if ( ! AreSamePointApprox( ptS, ptR))
ptS -= Z_AX * 10 * EPS_SMALL ;
}
else if ( AreSamePointApprox( ptS, ptR))
PL.AddUPoint( dU, ptP) ;
PL.AddUPoint( ++dU, ptS) ;
PL.AddUPoint( ++dU, ptR) ;
PL.AddUPoint( ++dU, ptQ) ;
if ( bMirrX) {
PL.Mirror( ptP, X_AX) ;
PL.Invert() ;
}
if ( nGroup == 3)
PL.Mirror( ptP, X_AX) ;
// lo porto in globale
PL.ToGlob( frSide) ;
// definisco la superficie
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
if ( IsNull( pStm) || ! pStm->CreateByExtrusion( PL, frSide.VersY() * dWidth))
return false ;
if ( nGroup == 3)
pStm->Invert() ;
// definisco ed aggiungo eventuale faccia anteriore
if ( dStartY > EPS_SMALL) {
// profilo superiore
PolyLine PL2 = PL ;
PL2.Scale( frSide, 1, 1, 0) ;
// creo la superficie rigata
PtrOwner<ISurfTriMesh> pSfr( CreateSurfTriMesh()) ;
if ( IsNull( pSfr) || ! pSfr->CreateByTwoCurves( PL, PL2))
return false ;
// la unisco alla superficie principale
if ( ! pStm->DoSewing( *pSfr))
return false ;
}
// definisco ed aggiungo eventuale faccia posteriore
if ( dStartY + dWidth < GetSideWidth( nSide) - EPS_SMALL) {
// profilo superiore
PolyLine PL2 = PL ;
PL2.Scale( frSide, 1, 1, 0) ;
// creo la superficie rigata
PtrOwner<ISurfTriMesh> pSfr( CreateSurfTriMesh()) ;
if ( IsNull( pSfr) || ! pSfr->CreateByTwoCurves( PL, PL2))
return false ;
// la inverto e la traslo
pSfr->Invert() ;
pSfr->Translate( frSide.VersY() * dWidth) ;
// la unisco alla superficie principale
if ( ! pStm->DoSewing( *pSfr))
return false ;
}
// eseguo trim con le facce della trave
TrimSurfTmWithBox( pStm) ;
// inserisco la superficie trimesh nel DB geometrico
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pStm)) ;
if ( nId == GDB_ID_NULL)
return false ;
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// parametri
SetParams( nId, vnDPar, vdPar) ;
// aggiusto l'outline
if ( UseProcessToTrimOutline( nId))
TrimOutline( nId) ;
return true ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::AddProfileHeadCoCo( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
+1
View File
@@ -29,5 +29,6 @@
#include "/EgtDev/Include/EgtLibVer.h"
#pragma comment(lib, EGTLIBDIR "EgtGeneral" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "EgtNumKernel" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "EgtGeomKernel" EGTLIBVER ".lib")
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")