92 Commits

Author SHA1 Message Date
Daniele Bariletti f50d5b7612 EgtExchange :
- correzione al trim delle Bezier importate da NURBS.
2023-11-07 17:37:58 +01:00
Daniele Bariletti c08486acb7 EgtExchange :
- corretti errori nel trim di superfici Bezier importate da NURBS.
2023-11-06 15:56:09 +01:00
Daniele Bariletti 8959255d29 EgtExchange :
- corretto il trim di superfici di bezier convertite da superfici NURBS.
2023-11-03 13:14:15 +01:00
Daniele Bariletti d3bf0a7839 EgtExchange :
- corretta la riparametrizzazione tra superficie NURBS e Bezier.
2023-10-31 09:44:26 +01:00
Daniele Bariletti 2e385022f3 EgtExchange :
- correzione del filtro.
- aggiunta del materiale alle trimesh.
2023-10-30 10:35:40 +01:00
Daniele Bariletti de4b31b950 Merge branch 'master' into 3dm_import. 2023-10-24 15:31:00 +02:00
Daniele Bariletti 47e4b3c0a5 EgtExchange :
- correzione sul filtro export 3dm.
2023-10-24 14:52:00 +02:00
Daniele Bariletti 55f20bf4ec EgtExchange :
- aggiunte a import/export 3dm.
2023-10-24 14:33:15 +02:00
SaraP 3557e2652e EgtExchange :
- piccole modifiche stilistiche.
2023-10-24 11:53:26 +02:00
SaraP c18d3e3163 EgtExchange :
- piccole modifiche Export3dm.
2023-10-23 17:34:55 +02:00
Daniele Bariletti db76003aae EgtExchange 2.5j5 :
- aggiornamento versione.
2023-10-23 16:01:41 +02:00
Daniele Bariletti dcfc78e7ca EgtExchange :
- aggiornamento della versione (2.5j4).
2023-10-23 15:57:58 +02:00
Daniele Bariletti 966dfeabae EgtExchange :
- formattazione del testo.
2023-10-23 15:00:12 +02:00
Daniele Bariletti 3428e12cf6 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-10-23 14:31:20 +02:00
Daniele Bariletti 0a3a4ce532 EgtExchange :
- correzioni all'export 3dm.
2023-10-23 14:30:34 +02:00
Daniele Bariletti 44e1517a59 EgtExchange :
- introdotto l'Export di file 3dm.
2023-10-23 12:39:25 +02:00
Daniele Bariletti cc0c8e7ed8 EgtExchange :
- reintrotto il trim delle superfici nell'import3dm.
2023-10-23 12:12:36 +02:00
SaraP ef92d58ac1 EgtExchange 2.5j3 :
- in Export3MF aggiunta esportazione delle info come metadata.
2023-10-20 10:06:55 +02:00
Dario Sassi 7786be93d0 EgtExchange :
- in importBTL modificata gestione FreeContour che è area vietata (LockOut).
2023-10-18 11:21:24 +02:00
Daniele Bariletti 2804bf0b60 EgtExchange :
- correzioni varie a import/export 3dm.
2023-10-17 11:09:23 +02:00
Daniele Bariletti 5e8e6aebb1 EgtExchange :
- modificate delle impostazioni, ora che la libreria opeNURBS è stata
compilata a x32 e x64 con LLVM.
2023-10-13 13:24:49 +02:00
SaraP 93ef6fe319 EgtExchange :
- in import BTLx corretto free contour con lato inclinato
- migliorie nella gestione dei free contour.
2023-10-11 11:26:50 +02:00
Daniele Bariletti 09c8aa2d66 EgtExchange :
- modificate delle impostazioni e link per usare opennurbs compilata
con LLVM.
2023-10-11 11:14:36 +02:00
Daniele Bariletti 2f5e2203c0 EgtExchange :
- aggiunta una funzione di conversione vettori a Import 3dm.
2023-10-11 11:12:55 +02:00
Dario Sassi 06b7d51b0a EgtExchange :
- in import BTLx corretto passaggio path apertura file come wchar.
2023-10-11 08:50:30 +02:00
Dario Sassi a7a0157fed EgtExchange 2.5j2 :
- ricompilazione con cambio versione.
2023-10-11 08:30:31 +02:00
SaraP 3bf1f66883 EgtExchange :
- corretti errori in import BTLx
- migliorie varie.
2023-10-10 14:53:37 +02:00
Dario Sassi 731c4d1b61 EgtExchange 2.5j1 :
- ricompilazione con cambio versione.
2023-10-09 13:04:04 +02:00
Daniele Bariletti 898d979e08 EgtExchange :
- aggiunta delle info agli oggeti nell'export 3dm.
- riformattazione e sistemazione codice dei file import e export 3dm.
2023-10-06 12:28:44 +02:00
Daniele Bariletti e9dff179e0 EgtExchange :
- aggiunta info ai layer e export punti, per file 3dm.
2023-10-04 13:04:14 +02:00
Daniele Bariletti 9f7bdb2202 EgtExchange :
- aggiunte alle funzioni dell' Export 3dm.
Manca :
- trim delle superfici.
2023-10-02 12:45:20 +02:00
Daniele Bariletti 329646ca9d EgtExchange :
- aggiute funzioni al 3dm Export.
2023-10-02 09:30:40 +02:00
Dario Sassi 4c84f4adff EgtExchange 2.5i6 :
- in import BTL per NUM aggiunto salto delle custom macro (G > 99).
2023-09-27 21:09:49 +02:00
Daniele Bariletti 2c9da3e14d EgtExchange :
- aggiunta del 3dm Export. Da completare.
2023-09-21 17:04:32 +02:00
Dario Sassi 39f9fd86e7 EgtExchange 2.5i5 :
- ricompilazione a 64bit con Enable Enhanced Instruction Set = Not Set.
2023-09-21 15:24:13 +02:00
Daniele Bariletti 4cfdf2b872 EgtExchange :
- introduzione delle nurbs periodiche; da finire.
2023-09-21 14:39:36 +02:00
Daniele Bariletti 2a0e7bed0b EgtExchange :
- aggiunti gli oggetti annotazione nell'import dei file 3dm.
2023-09-19 12:35:05 +02:00
Daniele Bariletti 5c8a2974cb EgtExchange :
- corretti un bug sull'import di brep da file 3dm.
Manca :
- oggetti annotazioni
- curve nurbs periodiche.
2023-09-13 16:13:29 +02:00
Daniele Bariletti 31eb6acb0b EgtExchange :
- correzione in import3dm sulla conversione di superfici piane.
2023-09-12 16:37:37 +02:00
Daniele Bariletti def9225e61 EgtExchange :
- correzione di bug nella conversione di superfici e curve NURBS.
Manca :
- bug nel trim delle superfici di Bezier ( spazio parametrico).
2023-09-12 14:56:56 +02:00
Dario Sassi 306734dc97 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-09-11 10:42:11 +02:00
Dario Sassi 9febfb8147 EgtExchange 2.5i1 :
- ricompilazione con cambio versione.
2023-09-11 10:40:58 +02:00
Daniele Bariletti de4d1fc711 EgtExchange :
- corretti alcuni bug nell' import 3dm.
2023-09-08 15:49:46 +02:00
Riccardo Elitropi 8d11dc838a Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-09-06 11:10:35 +02:00
Riccardo Elitropi 3ab1488fbb EgtExchange :
- esportazione Layers per 3MF.
2023-09-06 11:10:27 +02:00
Daniele Bariletti c5503427cb EgtExchange :
- aggiunti oggetti all'import3dm e corretti alcuni bug.
2023-09-01 17:22:03 +02:00
Dario Sassi 1dc2992628 EgtExchange 2.5h2 :
- in import BTL aggiunta gestione piani di riferimento a Slot (3/4-016-X)
- in import BTL corretta gestione piani di riferimento in Pocket (4-039-X).
2023-08-30 10:13:34 +02:00
Dario Sassi 7453297954 EgtExchange 2.5h1 :
- in ExportSvg aggiunta gestione spessore geometrico curve (vtExtr + dThick).
2023-08-23 16:46:39 +02:00
Daniele Bariletti 549f3d47bd EgtExchange:
- aggiunto l'import per file 3dm.
2023-08-03 10:18:12 +02:00
DarioS 595452db1e EgtExchange 2.5g3 :
- in import BTL aggiunta gestione riferimento anche quando feature è senza geometria.
2023-07-24 09:31:49 +02:00
DarioS 1061fee7ef EgtExchange 2.5g2 :
- in import BTL aggiunta gestione riferimento a feature Mortise
- in import BTL si salva riferimento di feature solo se non identità.
2023-07-20 20:41:11 +02:00
DarioS f7f2921607 EgtExchange 2.5g1 :
- ricompilazione con cambio versione.
2023-07-10 11:14:49 +02:00
DarioS dc7977d64e EgtExchange 2.5f2 :
- modifica a export Svg per evitare segnalazione di errori trascurabili.
2023-06-23 16:58:58 +02:00
DarioS edf44dd718 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-06-19 08:07:02 +02:00
DarioS ae559b3d58 EgtExchange 2.5f1 :
- ricompilazione con cambio versione.
2023-06-19 08:01:34 +02:00
Riccardo Elitropi 4049b25d7d EgtExchange :
- in ExportThreeJS tolto il piano trasparente della griglia.
2023-06-05 10:25:30 +02:00
Riccardo Elitropi 8c73d977f5 Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-05-30 12:58:26 +02:00
Riccardo Elitropi b3d4c9909d EgtExchange :
- modifica render telecamera ortografica e prospettica con resize della window.
2023-05-30 12:58:13 +02:00
DarioS 8426092c6f EgtExchange 2.5e5 :
- migliorato controllo gestione chiave di rete.
2023-05-30 10:25:16 +02:00
DarioS 48a590d27a Merge branch 'master' of https://gitlab.steamware.net/egaltech/EgtExchange 2023-05-27 10:40:15 +02:00
DarioS 69d368e15d EgtExchange 2.5e4 :
- in import BTL corretta gestione fori molto grandi e parzialmente esterni al pezzo
- in import BTL corretta gestione parametri dummy di feature derivate da altre (P05 di House derivata da Tenon).
2023-05-27 10:38:30 +02:00
Riccardo Elitropi 29c62ecc94 EgtExchange :
- piccola modifica telecamera in ExportThreeJs.
2023-05-26 12:37:49 +02:00
DarioS 3f03526fd5 EgtExchange 2.5e3 :
- in import BTL corretta gestione Slot (3/4-016-X) per angolo P10
- in import BTL aggiunta a Pocket (4-039-X) gestione P04 (flag facce aperte).
2023-05-26 08:41:07 +02:00
DarioS 3a47f8962b EgtExchange 2.5e2 :
- in export SVG si assegna una dimensione minima al box di vista.
2023-05-10 16:06:35 +02:00
DarioS d24d500a9e EgtExchange 2.5e1 :
- ricompilazione con cambio versione.
2023-05-08 08:24:39 +02:00
DarioS cdb28104a9 EgtExchange :
- in taglio Feature con Outline portato extra-taglio a 0.05 mm.
2023-04-17 09:29:55 +02:00
DarioS 26b1107e33 EgtExchange 2.5d3 :
- ricompilazione con cambio versione.
2023-04-11 19:36:04 +02:00
DarioS 55449f3c3f EgtExchange :
- in import BTL correzioni gestione basi Tenoni e DtTenoni in caso di annullamento
- aggiustamenti per PtrOwner nuova funzione Set.
2023-03-27 20:42:06 +02:00
DarioS d4cc57e2f9 EgtExchange 2.5c2 :
- in gestione Beam/Btl migliorato trattamento contorni di Mortise.
2023-03-22 17:34:54 +01:00
DarioS a992b48201 EgtExchange 2.5c1 :
- in import BTL aggiunto controllo unicità PDN.
2023-03-13 08:17:56 +01:00
DarioS c2c0e7d246 EgtExchange 2.5b3 :
- ricompilazione con cambio versione.
2023-02-27 08:16:53 +01:00
DarioS a75725dd05 EgtExchange 2.5b2 :
- ricompilazione con cambio versione.
2023-02-20 09:15:22 +01:00
DarioS defa91177e EgtExchange :
- aggiornati flag di compilazione
- tolti include inutili.
2023-01-09 10:11:08 +01:00
DarioS a9d52a5c49 EgtExchange 2.5a1 :
- ricompilazione con cambio versione.
2023-01-03 08:52:55 +01:00
DarioS c9753c73f9 EgtExchange 2.4l3 :
- in import CNC corretta gestione archi specificati con il centro (ora si approssima questo e non il punto finale).
2022-12-20 16:36:09 +01:00
DarioS fcbe6c2db1 EgtExchange 2.4l2 :
- in BTL migliorata gestione Outline con angoli di fianco (ora allungamento dei singoli tratti funzione anche dello spessore).
2022-12-13 10:58:56 +01:00
DarioS 49d3e03199 EgtExchange 2.4l1 :
- in BTL correzione a AddOneFreeContour (eliminata traslazione per portare Z del primo punto nella faccia)
- in BTL modifica a FreeContour per considerarlo da Trim anche con estremi fuori.
2022-12-04 16:51:03 +01:00
DarioS 35b07c0814 EgtExchange 2.4k6 :
- in import BTL aggiunta gestione FreeContour per chiodature al limite delle specifiche generati da S+S.
2022-11-29 09:05:58 +01:00
DarioS fa3e5c4709 EgtExchange 2.4k5 :
- in BeamMgr corretta CalcSolid con utilizzo superfici originali.
2022-11-25 07:46:37 +01:00
DarioS 1615636771 EgtExchange 2.4k4 :
- in import BTL estesa gestione FreeContour per chiodature singole anche al caso di segmenti di lunghezza nulla.
2022-11-22 08:49:19 +01:00
DarioS 036fe2da43 EgtExchange 2.4k3 :
- in import BTL corretta gestione piano supplementare in FrontSlot
- in import BTL corretto allungamento DovetailMortise senza tasca.
2022-11-12 07:57:47 +01:00
DarioS e3c681bfa2 EgtExchange :
- in BeamMgr imposto livello layer per nomi facce a temporaneo.
2022-11-08 19:12:16 +01:00
DarioS c9b38409ca EgtExchange 2.4k2 :
- modifiche in BeamMgr per gestire visualizzazione nomi facce e freccia di carico
- in import BTLX migliorata gestione Shape e visualizzazione Shape a posto di Outline.
2022-11-08 16:40:52 +01:00
Riccardo Elitropi 91d13357f3 egtExchange :
- posizione centrale dell'oggetto esportato
- render pagina web (prime modifiche)
- Posizione telecamera al cambio tra prospettica e ortografica
- rotazione del cubo attorno al target arruale (e non all'origine)
- Correzione grandezza della lista dei vertici nelle mesh.
2022-11-04 15:00:56 +01:00
Riccardo Elitropi d1f284c718 Merge commit '7fd08a55628410fb18a8cd9d1c18128a921f8c82' 2022-11-03 15:44:52 +01:00
DarioS 7fd08a5562 EgtExchange 2.4k1 :
- in import CNC si saltano le linee che iniziano con "MSG" (messaggio video a utente di Siemens).
2022-11-03 08:51:30 +01:00
DarioS 64fe515d8f EgtExchange 2.4j3 :
- in import BTL corretta gestione riconoscimento lato di uscita faro quando vicini a inizio o fine trave.
2022-10-26 08:42:51 +02:00
Riccardo Elitropi 0689e7df19 EgtExchange :
- Correzione orientamento frame e vettori
- Modifica al groupRoot di ThreeJS
- Correzione cambio coordinate tra sistemi differenti.
2022-10-25 17:13:39 +02:00
DarioS 336c172eee EgtExchange 2.4j2 :
- cambio versione e piccola modifica estetica.
2022-10-24 17:28:18 +02:00
Riccardo Elitropi 4b051ea0ec EgtExchange :
- indentazione codice
- modifica posizione telecamera con apertura da URL parametrizzato.
2022-10-24 16:49:02 +02:00
DarioS 3a66786af8 EgtExchange :
- adattamenti a export ThreeJS.
2022-10-24 08:36:53 +02:00
Riccardo Elitropi b26b1ef2f9 Merge commit 'e5eb2e811f6202282d7c7ece6ff19c632f68cf19' 2022-10-20 16:08:50 +02:00
38 changed files with 6704 additions and 3496 deletions
+178 -11
View File
@@ -18,6 +18,7 @@
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtStringEncoder.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -29,7 +30,7 @@ IBeamMgr*
CreateBeamMgr( void)
{
// verifico la chiave e le opzioni
if ( ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPADV, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPADV))
return nullptr ;
// creo l'oggetto
return static_cast<IBeamMgr*> ( new(nothrow) BeamMgr) ;
@@ -130,7 +131,10 @@ BeamMgr::SetPartProdNbr( int nProdNbr)
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Imposto il numero di produzione al pezzo corrente
// Verifico validità nuovo PDN
if ( ! m_BtlGeom.VerifyNewPartProdNbr( nProdNbr))
return false ;
// Imposto il numero di produzione sul pezzo corrente
return m_BtlGeom.SetPartProdNbr( nProdNbr) ;
}
@@ -141,7 +145,7 @@ BeamMgr::SetPartName( const string& sName)
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Imposto il nome al pezzo corrente
// Imposto il nome sul pezzo corrente
return m_BtlGeom.SetPartName( sName) ;
}
@@ -152,7 +156,7 @@ BeamMgr::SetPartCount( int nCount)
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Imposto il numero delle parti da produrre al pezzo corrente
// Imposto il numero delle parti da produrre sul pezzo corrente
return m_BtlGeom.SetPartCount( nCount) ;
}
@@ -163,9 +167,12 @@ BeamMgr::SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Imposto le dimensioni al pezzo corrente
// Imposto le dimensioni sul pezzo corrente
if ( ! m_BtlGeom.AddPartBox( dLength, dHeight, dWidth))
return false ;
// Eventuale aggiornamento nomi facce e lato di carico
UpdateFacesName() ;
UpdateLoadingSide() ;
// Se richiesto, aggiorno Outline e cancello Solido
if ( bUpdate) {
m_BtlGeom.UpdateOutLine() ;
@@ -199,6 +206,157 @@ BeamMgr::GetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth
return true ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::ShowFacesName( bool bShow)
{
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Verifico esistenza del pezzo corrente
int nPartId = m_BtlGeom.GetCurrPartId() ;
if ( nPartId == GDB_ID_NULL)
return false ;
// Verifico esistenza del gruppo nomi facce
int nFcsNameLayId = m_pGDB->GetFirstNameInGroup( nPartId, FCSNAME_LAYER_NAME) ;
// Se da visualizzare e non esiste il gruppo
if ( bShow && nFcsNameLayId == GDB_ID_NULL) {
// Creazione del gruppo
nFcsNameLayId = m_pGDB->AddGroup( GDB_ID_NULL, nPartId, GLOB_FRM) ;
m_pGDB->SetLevel( nFcsNameLayId, GDB_LV_TEMP) ;
m_pGDB->SetName( nFcsNameLayId, FCSNAME_LAYER_NAME) ;
m_pGDB->SetMaterial( nFcsNameLayId, NAVY) ;
// Scrittura del nome delle facce come testi del layer ausiliario
for ( int nS = BTL_SIDE_FRONT ; nS <= BTL_SIDE_RIGHT ; ++ nS) {
string sFace ;
if ( nS == BTL_SIDE_LEFT)
sFace = "o" ;
else if ( nS == BTL_SIDE_RIGHT)
sFace = "+" ;
else
sFace = "F" + ToString( nS) ;
PtrOwner<IExtText> pText( CreateExtText()) ;
if ( IsNull( pText))
return false ;
double dSLen = m_BtlGeom.GetSideLength( nS) ;
double dSWid = m_BtlGeom.GetSideWidth( nS) ;
Point3d ptPos( 0.5 * dSLen, ( m_BtlGeom.IsTrueSide( nS) ? 10 : 0.5 * dSWid), 1) ;
Vector3d vtDir = ( nS != BTL_SIDE_RIGHT ? X_AX : -X_AX) ;
int nInsPos = ( m_BtlGeom.IsTrueSide( nS) ? ETXT_IPBC : ETXT_IPMC) ;
double dPLen = m_BtlGeom.GetCurrPartLength() ;
double dPHei = m_BtlGeom.GetCurrPartHeight() ;
double dPWid = m_BtlGeom.GetCurrPartWidth() ;
double dCoeff = ( abs( dPHei - dPWid) / abs( dPHei + dPWid) < 0.51 ? 0.1 : 0.2) ;
double dTextHeight = dCoeff * min( { dPLen, dPHei, dPWid}) ;
if ( ! pText->Set( ptPos, Z_AX, vtDir, sFace, "Arial", 100, false, 2 * dTextHeight, 1, 0, nInsPos))
return false ;
// porto il testo nel piano della faccia
Frame3d frRef = m_BtlGeom.GetSideFrame( nS) ;
pText->ToGlob( frRef) ;
// recupero eventuale nome già presente
int nOldTextId = m_pGDB->GetFirstNameInGroup( nFcsNameLayId, sFace) ;
// se gia presente, lo rimpiazzo
if ( nOldTextId != GDB_ID_NULL) {
if ( ! m_pGDB->ReplaceGeoObj( nOldTextId, Release( pText)))
return false ;
}
// altrimenti, lo inserisco
else {
int nTextId = m_pGDB->AddGeoObj( GDB_ID_NULL, nFcsNameLayId, Release( pText)) ;
if ( nTextId == GDB_ID_NULL)
return false ;
// assegno nome
m_pGDB->SetName( nTextId, sFace) ;
}
}
}
// se altrimenti da eliminare ed esiste
else if ( ! bShow && nFcsNameLayId != GDB_ID_NULL) {
m_pGDB->Erase( nFcsNameLayId) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::UpdateFacesName( void)
{
int nFcsNameLayId = m_pGDB->GetFirstNameInGroup( m_BtlGeom.GetCurrPartId(), FCSNAME_LAYER_NAME) ;
if ( nFcsNameLayId == GDB_ID_NULL)
return true ;
m_pGDB->Erase( nFcsNameLayId) ;
return ShowFacesName( true) ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::ShowLoadingSide( bool bShow, bool bFromLeft)
{
// Verifico validità GDB
if ( m_pGDB == nullptr)
return false ;
// Verifico esistenza del pezzo corrente
int nPartId = m_BtlGeom.GetCurrPartId() ;
if ( nPartId == GDB_ID_NULL)
return false ;
// Verifico esistenza del gruppo temporaneo lato di carico
int nLsideGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, LOADINGSIDE_GROUP_NAME) ;
// Se da visualizzare e non esiste il gruppo
if ( bShow && nLsideGrpId == GDB_ID_NULL) {
// Creazione del gruppo
nLsideGrpId = m_pGDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, GLOB_FRM) ;
m_pGDB->SetLevel( nLsideGrpId, GDB_LV_TEMP) ;
m_pGDB->SetName( nLsideGrpId, LOADINGSIDE_GROUP_NAME) ;
m_pGDB->SetMaterial( nLsideGrpId, NAVY) ;
m_pGDB->SetInfo( nLsideGrpId, IKEY_LSIDE, bFromLeft) ;
// Recupero dati del pezzo
Frame3d frPart ;
if ( ! m_pGDB->GetGroupGlobFrame( nPartId, frPart))
return false ;
BBox3d b3Part( 0, 0, 0, m_BtlGeom.GetCurrPartLength(), m_BtlGeom.GetCurrPartHeight(), m_BtlGeom.GetCurrPartWidth()) ;
b3Part.ToGlob( frPart) ;
// Disegno della freccia
PolyLine PL ;
PL.AddUPoint( 0, Point3d( 140, 0, 0)) ;
PL.AddUPoint( 0, Point3d( 100, -40, 0)) ;
PL.AddUPoint( 0, Point3d( 100, -20, 0)) ;
PL.AddUPoint( 0, Point3d( 0, -20, 0)) ;
PL.AddUPoint( 0, Point3d( 0, 20, 0)) ;
PL.AddUPoint( 0, Point3d( 100, 20, 0)) ;
PL.AddUPoint( 0, Point3d( 100, 40, 0)) ;
PL.AddUPoint( 0, Point3d( 140, 0, 0)) ;
Vector3d vtMove = b3Part.GetMin() + ( b3Part.GetDimX() + 50) * X_AX + b3Part.GetDimY() / 2 * Y_AX - ORIG ;
PL.Translate( vtMove) ;
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
if ( IsNull( pStm) || ! pStm->CreateByFlatContour( PL))
return false ;
int nStmId = m_pGDB->AddGeoObj( GDB_ID_NULL, nLsideGrpId, Release( pStm)) ;
if ( nStmId == GDB_ID_NULL)
return false ;
}
// se altrimenti da eliminare ed esiste
else if ( ! bShow && nLsideGrpId != GDB_ID_NULL) {
m_pGDB->Erase( nLsideGrpId) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
BeamMgr::UpdateLoadingSide( void)
{
int nLsideGrpId = m_pGDB->GetFirstNameInGroup( GDB_ID_ROOT, LOADINGSIDE_GROUP_NAME) ;
if ( nLsideGrpId == GDB_ID_NULL)
return true ;
bool bFromLeft = true ;
m_pGDB->GetInfo( nLsideGrpId, IKEY_LSIDE, bFromLeft) ;
m_pGDB->Erase( nLsideGrpId) ;
return ShowLoadingSide( true, bFromLeft) ;
}
//----------------------------------------------------------------------------
int
BeamMgr::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
@@ -218,7 +376,7 @@ BeamMgr::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int n
// Imposto i dati della feature
for ( int i = 0 ; i < int( vnDPar.size()) ; ++ i) {
int j = vnDPar[i] ;
if ( j - 1 < int( vdPar.size()))
if ( j > 0 && j - 1 < int( vdPar.size()))
vdBtlPar[i] = vdPar[j-1] ;
}
sBtlPar = sPar ;
@@ -455,7 +613,7 @@ RegularizeTriMesh( const ISurfTriMesh* pStm, double dStep)
if ( IsNull( pStmTmp))
return nullptr ;
if ( IsNull( pStmNew))
pStmNew.Set( Release( pStmTmp)) ;
pStmNew.Set( pStmTmp) ;
else
pStmNew->DoSewing( *pStmTmp) ;
// recupero una nuova copia della faccetta originale
@@ -553,11 +711,17 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
m_pGDB->GetInfo( nProcId, IKEY_DO, nDO) ;
m_pGDB->GetInfo( nProcId, IKEY_TRIM, nTrim) ;
if ( nDO != 0 && nTrim != 0 && m_pGDB->GetGeoType( nProcId) == SRF_TRIMESH) {
// recupero eventuale superficie originale
int nProcSurfId = nProcId ;
int nOrigId = 0 ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
nProcSurfId += nOrigId ;
// se da utilizzare anche suerfici ausiliarie
if ( nTrim == 2) {
int nAux ;
if ( m_pGDB->GetInfo( nProcId, IKEY_AUXID, nAux)) {
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId)) ;
const ISurfTriMesh* pAux = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId + nAux)) ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux)) {
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
const ISurfTriMesh* pAux = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId + nAux)) ;
if ( pStmProc != nullptr && pAux != nullptr) {
PtrOwner<ISurfTriMesh> pTrim ;
pTrim.Set( pAux->Clone()) ;
@@ -570,8 +734,9 @@ BeamMgr::CalcSolid( int nPartId, bool bRecalc)
}
}
}
// caso standard
else {
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcId)) ;
const ISurfTriMesh* pStmProc = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
PtrOwner<ISurfTriMesh> pStmTmp( RegularizeTriMesh( pStmProc, dStep)) ;
if ( ! IsNull( pStmTmp))
pStmProc = Get( pStmTmp) ;
@@ -618,6 +783,8 @@ BeamMgr::ShowSolid( int nPartId, bool bShow)
m_pGDB->SetStatus( nOutlLayId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
int nProcsLayId = m_pGDB->GetFirstNameInGroup( nPartId, PROCESSINGS_LAYER_NAME) ;
m_pGDB->SetStatus( nProcsLayId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
int nFcsNameLayId = m_pGDB->GetFirstNameInGroup( nPartId, FCSNAME_LAYER_NAME) ;
m_pGDB->SetStatus( nFcsNameLayId, ( bShow ? GDB_ST_OFF : GDB_ST_ON)) ;
return true ;
}
+4
View File
@@ -31,6 +31,8 @@ class BeamMgr : public IBeamMgr
bool SetPartCount( int nCount) override ;
bool SetPartBox( double dLength, double dHeight, double dWidth, bool bUpdate = true) override ;
bool GetSideData( int nSide, Frame3d& frRef, double& dLength, double& dWidth, double& dHeight) override ;
bool ShowFacesName( bool bShow) override ;
bool ShowLoadingSide( bool bShow, bool bFromLeft) override ;
int AddProcess( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const Frame3d& frRef, const DBLVECTOR& vdPar, const std::string& sPar, const STRVECTOR& vsUAtt,
int nCrvId, int nCrv2Id, bool bUpdate = true) override ;
@@ -49,6 +51,8 @@ class BeamMgr : public IBeamMgr
BeamMgr( void) ;
private :
bool UpdateFacesName( void) ;
bool UpdateLoadingSide( void) ;
private :
IGeomDB* m_pGDB ;
+78 -3
View File
@@ -42,7 +42,7 @@ BtlGeom::BtlGeom( void)
m_BoxCol = Color( 255, 128, 0, 15) ;
m_OutsCol = Color( 224, 128, 0, 50) ;
m_ProcsCol = Color( 80, 160, 160, 100) ;
m_ProcsOffCol = Color( 160, 160, 160, 15) ;
m_ProcsOffCol = Color( 160, 160, 160, 30) ;
m_MarkCol = Color( 96, 192, 192, 100) ;
m_SolidCol = Color(255, 160, 32, 100) ;
m_nInfoId = GDB_ID_NULL ;
@@ -272,7 +272,29 @@ BtlGeom::ErasePart( void)
//----------------------------------------------------------------------------
bool
BtlGeom::SetPartProdNbr( int nProdNbr)
BtlGeom::VerifyNewPartProdNbr( int nProdNbr)
{
// se non c'è il DB geometrico, errore
if ( m_pGDB == nullptr)
return false ;
// ciclo su tutti i pezzi
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
while ( nPartId != GDB_ID_NULL) {
int nLev ;
if ( m_pGDB->GetCalcLevel( nPartId, nLev) && nLev == GDB_LV_USER) {
int nSN = -1 ;
// se SN richiesto già esiste, esco con errore
if ( m_pGDB->GetInfo( nPartId, IKEY_PROD_NBR, nSN) && nSN >= 0 && nProdNbr == nSN)
return false ;
}
nPartId = m_pGDB->GetNextGroup( nPartId) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::SetPartProdNbr( int nProdNbr, int nPdnErr)
{
// se non c'è il DB geometrico o il pezzo corrente, errore
if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL)
@@ -280,7 +302,16 @@ BtlGeom::SetPartProdNbr( int nProdNbr)
// assegno il numero di produzione del pezzo
if ( ! m_pGDB->SetInfo( m_nPartId, IKEY_PROD_NBR, nProdNbr))
return false ;
// se è correzione
if ( nPdnErr >= 0)
m_pGDB->SetInfo( m_nPartId, IKEY_PDN_ERR, nPdnErr) ;
// costruisco il nome del pezzo
string sName = ToString( nProdNbr) ;
if ( nPdnErr >= 0)
sName += "-X" ;
string sDes ;
if ( m_pGDB->GetInfo( m_nPartId, IKEY_NAME, sDes))
sName += "-" + sDes ;
// assegnazione del nome al pezzo
return m_pGDB->SetName( m_nPartId, sName) ;
}
@@ -292,12 +323,17 @@ BtlGeom::SetPartName( const string& sDes)
// se non c'è il DB geometrico o il pezzo corrente, errore
if ( m_pGDB == nullptr || m_nPartId == GDB_ID_NULL)
return false ;
// assegno il nome del pezzo
// assegno la descrizione
if ( ! m_pGDB->SetInfo( m_nPartId, IKEY_NAME, sDes))
return false ;
// costruisco il nome del pezzo
int nPdnErr = -1 ;
m_pGDB->GetInfo( m_nPartId, IKEY_PDN_ERR, nPdnErr) ;
int nProdNbr = 0 ;
m_pGDB->GetInfo( m_nPartId, IKEY_PROD_NBR, nProdNbr) ;
string sName = ToString( nProdNbr) ;
if ( nPdnErr >= 0)
sName += "-X" ;
if ( ! sDes.empty())
sName += "-" + sDes ;
// assegnazione del nome al pezzo
@@ -797,6 +833,45 @@ BtlGeom::SetAlpha( int nId, int nAlpha)
return m_pGDB->SetMaterial( nId, cCol) ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::AdjustSnForParts( void)
{
// tabella Id-SN dei pezzi e massimo SN trovato
INTINTVECTOR vIdSN ;
int nMaxSN = 0 ;
// recupero il numero di serie di ogni singolo pezzo
int nPartId = m_pGDB->GetFirstGroupInGroup( GDB_ID_ROOT) ;
while ( nPartId != GDB_ID_NULL) {
int nLev ;
if ( m_pGDB->GetCalcLevel( nPartId, nLev) && nLev == GDB_LV_USER) {
int nSN = 0 ;
m_pGDB->GetInfo( nPartId, IKEY_PROD_NBR, nSN) ;
if ( nSN <= 0)
nSN = 0 ;
else if ( find_if( vIdSN.begin(), vIdSN.end(),
[&]( const INTINT& Data) { return Data.second == nSN ; }) != vIdSN.end())
nSN = -abs( nSN) ;
vIdSN.emplace_back( nPartId, nSN) ;
nMaxSN = max( nMaxSN, nSN) ;
}
nPartId = m_pGDB->GetNextGroup( nPartId) ;
}
// aggiusto tutti gli SN nulli o negativi (derivano da mancanti o ripetuti)
for ( auto& Data : vIdSN) {
if ( Data.second <= 0) {
SetPart( Data.first) ;
SetPartProdNbr( ++ nMaxSN, -Data.second) ;
AddPartBox( GetCurrPartLength(), GetCurrPartHeight(), GetCurrPartWidth()) ;
Data.second = nMaxSN ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::SortObjects( int nGroupId, Point3d& ptIns)
+10 -7
View File
@@ -36,16 +36,17 @@ class BtlGeom
{ return m_nOutsId ; }
int GetCurrProcsLayId( void)
{ return m_nProcsId ; }
bool SetPartProdNbr( int nProdNbr) ;
bool VerifyNewPartProdNbr( int nProdNbr) ;
bool SetPartProdNbr( int nProdNbr, int nPdnErr = -1) ;
bool SetPartName( const std::string& sDes) ;
bool SetPartCount( int nCount) ;
bool AddPartBox( double dLength, double dHeight, double dWidth) ;
double GetCurrPartLength( void)
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.x : 0) ;}
double GetCurrPartHeight( void)
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.z : 0) ;}
double GetCurrPartWidth( void)
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.y : 0) ;}
double GetCurrPartWidth( void)
{ return ( m_nPartId != GDB_ID_NULL ? m_vtDim.z : 0) ;}
bool AddPartTransformation( const std::string& sUID, const Frame3d& frRef) ;
bool AddObjectRef( const std::string& sUID, const Frame3d& frRef) ;
bool AdjustPartFlatOrVertPos( void) ;
@@ -53,6 +54,7 @@ class BtlGeom
std::string GetPartName( void) ;
bool SetUserAttribute( int nUAttrDest, const std::string& sString) ;
bool SetUserAttribute( int nUAttrDest, const std::string& sKey, const std::string& sVal) ;
bool AdjustSnForParts( void) ;
bool SortObjects( int nGroupId, Point3d& ptIns) ;
bool UpdateNextOrigin( void) ;
int GetRawPartsGroup( bool bCreate = false) ;
@@ -127,6 +129,7 @@ class BtlGeom
ICurve* GetFaceContour( int nSide) ;
bool IsPointOnFaceContour( const Point3d& ptP, int nSide) ;
bool IsPointNearFaceContour( const Point3d& ptP, int nSide) ;
bool IsPointOutFaceContour( const Point3d& ptP, int nSide) ;
bool SetPointOnFaceContour( Point3d& ptP, int nSide) ;
bool TrimRayWithFaceContour( const Point3d& ptP, const Vector3d& vtDir, int nSide, Point3d& ptInt) ;
@@ -141,7 +144,7 @@ class BtlGeom
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddSawCut( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddSlot( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
bool AddSlot( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddFrontSlot( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
@@ -173,7 +176,7 @@ class BtlGeom
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddTenon( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddMortise( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
bool AddMortise( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AddMortiseFront( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
@@ -219,7 +222,7 @@ class BtlGeom
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
ICurveComposite* GetFreeContourCurve( int nProcId, const Frame3d& frRef, bool bOnlyStartOk = false) ;
ISurfTriMesh* CreateOneCurveFreeContour( const ICurveComposite* pCrvCompo) ;
bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnCont) ;
bool AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnOrOutCont) ;
bool VerifyFreeContourCurveSideAng( const ICurveComposite* pCrvCompo) ;
bool GetFreeContourCurveSideAngles( const ICurveComposite* pCrvCompo, DBLVECTOR& vSideAng) ;
bool CreatePolygonInBox( const Point3d& ptP, const Vector3d& vtN, int nSide, Polygon3d& Polyg,
@@ -253,7 +256,7 @@ class BtlGeom
bool GetUserParam( const STRVECTOR& vsUAtt, const std::string& sKey, double& dVal) ;
bool GetWaveLengths( int nWaves, double dLen, DBLVECTOR& vLen) ;
bool GetWaveReductions( int nWaves, double dWidth, DBLVECTOR& vRed) ;
bool InsertEmptySurface( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId,
bool InsertEmptySurface( int nGroup, int nProc, int nSide, const std::string& sDes, int nProcId, const Frame3d& frRef,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt) ;
bool AdjustPointForPlaneNearBoxVertex( Point3d& ptP, const Vector3d& vtN, int nSide) ;
+7
View File
@@ -26,12 +26,15 @@ static const std::string ASSEMBLY_GROUP_NAME = "AsseBase" ;
static const std::string RAWPARTS_GROUP_NAME = "RawParts" ;
// nome gruppo di sistema per compositi
static const std::string COMPOSITES_GROUP_NAME = "Composites" ;
// nome gruppo temporaneo per direzione di carico
static const std::string LOADINGSIDE_GROUP_NAME = "LoadingSide" ;
// nomi layer standard dei pezzi
static const std::string AUX_LAYER_NAME = "Part" ;
static const std::string BOX_LAYER_NAME = "Box" ;
static const std::string OUTLINE_LAYER_NAME = "Outline" ;
static const std::string PROCESSINGS_LAYER_NAME = "Processings" ;
static const std::string SOLID_LAYER_NAME = "Solid" ;
static const std::string FCSNAME_LAYER_NAME = "FcsName" ;
// nomi entità standard dei pezzi
static const std::string AUX_PART_NAME = "Name" ;
static const std::string BOX_BOX_NAME = "Box" ;
@@ -40,11 +43,13 @@ static const std::string OL_APERTURESTM_NAME = "Ape" ;
static const std::string OL_TOPREGION_NAME = "Top" ;
static const std::string OL_BOTTOMREGION_NAME = "Bot" ;
static const std::string OL_SUFFIX_REGION_NAME = "Region" ;
static const std::string OL_SHAPE_NAME = "Shape" ;
static const std::string SOLID_SOLID_NAME = "Solid" ;
// chiavi di informazioni associate alle info varie
static const std::string IKEY_BTL_PATH = "BTL" ;
// chiavi di informazioni associate ai pezzi
static const std::string IKEY_PROD_NBR = "PDN" ;
static const std::string IKEY_PDN_ERR = "PDN_ERR" ;
static const std::string IKEY_NAME = "NAM" ;
static const std::string IKEY_COUNT = "CNT" ;
static const std::string IKEY_LENGTH = "L" ;
@@ -80,6 +85,8 @@ static const std::string IKEY_TRIM = "TRIM" ;
static const std::string IKEY_COL_A = "COL_A" ;
// chiavi di informazioni associate al solido
static const std::string IKEY_VALID = "VALID" ;
// chiavi di informazioni associate al lato di carico
static const std::string IKEY_LSIDE = "LSIDE" ;
// distanza tra pezzi nella disposizione standard lungo Y
const double PART_OFFSET = 300 ;
// costanti di approssimazione per curve
+77 -33
View File
@@ -19,9 +19,11 @@
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgkChainCurves.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkSfrCreate.h"
#include "/EgtDev/Include/EGkStmStandard.h"
#include "/EgtDev/Include/EGkStmFromCurves.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
@@ -494,6 +496,17 @@ BtlGeom::UpdateOutLine( void)
// taglio con tutte le features
TrimOutlineWithProcesses() ;
// se presente Shape, nascondo Outline
int nShapeId = m_pGDB->GetFirstNameInGroup( m_nOutsId, OL_SHAPE_NAME) ;
if ( nShapeId != GDB_ID_NULL) {
int nEntId = m_pGDB->GetFirstInGroup( m_nOutsId) ;
while ( nEntId != GDB_ID_NULL) {
if ( nEntId != nShapeId)
m_pGDB->SetStatus( nEntId, GDB_ST_OFF) ;
nEntId = m_pGDB->GetNext( nEntId) ;
}
}
return true ;
}
@@ -560,12 +573,12 @@ BtlGeom::AddPartCustomOutline( void)
bOk = ( bOk && ! IsNull( pLoop2) && ! IsNull( pMySfr2) && pLoop2->FromPolyLine( vPL[1]) && pMySfr2->AddExtLoop( Release( pLoop2))) ;
bOk = bOk && pMySfr2->Invert() ;
if ( AreSameVectorApprox( pMySfr1->GetNormVersor(), frRef.VersZ())) {
pSfr1.Set( Release( pMySfr1)) ;
pSfr2.Set( Release( pMySfr2)) ;
pSfr1.Set( pMySfr1) ;
pSfr2.Set( pMySfr2) ;
}
else {
pSfr1.Set( Release( pMySfr2)) ;
pSfr2.Set( Release( pMySfr1)) ;
pSfr1.Set( pMySfr2) ;
pSfr2.Set( pMySfr1) ;
}
}
// se non riesce, li calcolo in modo approssimato
@@ -749,13 +762,18 @@ BtlGeom::UseProcessToTrimOutline( int nProcId)
bool
BtlGeom::TrimOutline( int nProcSurfId)
{
// Recupero tipo di trim
int nTrim = 0 ;
m_pGDB->GetInfo( nProcSurfId, IKEY_TRIM, nTrim) ;
// Recupero eventuale superficie originale
int nOrigId = 0 ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
nProcSurfId += nOrigId ;
// Se processo con più superfici da usare insieme per trim, devo unirle
int nTrim ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_TRIM, nTrim) && nTrim == 2) {
// Recupero le due superfici del processo di lavorazione (eventualmente le originali)
int nOrigId = 0 ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
nProcSurfId += nOrigId ;
if ( nTrim == 2) {
// Recupero le due superfici del processo di lavorazione
int nAux ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_AUXID, nAux) && nAux != 0) {
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
@@ -769,10 +787,8 @@ BtlGeom::TrimOutline( int nProcSurfId)
}
return false ;
}
// Recupero la superficie del processo di lavorazione (eventualmente l'originale)
int nOrigId = 0 ;
if ( m_pGDB->GetInfo( nProcSurfId, IKEY_ORIGID, nOrigId))
nProcSurfId += nOrigId ;
// Trim con una sola superficie
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGDB->GetGeoObj( nProcSurfId)) ;
if ( pStm == nullptr)
return false ;
@@ -1130,7 +1146,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
}
// se la regione sottrazione totale non esiste, la assegno
if ( IsNull( pSubReg))
pSubReg.Set( Release( pSfrReg)) ;
pSubReg.Set( pSfrReg) ;
// altrimenti la combino con la nuova
else {
// salvo una copia della regione sottrazione totale
@@ -1141,7 +1157,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
pSubReg->Intersect( *pSfrReg) ;
// se non rimane alcunché, provo a unirle
if ( ! pSubReg->IsValid()) {
pSubReg.Set( Release( pSubCopy)) ;
pSubReg.Set( pSubCopy) ;
pSubReg->Add( *pSfrReg) ;
}
}
@@ -1210,7 +1226,7 @@ bool
BtlGeom::IsPointNearFaceContour( const Point3d& ptP, int nSide)
{
// Il punto è nel riferimento faccia
// Verifico se sta vicino al contorno o fuori
// Verifico se sta vicino al contorno o fuori entro il limite
const double EPS_IN_NEAR = 0.2 ;
const double EPS_OUT_NEAR = 5.0 ;
double dL = GetSideLength( nSide) ;
@@ -1221,6 +1237,16 @@ BtlGeom::IsPointNearFaceContour( const Point3d& ptP, int nSide)
( ptP.y > dW - EPS_IN_NEAR && ptP.y < dW + EPS_OUT_NEAR)) ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::IsPointOutFaceContour( const Point3d& ptP, int nSide)
{
// Il punto è nel riferimento faccia
// Verifico se sta all'esterno del contorno
return ( ptP.x < -EPS_SMALL || ptP.x > GetSideLength( nSide) - EPS_SMALL ||
ptP.y < -EPS_SMALL || ptP.y > GetSideWidth( nSide) - EPS_SMALL) ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::SetPointOnFaceContour( Point3d& ptP, int nSide)
@@ -1344,17 +1370,28 @@ BtlGeom::TrimProcessWithOutline( int nProcId)
m_pGDB->SetInfo( nCopyId, IKEY_AUXID, sAuxId) ;
m_pGDB->SetMode( nCopy2Id, GDB_MD_HIDDEN) ;
}
// eseguo piccolo offset della curva per evitare problemi di sovrapposizioni
OffsetCurve OffsCrv ;
if ( ! OffsCrv.Make( pCrv, -50 * EPS_SMALL, ICurve::OFF_EXTEND) || OffsCrv.GetCurveCount() == 0) {
return false ;
}
PtrOwner<ICurve> pCopyCrv( OffsCrv.GetLongerCurve()) ;
// eseguo il trim
return ( pStm->GeneralizedCut( *pCrv, false) &&
( pStm2 == nullptr || pStm2->GeneralizedCut( *pCrv, false))) ;
return ( pStm->GeneralizedCut( *pCopyCrv, false) &&
( pStm2 == nullptr || pStm2->GeneralizedCut( *pCopyCrv, false))) ;
}
//----------------------------------------------------------------------------
bool
BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints)
{
PtrOwner<ISurfTriMesh> pShape( CreateSurfTriMesh()) ;
StmFromTriangleSoup StmFts ;
if ( ! StmFts.Start()) {
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: StmFts.Start error")
return false ;
}
for ( auto it = vFacesVertices.begin() ; it != vFacesVertices.end() ; it++) {
INTVECTOR vVertices = *it ;
if ( vVertices.size() < 3) {
@@ -1368,26 +1405,33 @@ BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints
pCurveCompo->AddLine( vPoints[vVertices[i]]) ;
pCurveCompo->AddLine( vPoints[vVertices[0]]) ;
if ( it == vFacesVertices.begin() || ! pShape->IsValid())
pShape.Set( GetSurfTriMeshByFlatContour( pCurveCompo)) ;
else {
PtrOwner<ISurfTriMesh> pSurf( GetSurfTriMeshByFlatContour( pCurveCompo)) ;
// controllo che pCurveCompo racchiuda veramente una superficie
if ( ! IsNull( pSurf)) {
if ( ! pShape->DoSewing( * pSurf)) {
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: stm.DoSewing error")
return false ;
}
PtrOwner<ISurfTriMesh> pSurf( GetSurfTriMeshByFlatContour( pCurveCompo)) ;
if ( ! IsNull( pSurf)) {
// recupero tutti i triangoli
Triangle3d Tria ;
int nT = pSurf->GetFirstTriangle( Tria) ;
while ( nT != SVT_NULL) {
// inserisco il triangolo nella nuova superficie
StmFts.AddTriangle( Tria) ;
// passo al triangolo successivo
nT = pSurf->GetNextTriangle( nT, Tria) ;
}
}
}
if ( ! StmFts.End()) {
LOG_ERROR( GetEExLogger(), " Error reading Part Shape: StmFts.End error")
return false ;
}
PtrOwner<ISurfTriMesh> pShape( StmFts.GetSurf()) ;
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nPartId + 3, Release( pShape)) ; // salvo in outline
if ( nId == GDB_ID_NULL)
return false ;
m_pGDB->SetName( nId, "Shape") ;
m_pGDB->SetName( nId, OL_SHAPE_NAME) ;
m_pGDB->SetMaterial( nId, m_OutsCol) ;
m_pGDB->SetStatus( nId, 0) ;
m_pGDB->SetStatus( nId, GDB_ST_ON) ;
return true ;
}
+229 -126
View File
@@ -106,6 +106,7 @@ const double LEN_EXTRUS_AGG = 50. ;
const double BULGE_90D = tan( 90.0 / 4 * DEGTORAD) ;
const double PEN_DEPTH = 5.0 ;
const double NAILING_DEPTH = 10.0 ;
const double LOCKOUT_DEPTH = 0.1 ;
//----------------------------------------------------------------------------
bool
@@ -458,7 +459,7 @@ BtlGeom::GetProcessParamInfos( int nGroup, int nProc, int nSide,
vnDPar.emplace_back( 1) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 2) ; vdPar.emplace_back( 0.5 * GetSideWidth( nSide)) ;
vnDPar.emplace_back( 4) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 5) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( -5) ; vdPar.emplace_back( 0) ;
vnDPar.emplace_back( 6) ; vdPar.emplace_back( 90) ;
vnDPar.emplace_back( 7) ; vdPar.emplace_back( 90) ;
vnDPar.emplace_back( 8) ; vdPar.emplace_back( 90) ;
@@ -836,7 +837,7 @@ BtlGeom::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int n
return AddSawCut( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
// se scanalatura
if ( IS_SLOT( nGroup, nProc))
return AddSlot( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
return AddSlot( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, vdPar, vsUAtt) ;
// se scanalatura frontale
if ( IS_FRONT_SLOT( nGroup, nProc))
return AddFrontSlot( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
@@ -884,7 +885,7 @@ BtlGeom::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int n
return AddTenon( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
// se mortasa
if ( IS_MORTISE( nGroup, nProc))
return AddMortise( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
return AddMortise( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, vdPar, vsUAtt) ;
// se mortasa sul fronte
if ( IS_MORTISE_FRONT( nGroup, nProc))
return AddMortiseFront( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
@@ -895,7 +896,7 @@ BtlGeom::AddProcess( int nGroup, int nProc, int nSide, const string& sDes, int n
}
// se avanzamento mortasa
if ( IS_HOUSE_MORTISE( nGroup, nProc))
return AddMortise( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
return AddMortise( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, vdPar, vsUAtt) ;
// se tenone a coda di rondine
if ( IS_DOVETAIL_TENON( nGroup, nProc))
return AddDovetailTenon( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
@@ -985,7 +986,7 @@ BtlGeom::AddCut( int nGroup, int nProc, int nSide, const string& sDes, int nProc
return false ;
if ( plyCut.GetSideCount() < 3) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -1079,7 +1080,7 @@ BtlGeom::AddLongitCut( int nGroup, int nProc, int nSide, const string& sDes, int
return false ;
if ( plyCut.GetSideCount() < 3) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -1169,7 +1170,7 @@ BtlGeom::AddDoubleCut( int nGroup, int nProc, int nSide, const string& sDes, int
return false ;
if ( plyCut1.GetSideCount() < 3 && plyCut2.GetSideCount() < 3) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -1256,7 +1257,7 @@ BtlGeom::AddRidgeValleyCut( int nGroup, int nProc, int nSide, const string& sDes
return false ;
if ( plyCut1.GetSideCount() < 3 && plyCut2.GetSideCount() < 3) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -1411,7 +1412,7 @@ BtlGeom::AddSawCut( int nGroup, int nProc, int nSide, const string& sDes, int nP
// controllo poligono
if ( plyCut.GetSideCount() < 3) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -1455,7 +1456,7 @@ BtlGeom::AddSawCut( int nGroup, int nProc, int nSide, const string& sDes, int nP
//----------------------------------------------------------------------------
bool
BtlGeom::AddSlot( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
BtlGeom::AddSlot( int nGroup, int nProc, int nSide, const string& sDes, int nProcId, const Frame3d& frRef,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt)
{
// verifica dei parametri
@@ -1501,6 +1502,9 @@ BtlGeom::AddSlot( int nGroup, int nProc, int nSide, const string& sDes, int nPro
Vector3d vtEo = vtN1 ^ vtNf ;
vtEo.Normalize() ;
double dCoeff = vtEv.z ;
// costruzione vettore longitudinale faccia di fondo
Vector3d vtEl = vtNf ^ vtEo ;
vtEl.Normalize() ;
// se caso frontale
if ( abs( ptP.z) > EPS_SMALL) {
double dRotAng = ( nGroup == 4 ? - ANG_RIGHT : ANG_RIGHT) ;
@@ -1511,6 +1515,19 @@ BtlGeom::AddSlot( int nGroup, int nProc, int nSide, const string& sDes, int nPro
vtNf.Rotate( Y_AX, dRotAng) ;
vtEv.Rotate( Y_AX, dRotAng) ;
vtEo.Rotate( Y_AX, dRotAng) ;
vtEl.Rotate( Y_AX, dRotAng) ;
}
// gestione riferimento
if ( ! IsGlobFrame( frRef)) {
ptP.ToGlob( frRef) ;
vtN1.ToGlob( frRef) ;
vtN2.ToGlob( frRef) ;
vtN3.ToGlob( frRef) ;
vtN4.ToGlob( frRef) ;
vtNf.ToGlob( frRef) ;
vtEv.ToGlob( frRef) ;
vtEo.ToGlob( frRef) ;
vtEl.ToGlob( frRef) ;
}
// calcolo del punto sul fondo
Point3d ptB = ptP - vtEv * ( dDepth / dCoeff) ;
@@ -1525,7 +1542,7 @@ BtlGeom::AddSlot( int nGroup, int nProc, int nSide, const string& sDes, int nPro
if ( ! CreatePolygonInBox( ptB + vtEo * dThick / 2, vtN2, nSide, plyFace2))
return false ;
Polygon3d plyFace3 ;
if ( ! CreatePolygonInBox( ptB + vtN1 * dLength, vtN3, nSide, plyFace3))
if ( ! CreatePolygonInBox( ptB + vtEl * ( dLength / ( vtN1 * vtEl)), vtN3, nSide, plyFace3))
return false ;
Polygon3d plyFace4 ;
if ( ! CreatePolygonInBox( ptB - vtEo * dThick / 2, vtN4, nSide, plyFace4))
@@ -1548,6 +1565,9 @@ BtlGeom::AddSlot( int nGroup, int nProc, int nSide, const string& sDes, int nPro
return false ;
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// riferimento
if ( ! IsGlobFrame( frRef))
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
// parametri
SetParams( nId, vnDPar, vdPar, vsUAtt) ;
@@ -1629,7 +1649,7 @@ BtlGeom::AddFrontSlot( int nGroup, int nProc, int nSide, const string& sDes, int
// verifico che la superficie di taglio sia da conservare
bool bSave = false ;
POLYLINEVECTOR vPL ;
if ( pCut->GetFacetLoops( 0, vPL) && ! vPL.empty()) {
if ( ! IsNull( pCut) && pCut->GetFacetLoops( 0, vPL) && ! vPL.empty()) {
if ( vPL.size() >= 1)
vPL[0].RemoveAlignedPoints( 100 * EPS_SMALL) ;
bSave = ( vPL.size() > 1 || vPL[0].GetLineNbr() > 6) ;
@@ -2433,7 +2453,7 @@ BtlGeom::AddLogHouseHL2( int nGroup, int nProc, int nSide, const string& sDes, i
// se non è stata inserita alcuna geometria
if ( nGeom1Id == GDB_ID_NULL && nGeom2Id == GDB_ID_NULL) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -2759,7 +2779,7 @@ BtlGeom::AddChamfer( int nGroup, int nProc, int nSide, const string& sDes, int n
// se non è stata inserita alcuna geometria
if ( vIds.empty()) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -3064,7 +3084,7 @@ BtlGeom::AddLogHouseHL4( int nGroup, int nProc, int nSide, const string& sDes, i
// se non è stata inserita alcuna geometria
if ( vIds.empty()) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -3235,35 +3255,35 @@ BtlGeom::AddPocket( int nGroup, int nProc, int nSide, const string& sDes, int nP
double dLen = Clamp( vdPar[8], 0., 50000.) ; // P12
double dWidth = Clamp( vdPar[9], 0., 50000.) ; // P13
// riferimento rototraslato
Frame3d frMyRef = frRef ;
frMyRef.Translate( ptP - ORIG) ;
Frame3d frMyRef( ptP) ;
frMyRef.Rotate( frMyRef.Orig(), frMyRef.VersZ(), dAngle) ;
frMyRef.Rotate( frMyRef.Orig(), frMyRef.VersY(), dIncl) ;
frMyRef.Rotate( frMyRef.Orig(), frMyRef.VersX(), dSlope) ;
frMyRef.ToGlob( frRef) ;
ptP = frMyRef.Orig() ;
// creo il poligono della faccia di fondo
Vector3d vtN1 = frMyRef.VersZ() ;
Polygon3d plyFace1 ;
if ( ! CreatePolygonInBox( ptP, vtN1, nSide, plyFace1))
if ( ( nFlag & 16) == 0 && ! CreatePolygonInBox( ptP, vtN1, nSide, plyFace1))
return false ;
// creo il poligono della faccia sinistra
Vector3d vtN2 = frMyRef.VersX() ;
vtN2.Rotate( frMyRef.VersZ(), dIntAng - 90) ;
Polygon3d plyFace2 ;
if ( ! CreatePolygonInBox( ptP, vtN2, nSide, plyFace2))
if ( ( nFlag & 1) == 0 && ! CreatePolygonInBox( ptP, vtN2, nSide, plyFace2))
return false ;
// creo il poligono della faccia destra
Polygon3d plyFace4 ;
if ( ! CreatePolygonInBox( ptP + vtN2 * dLen, - vtN2, nSide, plyFace4))
if ( ( nFlag & 2) == 0 && ! CreatePolygonInBox( ptP + vtN2 * dLen, - vtN2, nSide, plyFace4))
return false ;
// creo il poligono della faccia davanti
Vector3d vtN3 = frMyRef.VersY() ;
Polygon3d plyFace3 ;
if ( ! CreatePolygonInBox( ptP, vtN3, nSide, plyFace3))
if ( ( nFlag & 4) == 0 && ! CreatePolygonInBox( ptP, vtN3, nSide, plyFace3))
return false ;
// creo il poligono della faccia dietro
Polygon3d plyFace5 ;
if ( ! CreatePolygonInBox( ptP + vtN3 * dWidth, - vtN3, nSide, plyFace5))
if ( ( nFlag & 8) == 0 && ! CreatePolygonInBox( ptP + vtN3 * dWidth, - vtN3, nSide, plyFace5))
return false ;
// verifico tra loro le facce
if ( ! VerifyPolygonWithPolygons( plyFace1, plyFace2, plyFace3, plyFace4, plyFace5, false))
@@ -3303,7 +3323,8 @@ BtlGeom::AddPocket( int nGroup, int nProc, int nSide, const string& sDes, int nP
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// riferimento
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
if ( ! IsGlobFrame( frRef))
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
// parametri
SetParams( nId, vnDPar, vdPar, vsUAtt) ;
@@ -3330,7 +3351,7 @@ BtlGeom::AddDrill( int nGroup, int nProc, int nSide, const string& sDes, int nPr
// verifica del raggio
if ( dRad < 0.5) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -3367,7 +3388,7 @@ BtlGeom::AddDrill( int nGroup, int nProc, int nSide, const string& sDes, int nPr
// limito i punti, tenendo conto del raggio
if ( ! TrimSegmentWithBox( ptStart, ptEnd, dRad)) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -3378,7 +3399,7 @@ BtlGeom::AddDrill( int nGroup, int nProc, int nSide, const string& sDes, int nPr
dDepth = ( ptStart - ptEnd) * vtN ;
if ( dDepth < 0.5) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -3396,36 +3417,42 @@ BtlGeom::AddDrill( int nGroup, int nProc, int nSide, const string& sDes, int nPr
pArc->SetThickness( - dDepth) ;
// verifico se inizio su faccia (o fuori)
int nStartFace = 0 ;
double dSinStart = 0 ;
double dTanStart = 0 ;
double dMaxCosStart = COS_ALMOST_PERP ;
for ( int i = BTL_SIDE_FRONT ; i <= BTL_SIDE_RIGHT ; ++ i) {
Plane3d plSide = GetSidePlane( i) ;
if ( DistPointPlane( ptStart, plSide) > - TOL_OPEN_DRILL && vtN * plSide.GetVersN() > COS_ALMOST_PERP) {
double dCosStart = vtN * plSide.GetVersN() ;
if ( DistPointPlane( ptStart, plSide) > - TOL_OPEN_DRILL && dCosStart > dMaxCosStart) {
nStartFace = i ;
dSinStart = sqrt( max( 0., 1 - vtN * plSide.GetVersN())) ;
break ;
double dSinStart = sqrt( max( 0., 1 - dCosStart * dCosStart)) ;
dTanStart = dSinStart / dCosStart ;
dMaxCosStart = dCosStart ;
}
}
if ( ptStart.x > GetSideLength( nSide) - TOL_DRILL_H_T && vtN * X_AX > COS_ALMOST_PERP)
nStartFace = BTL_SIDE_RIGHT ;
else if ( ptStart.x < TOL_DRILL_H_T && vtN * -X_AX > COS_ALMOST_PERP)
nStartFace = BTL_SIDE_LEFT ;
double dStartAgg = (( nStartFace == 0 || dSinStart < EPS_SMALL) ? 0 : dRad * dSinStart + LEN_EXTRUS_AGG) ;
double dStartAgg = (( nStartFace == 0 || dTanStart < EPS_SMALL) ? 0 : dRad * dTanStart + LEN_EXTRUS_AGG) ;
// verifico se fine su faccia (o fuori)
int nEndFace = 0 ;
double dSinEnd = 0 ;
double dTanEnd = 0 ;
double dMaxCosEnd = COS_ALMOST_PERP ;
for ( int i = BTL_SIDE_FRONT ; i <= BTL_SIDE_RIGHT ; ++ i) {
Plane3d plSide = GetSidePlane( i) ;
if ( DistPointPlane( ptEnd, plSide) > - TOL_OPEN_DRILL && - vtN * plSide.GetVersN() > COS_ALMOST_PERP) {
double dCosEnd = -vtN * plSide.GetVersN() ;
if ( DistPointPlane( ptEnd, plSide) > - TOL_OPEN_DRILL && dCosEnd > dMaxCosEnd) {
nEndFace = i ;
dSinEnd = sqrt( max( 0., 1 + vtN * plSide.GetVersN())) ;
break ;
double dSinEnd = sqrt( max( 0., 1 - dCosEnd * dCosEnd)) ;
dTanEnd = dSinEnd / dCosEnd ;
dMaxCosEnd = dCosEnd ;
}
}
if ( ptEnd.x > GetSideLength( nSide) - TOL_DRILL_H_T && vtN * X_AX > COS_ALMOST_PERP)
if ( ptEnd.x > GetSideLength( nSide) - TOL_DRILL_H_T && vtN * -X_AX > COS_ALMOST_PERP)
nEndFace = BTL_SIDE_RIGHT ;
else if ( ptEnd.x < TOL_DRILL_H_T && vtN * -X_AX > COS_ALMOST_PERP)
else if ( ptEnd.x < TOL_DRILL_H_T && vtN * X_AX > COS_ALMOST_PERP)
nEndFace = BTL_SIDE_LEFT ;
double dEndAgg = (( nEndFace == 0 || dSinEnd < EPS_SMALL) ? 0 : dRad * dSinEnd + LEN_EXTRUS_AGG) ;
double dEndAgg = (( nEndFace == 0 || dTanEnd < EPS_SMALL) ? 0 : dRad * dTanEnd + LEN_EXTRUS_AGG) ;
// approssimo la circonferenza con una spezzata
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
PolyLine PL ;
@@ -3460,7 +3487,8 @@ BtlGeom::AddDrill( int nGroup, int nProc, int nSide, const string& sDes, int nPr
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// riferimento
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
if ( ! IsGlobFrame( frRef))
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
// parametri
SetParams( nId, vnDPar, vdPar, vsUAtt) ;
// identificativi di geometrie ausiliarie
@@ -3491,8 +3519,8 @@ BtlGeom::AddTenon( int nGroup, int nProc, int nSide, const string& sDes, int nPr
double dFillet = vdPar[7] ; // P10
double dTenH = vdPar[8] ; // P11
double dTenW = vdPar[9] ; // P12
double dTenM1 = ( abs( vdPar[10]) < 100 * EPS_SMALL ? 100 * EPS_SMALL : vdPar[10]) ; // P14
double dTenM2 = ( abs( vdPar[11]) < 100 * EPS_SMALL ? 100 * EPS_SMALL : vdPar[11]) ; // P15
double dTenM1 = ( abs( vdPar[10]) < 100 * EPS_SMALL ? 0 : vdPar[10]) ; // P14
double dTenM2 = ( abs( vdPar[11]) < 100 * EPS_SMALL ? 0 : vdPar[11]) ; // P15
// eventuale lettura parametri Q e conseguente correzione dati
if ( m_bUseUAttr) {
double dQ02 ;
@@ -3517,7 +3545,7 @@ BtlGeom::AddTenon( int nGroup, int nProc, int nSide, const string& sDes, int nPr
return false ;
if ( plyCut.GetSideCount() < 3 || dTenH < EPS_SMALL || dTenW < EPS_SMALL) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -3535,7 +3563,7 @@ BtlGeom::AddTenon( int nGroup, int nProc, int nSide, const string& sDes, int nPr
double dTenL = dThick / dCosA - dTenM1 - dTenM2 ;
if ( dTenL > m_vtDim.x + m_vtDim.y + m_vtDim.z) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Wrong Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -3603,9 +3631,12 @@ BtlGeom::AddTenon( int nGroup, int nProc, int nSide, const string& sDes, int nPr
if ( ! pReg->Subtract( *pTen))
return false ;
// ne deduco la superficie trimesh
PtrOwner<ISurfTriMesh> pStm( pReg->GetAuxSurf()->Clone()) ;
if ( IsNull( pStm))
return false ;
PtrOwner<ISurfTriMesh> pStm ;
if ( pReg->GetAuxSurf() != nullptr) {
pStm.Set( pReg->GetAuxSurf()->Clone()) ;
if ( IsNull( pStm))
return false ;
}
// se non è House, creo la superficie trimesh di testa del tenone
PtrOwner<ISurfTriMesh> pStmCap( CreateSurfTriMesh()) ;
if ( IsNull( pStmCap) || ( ! bHouse && ! pStmCap->CreateByPointCurve( ptCen, PL)))
@@ -3619,7 +3650,10 @@ BtlGeom::AddTenon( int nGroup, int nProc, int nSide, const string& sDes, int nPr
TrimSurfTmWithBox( pStmCap) ;
TrimSurfTmWithBox( pStmTen) ;
// unisco le facce secondo l'ordine : base, sopra, altre
pStm->DoSewing( *pStmCap) ;
if ( IsNull( pStm))
pStm.Set( pStmCap) ;
else
pStm->DoSewing( *pStmCap) ;
pStm->DoSewing( *pStmTen) ;
pStm->DoCompacting( STM_COMPACT_APPROX) ;
// inserisco la superficie trimesh nel DB geometrico
@@ -3645,7 +3679,7 @@ BtlGeom::AddTenon( int nGroup, int nProc, int nSide, const string& sDes, int nPr
//----------------------------------------------------------------------------
bool
BtlGeom::AddMortise( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
BtlGeom::AddMortise( int nGroup, int nProc, int nSide, const string& sDes, int nProcId, const Frame3d& frRef,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt)
{
// verifica dei parametri
@@ -3683,6 +3717,7 @@ BtlGeom::AddMortise( int nGroup, int nProc, int nSide, const string& sDes, int n
// calcolo riferimento della faccia di fondo
Frame3d frMort ;
frMort.Set( ptP - dMortD * vtN3, vtN3, vtN2) ;
frMort.ToGlob( frRef) ;
frMort.ToGlob( GetSideFrame( nSide)) ;
// calcolo il centro della mortasa
Point3d ptCen( 0, - dMortM1 - 0.5 * dMortL, 0) ;
@@ -3747,7 +3782,7 @@ BtlGeom::AddMortise( int nGroup, int nProc, int nSide, const string& sDes, int n
// se superficie risultante vuota
if ( pStm->GetTriangleCount() == 0) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -3759,13 +3794,16 @@ BtlGeom::AddMortise( int nGroup, int nProc, int nSide, const string& sDes, int n
if ( nId == GDB_ID_NULL)
return false ;
// eseguo trim della curva con le facce della trave
TrimFlatCurveWithBox( pCrvMort) ;
PtrOwner<ICurve> pNewCrvMort( TrimFlatCurveWithBoxEx( pCrvMort->Clone(), 0)) ;
// inserisco la curva nel DB geometrico
int nMId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pCrvMort)) ;
int nMId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, ( IsNull( pNewCrvMort) ? Release( pCrvMort) : Release( pNewCrvMort))) ;
if ( nMId == GDB_ID_NULL)
return false ;
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// riferimento
if ( ! IsGlobFrame( frRef))
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
// parametri
SetParams( nId, vnDPar, vdPar, vsUAtt) ;
// identificativi di geometrie ausiliarie
@@ -3792,8 +3830,8 @@ BtlGeom::AddMortiseFront( int nGroup, int nProc, int nSide, const string& sDes,
double dFillet = vdPar[6] ;
double dMortD = vdPar[7] ;
double dMortW = vdPar[8] ;
double dMortM1 = ( abs( vdPar[9]) < 10 * EPS_SMALL ? 10 * EPS_SMALL : vdPar[9]) ;
double dMortM2 = ( abs( vdPar[10]) < 10 * EPS_SMALL ? 10 * EPS_SMALL : vdPar[10]) ;
double dMortM1 = ( abs( vdPar[9]) < 10 * EPS_SMALL ? 0.0 : vdPar[9]) ;
double dMortM2 = ( abs( vdPar[10]) < 10 * EPS_SMALL ? 0.0 : vdPar[10]) ;
// calcolo la normale alla faccia del taglio
Vector3d vtN = FromSpherical( 1, 180 + dInclination, dAngle - 90) ;
if ( nGroup == 3)
@@ -3873,9 +3911,11 @@ BtlGeom::AddMortiseFront( int nGroup, int nProc, int nSide, const string& sDes,
if ( ! pReg->Subtract( *pMrt))
return false ;
// ne deduco la superficie trimesh
pStmCut.Set( pReg->GetAuxSurf()->Clone()) ;
if ( IsNull( pStmCut))
return false ;
if ( pReg->GetAuxSurf() != nullptr) {
pStmCut.Set( pReg->GetAuxSurf()->Clone()) ;
if ( IsNull( pStmCut))
return false ;
}
}
// creo la superficie trimesh di fondo della mortasa
PtrOwner<ISurfTriMesh> pStmCap( CreateSurfTriMesh()) ;
@@ -3891,13 +3931,14 @@ BtlGeom::AddMortiseFront( int nGroup, int nProc, int nSide, const string& sDes,
TrimSurfTmWithBox( pStmMrt) ;
// unisco le facce secondo l'ordine : fondo, taglio, altre
PtrOwner<ISurfTriMesh> pStm( Release( pStmCap)) ;
pStm->DoSewing( *pStmCut) ;
if ( ! IsNull( pStmCut))
pStm->DoSewing( *pStmCut) ;
pStm->DoSewing( *pStmMrt) ;
pStm->DoCompacting( STM_COMPACT_APPROX) ;
// se superficie risultante vuota
if ( pStm->GetTriangleCount() == 0) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -3910,9 +3951,9 @@ BtlGeom::AddMortiseFront( int nGroup, int nProc, int nSide, const string& sDes,
return false ;
// eseguo trim della curva con le facce della trave
pCrvTen->Translate( - frMort.VersZ() * dMortD) ;
TrimFlatCurveWithBox( pCrvTen) ;
PtrOwner<ICurve> pNewCrvTen( TrimFlatCurveWithBoxEx( pCrvTen->Clone(), 0)) ;
// inserisco la curva nel DB geometrico
int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pCrvTen)) ;
int nTId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, ( IsNull( pNewCrvTen) ? Release( pCrvTen) : Release( pNewCrvTen))) ;
if ( nTId == GDB_ID_NULL)
return false ;
// nome e info con tipo
@@ -3977,7 +4018,7 @@ BtlGeom::AddDovetailTenon( int nGroup, int nProc, int nSide, const string& sDes,
return false ;
if ( plyCut.GetSideCount() == 0 || dTenH < EPS_SMALL) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -3995,7 +4036,7 @@ BtlGeom::AddDovetailTenon( int nGroup, int nProc, int nSide, const string& sDes,
double dTenL = dThick / dCosA - dTenM1 - dTenM2 ;
if ( dTenL > m_vtDim.x + m_vtDim.y + m_vtDim.z) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Wrong Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -4073,9 +4114,12 @@ BtlGeom::AddDovetailTenon( int nGroup, int nProc, int nSide, const string& sDes,
if ( ! pReg->Subtract( *pTen))
return false ;
// ne deduco la superficie trimesh
PtrOwner<ISurfTriMesh> pStm( pReg->GetAuxSurf()->Clone()) ;
if ( IsNull( pStm))
return false ;
PtrOwner<ISurfTriMesh> pStm ;
if ( pReg->GetAuxSurf() != nullptr) {
pStm.Set( pReg->GetAuxSurf()->Clone()) ;
if ( IsNull( pStm))
return false ;
}
// Creo la superficie trimesh del tenone
PtrOwner<ISurfTriMesh> pStmTen( CreateSurfTriMesh()) ;
if ( IsNull( pStmTen) || ! pStmTen->CreateByTwoCurves( PL1, PL2, ISurfTriMesh::RLT_ISOPAR))
@@ -4105,7 +4149,10 @@ BtlGeom::AddDovetailTenon( int nGroup, int nProc, int nSide, const string& sDes,
TrimSurfTmWithBox( pStmTen) ;
TrimSurfTmWithBox( pStmTen2) ;
// Unisco le superfici nell'ordine opportuno
pStm->DoSewing( *pStmCap) ;
if ( IsNull( pStm))
pStm.Set( pStmCap) ;
else
pStm->DoSewing( *pStmCap) ;
pStm->DoSewing( *pStmTen) ;
pStm->DoSewing( *pStmTen2) ;
pStm->DoCompacting( STM_COMPACT_APPROX) ;
@@ -4163,7 +4210,7 @@ BtlGeom::AddDovetailMortise( int nGroup, int nProc, int nSide, const string& sDe
double dMortM2 = vdPar[13] ; // P15
if ( nFlag == 1)
dMortM2 = - dDtMillDefRad - DTMORT_EXTRA_LEN ;
double dMortL = Clamp( vdPar[11] / sin( dStrutAng * DEGTORAD) - dMortM1 - dMortM2, 1., 99999.) ;
double dMortL = Clamp( vdPar[11] / sin( dStrutAng * DEGTORAD) - dMortM1 - dMortM2, 1., 99999.) ; // P13
// punto di riferimento
Point3d ptP( dStartX, dStartY, dStartZ) ;
ptP.ToGlob( frRef) ;
@@ -4173,7 +4220,7 @@ BtlGeom::AddDovetailMortise( int nGroup, int nProc, int nSide, const string& sDe
frMort.ChangeOrig( ptP) ;
frMort.ToGlob( GetSideFrame( nSide)) ;
// calcolo il centro del fondo della mortasa
Point3d ptCen( 0, - dMortM1 - 0.5 * dMortL, - dMortD) ;
Point3d ptCen( 0, -dMortM1 - 0.5 * dMortL, - dMortD) ;
ptCen.ToGlob( frMort) ;
// calcolo offset tra sotto e sopra
double dOffs = dMortD * tan( DOVETAIL_DEF_ANG * DEGTORAD) ;
@@ -4181,18 +4228,18 @@ BtlGeom::AddDovetailMortise( int nGroup, int nProc, int nSide, const string& sDe
double dMortHW = 0.5 * dMortW ;
PolyArc PB ;
double dX0 = 0 ;
double dY0 = - dMortM1 - dMortL ;
double dY0 = -dMortM1 - dMortL ;
PB.AddUPoint( 0, Point3d( dX0, dY0, 0), 0) ;
double dX1 = dMortHW ;
double dY1 = dY0 ;
double dY1 = dY0 ;
PB.AddUPoint( 1, Point3d( dX1, dY1, 0), 0) ;
double dX2 = dX1 + dFillet * cos( dMortA * DEGTORAD) ;
double dY2 = dY1 + dFillet * ( 1 - sin( dMortA * DEGTORAD)) ;
double dBulge2 = tan( ( ANG_RIGHT - dMortA) / 4 * DEGTORAD) ;
PB.ModifyLastBulge( dBulge2) ;
PB.AddUPoint( 2, Point3d( dX2, dY2, 0), 0) ;
double dX3 = dX2 + ( - dMortM1 - dY2) * sin( dMortA * DEGTORAD) ;
double dY3 = - dMortM1 ;
double dX3 = dX2 + ( -dMortM1 - dY2) * sin( dMortA * DEGTORAD) ;
double dY3 = -dMortM1 ;
PB.AddUPoint( 3, Point3d( dX3, dY3, 0), 0) ;
double dX4, dY4 ;
double dExtraLen ;
@@ -4217,6 +4264,15 @@ BtlGeom::AddDovetailMortise( int nGroup, int nProc, int nSide, const string& sDe
if ( IsNull( pCrvTop) || ! pCrvTop->FromPolyArc( PA))
return false ;
pCrvTop->SetExtrusion( Z_AX) ;
// se senza tasca, allungamento per arrivare sicuramente al bordo
if ( nPock == 0) {
double dAddLenMax = max( abs( GetSideLength( nSide) - dStartX), abs( dStartX)) ;
double dAddLen = dAddLenMax ;
if ( abs( dAngle) > EPS_ANG_SMALL && abs( dAngle) < 180 - EPS_ANG_SMALL)
dAddLen = min( dAddLenMax, GetSideWidth( nSide) / sin( abs( dAngle) * DEGTORAD)) ;
pCrvTop->ExtendStartByLen( dAddLen) ;
pCrvTop->ExtendEndByLen( dAddLen) ;
}
// Creo il contorno basso della mortasa
PtrOwner<ICurveComposite> pCrvMort( pCrvTop->Clone()) ;
if ( IsNull( pCrvMort))
@@ -4305,7 +4361,7 @@ BtlGeom::AddDovetailMortise( int nGroup, int nProc, int nSide, const string& sDe
// se superficie risultante vuota
if ( pStm->GetTriangleCount() == 0) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -4343,7 +4399,8 @@ BtlGeom::AddDovetailMortise( int nGroup, int nProc, int nSide, const string& sDe
// nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// riferimento
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
if ( ! IsGlobFrame( frRef))
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
// parametri
DBLVECTOR vdMyPar = vdPar ;
vdMyPar[4] = nPock ;
@@ -4410,7 +4467,7 @@ BtlGeom::AddDtMortiseFront( int nGroup, int nProc, int nSide, const string& sDes
double dMortL = dThick / dCosA - dMortM1 - dMortM2 ;
if ( dMortL < 10 * EPS_SMALL) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -4523,7 +4580,7 @@ BtlGeom::AddDtMortiseFront( int nGroup, int nProc, int nSide, const string& sDes
PtrOwner<ICurveComposite> pExt( CreateCurveComposite()) ;
if ( IsNull( pExt) || ! pExt->FromPolyLine( plyCut.GetPolyLine())) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -4545,9 +4602,12 @@ BtlGeom::AddDtMortiseFront( int nGroup, int nProc, int nSide, const string& sDes
if ( ! pReg->Subtract( *pMort))
return false ;
// Ne deduco la superficie trimesh
PtrOwner<ISurfTriMesh> pStmCut( pReg->GetAuxSurf()->Clone()) ;
if ( IsNull( pStmCut))
return false ;
PtrOwner<ISurfTriMesh> pStmCut ;
if ( pReg->GetAuxSurf()) {
pStmCut.Set( pReg->GetAuxSurf()->Clone()) ;
if ( IsNull( pStmCut))
return false ;
}
// Creo la superficie trimesh della mortasa
PtrOwner<ISurfTriMesh> pStmTen( CreateSurfTriMesh()) ;
if ( IsNull( pStmTen) || ! pStmTen->CreateByTwoCurves( PL2, PL1, ( nPock == 0 ? ISurfTriMesh::RLT_ISOPAR : ISurfTriMesh::RLT_MINDIST)))
@@ -4579,14 +4639,15 @@ BtlGeom::AddDtMortiseFront( int nGroup, int nProc, int nSide, const string& sDes
TrimSurfTmWithBox( pStmCap) ;
// unisco le facce secondo l'ordine : fondo, taglio, altre
PtrOwner<ISurfTriMesh> pStm( Release( pStmCap)) ;
pStm->DoSewing( *pStmCut) ;
if ( ! IsNull( pStmCut))
pStm->DoSewing( *pStmCut) ;
pStm->DoSewing( *pStmTen) ;
pStm->DoSewing( *pStmMrt) ;
pStm->DoCompacting( STM_COMPACT_APPROX) ;
// se superficie risultante vuota
if ( pStm->GetTriangleCount() == 0) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -4912,7 +4973,7 @@ BtlGeom::AddMarking( int nGroup, int nProc, int nSide, const string& sDes, int n
// altrimenti emetto segnalazione
else {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
nMainId = m_nProcId ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
@@ -4935,7 +4996,7 @@ BtlGeom::AddText( int nGroup, int nProc, int nSide, const string& sDes, int nPro
// se stringa vuota o solo spazi, creo feature vuota
if ( IsEmptyOrSpaces( sPar)) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -5077,7 +5138,7 @@ BtlGeom::AddSimpleScarf( int nGroup, int nProc, int nSide, const string& sDes, i
// se non è stata inserita alcuna geometria
if ( pStm->GetTriangleCount() == 0) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -5752,7 +5813,7 @@ BtlGeom::AddPlaning( int nGroup, int nProc, int nSide, const string& sDes, int n
// se non è stata inserita alcuna geometria
if ( vIds.empty()) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -6522,7 +6583,7 @@ BtlGeom::AddTyroleanDovetail( int nGroup, int nProc, int nSide, const string& sD
// se non è stata inserita alcuna geometria
if ( vIds.empty()) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -6759,7 +6820,7 @@ BtlGeom::AddDovetail( int nGroup, int nProc, int nSide, const string& sDes, int
// se non è stata inserita alcuna geometria
if ( vIds.empty()) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -6873,7 +6934,7 @@ BtlGeom::AddVariant( int nGroup, int nProc, int nSide, const string& sDes, int n
// se non è stata inserita alcuna geometria
if ( nId == GDB_ID_NULL) {
// inserisco superficie vuota come marcatore
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
InsertEmptySurface( nGroup, nProc, nSide, sDes, nProcId, GLOB_FRM, vnDPar, vdPar, vsUAtt) ;
// messaggio di warning in log
string sOut = " Warning : Empty Process (" + ToString( nGroup) + "-" + ToString( nProc, 3) + "-" + ToString( nSide) +
") on line " + ToString( m_nBtlLine) ;
@@ -6927,10 +6988,16 @@ BtlGeom::GetFreeContourCurve( int nProcId, const Frame3d& frRef, bool bOnlyStart
if ( i == -1)
break ;
}
// se solo inizio, aggiungo punto molto vicino
if ( fcData.size() == 1 && bOnlyStartOk) {
// se ammesso solo inizio e così è, aggiungo punto molto vicino
if ( bOnlyStartOk && fcData.size() == 1) {
fcData.emplace_back( FreeContourEnt( FreeContourEnt::LINE, fcData[0].ptP + Vector3d( 1, 0, 0), ORIG, 0, 0, 0)) ;
}
// se ammesso solo inizio e due soli punti coincidenti uniti da linea, sposto il secondo come sopra
else if ( bOnlyStartOk && fcData.size() == 2 &&
fcData[1].nType == FreeContourEnt::LINE &&
AreSamePointApprox( fcData[0].ptP, fcData[1].ptP)) {
fcData[1].ptP = fcData[0].ptP + Vector3d( 1, 0, 0) ;
}
// costruisco il contorno libero
PtrOwner<ICurveComposite> pCrv( CurveFromFces( fcData)) ;
if ( IsNull( pCrv))
@@ -6942,27 +7009,35 @@ BtlGeom::GetFreeContourCurve( int nProcId, const Frame3d& frRef, bool bOnlyStart
//----------------------------------------------------------------------------
bool
BtlGeom::AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnCont)
BtlGeom::AdjustFreeContourCurve( ICurve* pCrv, int nSide, bool& bClosed, bool& bEndsOnOrOutCont)
{
// verifico validità curva
if ( pCrv == nullptr)
return false ;
// verifico se curva chiusa
// verifico se curva chiusa (non interessa la posizione degli estremi)
bClosed = pCrv->IsClosed() ;
if ( bClosed) {
bEndsOnOrOutCont = false ;
return true ;
}
// verifico se gli estremi sono sul bordo della faccia
Point3d ptStart ; pCrv->GetStartPoint( ptStart) ;
Point3d ptEnd ; pCrv->GetEndPoint( ptEnd) ;
bEndsOnCont = IsPointNearFaceContour( ptStart, nSide) &&
IsPointNearFaceContour( ptEnd, nSide) ;
if ( ! bClosed && bEndsOnCont) {
if ( ! IsPointOnFaceContour( ptStart, nSide)) {
SetPointOnFaceContour( ptStart, nSide) ;
pCrv->ModifyStart( ptStart) ;
}
if ( ! IsPointOnFaceContour( ptEnd, nSide)) {
SetPointOnFaceContour( ptEnd, nSide) ;
pCrv->ModifyEnd( ptEnd) ;
}
bool bStartOn = IsPointNearFaceContour( ptStart, nSide) ;
bool bStartOut = ( ! bStartOn && IsPointOutFaceContour( ptStart, nSide)) ;
bool bEndOn = IsPointNearFaceContour( ptEnd, nSide) ;
bool bEndOut = ( ! bEndOn && IsPointOutFaceContour( ptEnd, nSide)) ;
bEndsOnOrOutCont = ( ( bStartOn || bStartOut) && ( bEndOn || bEndOut)) ;
// eventuali aggiustamenti degli estremi
if ( bStartOn && bEndsOnOrOutCont &&
! IsPointOnFaceContour( ptStart, nSide)) {
SetPointOnFaceContour( ptStart, nSide) ;
pCrv->ModifyStart( ptStart) ;
}
if ( bEndOn && bEndsOnOrOutCont &&
! IsPointOnFaceContour( ptEnd, nSide)) {
SetPointOnFaceContour( ptEnd, nSide) ;
pCrv->ModifyEnd( ptEnd) ;
}
return true ;
}
@@ -7029,7 +7104,7 @@ BtlGeom::CreateOneCurveFreeContour( const ICurveComposite* pCrvCompo)
double dThick ; pCrvCompo->GetThickness( dThick) ;
// Se ci sono lati con angolo di fianco
if ( VerifyFreeContourCurveSideAng( pCrvCompo)) {
const double ADD_LEN = 500 ;
const double ADD_LEN = max( 500., 2 * abs( dThick)) ;
// verifico se curva aperta o chiusa
bool bClosed = pCrvCompo->IsClosed() ;
// vettore delle superfici trimesh
@@ -7124,7 +7199,7 @@ BtlGeom::CreateOneCurveFreeContour( const ICurveComposite* pCrvCompo)
if ( i == nOpenEnd || ( AreSameVectorApprox( vtPrevE, vtNextE) && abs( dCurrAng - dNextAng) < 1.0)) {
Point3d ptE ; pCrvCompo->GetCurve( i)->GetEndPoint( ptE) ;
Plane3d plCut ; plCut.Set( ptE, vtPrevE) ;
pStmNew2.Set( Release( pStmNew1)) ;
pStmNew2.Set( pStmNew1) ;
if ( IsNull( pStmNew2) || ! pStmNew2->Cut( plCut, false))
return nullptr ;
}
@@ -7149,7 +7224,7 @@ BtlGeom::CreateOneCurveFreeContour( const ICurveComposite* pCrvCompo)
PtrOwner<ISurfTriMesh> pStmNew3( CreateSurfTriMesh()) ;
if ( IsNull( pStmNew3) || ! pStmNew3->CreateByFlatContour( vPL[0]))
return nullptr ;
pStmNew2.Set( Release( pStmNew3)) ;
pStmNew2.Set( pStmNew3) ;
}
else
pStmNew2.Reset() ;
@@ -7161,7 +7236,7 @@ BtlGeom::CreateOneCurveFreeContour( const ICurveComposite* pCrvCompo)
// unisco le superfici così ottenute
for ( int i = 0 ; i < int( vpStmOk.size()) ; ++ i) {
if ( IsNull( pStm))
pStm.Set( Release( vpStmOk[i])) ;
pStm.Set( vpStmOk[i]) ;
else
pStm->DoSewing( *(vpStmOk[i]), GLOB_FRM, 100 * EPS_SMALL) ;
}
@@ -7200,6 +7275,8 @@ BtlGeom::CreateFreeContours( void)
dDepth = PEN_DEPTH ;
else if ( nContType == FCT_NAIL)
dDepth = NAILING_DEPTH ;
else if ( nContType == FCT_LOCKOUT_AREA)
dDepth = LOCKOUT_DEPTH ;
string sDes = m_FcStart[0].sDes ;
Frame3d frRef = m_FcStart[0].frRef ;
int nProcId = m_FcStart[0].nId ;
@@ -7231,7 +7308,11 @@ BtlGeom::CreateFreeContours( void)
bHCross = ( ! b3Crv.IsEmpty() &&
b3Crv.GetMax().z > - EPS_SMALL &&
b3Crv.GetMin().z < - GetSideHeight( nSide) + EPS_SMALL) ;
// lo porto nel riferimento della faccia
// se penna o chiodatura e tutta fuori, la porto dentro
if ( ( nContType == FCT_PEN || nContType == FCT_NAIL) &&
! b3Crv.IsEmpty() && b3Crv.GetMax().z < - GetSideHeight( nSide) + EPS_SMALL)
pCrvCompo->Translate( Vector3d( 0, 0, b3Crv.GetMax().z - b3Crv.GetMin().z)) ;
// la porto nel riferimento della faccia
pCrvCompo->ToGlob( GetSideFrame( nSide)) ;
// creo la superficie
pStm.Set( CreateOneCurveFreeContour( pCrvCompo)) ;
@@ -7369,7 +7450,16 @@ BtlGeom::CreateFreeContours( void)
if ( nId == GDB_ID_NULL)
continue ;
// eseguo trim con le facce della trave
TrimFlatCurveWithBox( pCrvCompo, FC_OUT_CRV_TOL) ;
if ( nContType != FCT_LOCKOUT_AREA)
TrimFlatCurveWithBox( pCrvCompo, FC_OUT_CRV_TOL) ;
else {
// chiusura della curva, se necessario
pCrvCompo->Close() ;
// eseguo trim con ricostruzione di curva chiusa
pCrvCompo.Set( ConvertCurveToComposite( TrimFlatCurveWithBoxEx( Release( pCrvCompo), 10 * EPS_SMALL))) ;
if ( IsNull( pCrvCompo))
continue ;
}
// recupero eventuali angoli di fianco
DBLVECTOR vSideAng ;
if ( bOneCurve && VerifyFreeContourCurveSideAng( pCrvCompo))
@@ -7386,7 +7476,8 @@ BtlGeom::CreateFreeContours( void)
// nome e info con tipo
SetNameAndInfo( nId, nGroup, 250, nSide, sDes, nProcId) ;
// riferimento
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
if ( ! IsGlobFrame( frRef))
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
// parametro affondamento
m_pGDB->SetInfo( nId, IKEY_DEPTH, dDepth) ;
// segnalo se svuotatura
@@ -7476,8 +7567,6 @@ BtlGeom::AddOneFreeContour( int nGroup, int nProc, int nSide, const string& sDes
}
// se altrimenti solo prima curva
else if ( nCrvCnt == 1) {
// se previsto, imposto spessore
pCrvCompo->SetThickness( -dDepth) ;
// assegno eventuali angoli di fianco
{ DBLVECTOR vSideAng ;
if ( m_pGDB->GetInfo( nCrvId, IKEY_SIDEANGS, vSideAng)) {
@@ -7485,20 +7574,22 @@ BtlGeom::AddOneFreeContour( int nGroup, int nProc, int nSide, const string& sDes
pCrvCompo->SetCurveTempProp( i, int( vSideAng[i] * 1000)) ;
}
}
// porto la curva nel riferimento della faccia
// esprimo la curva nel riferimento della faccia
Frame3d frSide = GetSideFrame( nSide) ;
pCrvCompo->ToLoc( frSide) ;
// aggiusto la posizione rispetto alla faccia (attualmente porto la Z del primo punto nella faccia da sistemare !!!!)
Point3d ptStart ; pCrvCompo->GetStartPoint( ptStart) ;
if ( abs( ptStart.z) > EPS_SMALL)
pCrvCompo->Translate( Vector3d( 0, 0, -ptStart.z)) ;
// sistemo la curva
AdjustFreeContourCurve( pCrvCompo, nSide, bClosed, bEndsOnCont) ;
// se previsto, imposto spessore
pCrvCompo->SetThickness( -dDepth) ;
// verifico se interessa tutto lo spessore della trave perpendicolarmente alla faccia
BBox3d b3Crv ; pCrvCompo->GetLocalBBox( b3Crv) ;
bHCross = ( ! b3Crv.IsEmpty() &&
b3Crv.GetMax().z > - EPS_SMALL &&
b3Crv.GetMin().z < - GetSideHeight( nSide) + EPS_SMALL) ;
// se penna o chiodatura e tutta fuori, la porto dentro
if ( ( nContType == FCT_PEN || nContType == FCT_NAIL) &&
! b3Crv.IsEmpty() && b3Crv.GetMax().z < - GetSideHeight( nSide) + EPS_SMALL)
pCrvCompo->Translate( Vector3d( 0, 0, b3Crv.GetMax().z - b3Crv.GetMin().z)) ;
// la porto nel riferimento della faccia
pCrvCompo->ToGlob( frSide) ;
// creo la superficie
@@ -7657,7 +7748,8 @@ BtlGeom::AddOneFreeContour( int nGroup, int nProc, int nSide, const string& sDes
// nome e info con tipo
SetNameAndInfo( nId, nGroup, 250, nSide, sDes, nProcId) ;
// riferimento
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
if ( ! IsGlobFrame( frRef))
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
// parametro affondamento
m_pGDB->SetInfo( nId, IKEY_DEPTH, dDepth) ;
// segnalo se svuotatura
@@ -7992,6 +8084,13 @@ BtlGeom::TrimFlatCurveWithBoxEx( ICurve* pCurve, double dLinTol)
PtrOwner< ICurve> pMyCrv( pCurve) ;
if ( IsNull( pMyCrv))
return nullptr ;
// se la curva è completamente contenuta nel box della trave non va modificata
BBox3d b3Crv ;
pCurve->GetLocalBBox( b3Crv) ;
BBox3d b3Box( ORIG, ORIG + m_vtDim) ;
b3Box.Expand( dLinTol + 10 * EPS_SMALL) ;
if ( b3Box.Encloses( b3Crv))
return Release( pMyCrv) ;
// determino il piano della curva
Plane3d plPlane ;
if ( ! pCurve->IsFlat( plPlane, false, 10 * EPS_SMALL))
@@ -8056,6 +8155,7 @@ BtlGeom::TrimSegmentWithBox( Point3d& ptP1, Point3d& ptP2, double dRad)
for ( int i = BTL_SIDE_FRONT ; i <= BTL_SIDE_RIGHT ; ++ i) {
// piano della faccia
Plane3d plFace = GetSidePlane( i) ;
double dHeight = GetSideHeight( i) ;
// distanza con segno dei punti dal piano
double dDist1 = DistPointPlane( ptP1, plFace) ;
double dDist2 = DistPointPlane( ptP2, plFace) ;
@@ -8066,10 +8166,10 @@ BtlGeom::TrimSegmentWithBox( Point3d& ptP1, Point3d& ptP2, double dRad)
if ( dDist1 > EPS_SMALL && dDist2 > EPS_SMALL)
;
// se primo esterno, devo spostare inizio
else if ( dDist1 > EPS_SMALL)
else if ( dDist1 > EPS_SMALL && ( -dDist2 - dHeight) > -100 * EPS_SMALL)
ptP1 = Media( ptP1, ptP2, dDist1 / ( dDist1 + abs( dDist2))) ;
// se secondo esterno, devo spostare fine
else if ( dDist2 > EPS_SMALL)
else if ( dDist2 > EPS_SMALL && ( -dDist1 - dHeight) > -100 * EPS_SMALL)
ptP2 = Media( ptP2, ptP1, dDist2 / ( dDist2 + abs( dDist1))) ;
}
return true ;
@@ -8246,7 +8346,7 @@ BtlGeom::SetParams( int nId, const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, co
// elenco dei parametri
int nNumPar = min( int( vnDPar.size()), int( vdPar.size())) ;
for ( int i = 0 ; i < nNumPar ; ++ i) {
string sKey = IKEY_PAR + ToString( vnDPar[i], 2) ;
string sKey = IKEY_PAR + ToString( abs( vnDPar[i]), 2) ;
m_pGDB->SetInfo( nId, sKey, vdPar[i]) ;
}
// elenco degli eventuali attributi utente
@@ -8421,7 +8521,7 @@ BtlGeom::GetUserParam( const STRVECTOR& vsUAtt, const string& sKey, double& dVal
//---------------------------------------------------------------------------
bool
BtlGeom::InsertEmptySurface( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
BtlGeom::InsertEmptySurface( int nGroup, int nProc, int nSide, const string& sDes, int nProcId, const Frame3d& frRef,
const INTVECTOR& vnDPar, const DBLVECTOR& vdPar, const STRVECTOR& vsUAtt)
{
// creo la superficie vuota
@@ -8432,9 +8532,12 @@ BtlGeom::InsertEmptySurface( int nGroup, int nProc, int nSide, const string& sDe
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, m_nProcsId, Release( pStm)) ;
if ( nId == GDB_ID_NULL)
return false ;
// aggiungo nome e info con tipo
// aggiungo nome e info con tipo
SetNameAndInfo( nId, nGroup, nProc, nSide, sDes, nProcId) ;
// aggiungo parametri
// riferimento
if ( ! IsGlobFrame( frRef))
m_pGDB->SetInfo( nId, IKEY_FRAME, frRef) ;
// aggiungo parametri
SetParams( nId, vnDPar, vdPar, vsUAtt) ;
m_nProcId = nId ;
return true ;
@@ -8472,7 +8575,7 @@ BtlGeom::AdjustPointForPlaneNearBoxVertex( Point3d& ptP, const Vector3d& vtN, in
//----------------------------------------------------------------------------
bool
BtlGeom::AddTenonBTLX( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
const INTVECTOR& vnDPar, DBLVECTOR& vdPar, const STRVECTOR& vsUAtt)
const INTVECTOR& vnDPar, DBLVECTOR& vdPar, const STRVECTOR& vsUAtt)
{
double dStartX = vdPar[0] ;
double dStartY = vdPar[1] ;
@@ -8507,7 +8610,7 @@ BtlGeom::AddTenonBTLX( int nGroup, int nProc, int nSide, const string& sDes, int
//----------------------------------------------------------------------------
bool
BtlGeom::AddDovetailTenonBTLX( int nGroup, int nProc, int nSide, const string& sDes, int nProcId,
const INTVECTOR& vnDPar, DBLVECTOR& vdPar, const STRVECTOR& vsUAtt)
const INTVECTOR& vnDPar, DBLVECTOR& vdPar, const STRVECTOR& vsUAtt)
{
double dStartX = vdPar[0] ;
double dStartY = vdPar[1] ;
+3 -2
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2014-2014
// EgalTech 2014-2023
//----------------------------------------------------------------------------
// File : DllMain.h Data : 04.04.14 Versione : 1.5d1
// File : DllMain.h Data : 30.05.23 Versione : 2.5e5
// Contenuto : Prototipi funzioni per uso locale della DLL.
//
//
@@ -20,3 +20,4 @@
ILogger* GetEExLogger( void) ;
const std::string& GetEExKey( void) ;
bool GetEExNetHwKey( void) ;
bool VerifyKey( int nKeyOpt) ;
+30
View File
@@ -16,6 +16,7 @@
#include "DllMain.h"
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGnGetModuleVer.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
#include "/EgtDev/Include/EgtTrace.h"
//--------------------------- Costanti ----------------------------------------
@@ -118,3 +119,32 @@ GetEExNetHwKey( void)
{
return s_bNetHwKey ;
}
//-----------------------------------------------------------------------------
bool
VerifyKey( int nKeyOpt)
{
// Controllo della licenza
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( ! GetEExNetHwKey())
nRet = GetKeyOptions( GetEExKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( nRet != KEY_OK && ! EqualNoCase( GetEExKey(), "EExBase")) {
if ( nRet != KEY_OK) {
std::string sErr = "Error on Key (EXC/" + ToString( nRet) + ")" ;
LOG_ERROR( GetEExLogger(), sErr.c_str()) ;
return false ;
}
if ( ( nOpt1 & ( KEYOPT_EEX_INPBASE|KEYOPT_EEX_EXPBASE)) == 0 ||
( nKeyOpt != 0 && ( nOpt1 & nKeyOpt) == 0) ||
nOptExpDays < GetCurrDay()) {
std::string sErr = "Warning on Key (EXC/OPT)" ;
LOG_ERROR( GetEExLogger(), sErr.c_str()) ;
return false ;
}
}
return true ;
}
BIN
View File
Binary file not shown.
+97 -12
View File
@@ -22,7 +22,7 @@
<ProjectGuid>{80FCBEA4-1883-4542-939D-8582E66D8D51}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>EgtExchange</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -103,8 +103,8 @@
<PreprocessorDefinitions>WIN32;I_AM_EEX;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OpenMPSupport>true</OpenMPSupport>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -127,10 +127,10 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;I_AM_EEX;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OpenMPSupport>true</OpenMPSupport>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
<AdditionalOptions>
</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -162,8 +162,8 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -191,13 +191,12 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OpenMPSupport>false</OpenMPSupport>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<OmitFramePointers>true</OmitFramePointers>
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
@@ -217,19 +216,101 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Include\EExBeamConst.h" />
<ClInclude Include="..\Include\EExBeamMgr.h" />
<ClInclude Include="..\Include\EExDllMain.h" />
<ClInclude Include="..\Include\EExExcExecutor.h" />
<ClInclude Include="..\Include\EExExport3MF.h" />
<ClInclude Include="..\Include\EExExportConst.h" />
<ClInclude Include="..\Include\EExExportDxf.h" />
<ClInclude Include="..\Include\EExExportStl.h" />
<ClInclude Include="..\Include\EExExportSvg.h" />
<ClInclude Include="..\Include\EExExportThreeJS.h" />
<ClInclude Include="..\Include\EExImport3MF.h" />
<ClInclude Include="..\Include\EExImportBtl.h" />
<ClInclude Include="..\Include\EExImportBtlx.h" />
<ClInclude Include="..\Include\EExImportCnc.h" />
<ClInclude Include="..\Include\EExImportCsf.h" />
<ClInclude Include="..\Include\EExImportDxf.h" />
<ClInclude Include="..\Include\EExImportPnt.h" />
<ClInclude Include="..\Include\EExImportStl.h" />
<ClInclude Include="..\Include\EGkAngle.h" />
<ClInclude Include="..\Include\EGkArcSpecial.h" />
<ClInclude Include="..\Include\EGkBBox3d.h" />
<ClInclude Include="..\Include\EGkChainCurves.h" />
<ClInclude Include="..\Include\EGkColor.h" />
<ClInclude Include="..\Include\EGkCurve.h" />
<ClInclude Include="..\Include\EGkCurveArc.h" />
<ClInclude Include="..\Include\EGkCurveAux.h" />
<ClInclude Include="..\Include\EGkCurveBezier.h" />
<ClInclude Include="..\Include\EGkCurveByInterp.h" />
<ClInclude Include="..\Include\EGkCurveComposite.h" />
<ClInclude Include="..\Include\EGkCurveLine.h" />
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h" />
<ClInclude Include="..\Include\EGkExtDimension.h" />
<ClInclude Include="..\Include\EGkExtText.h" />
<ClInclude Include="..\Include\EGkFrame3d.h" />
<ClInclude Include="..\Include\EGkGdbConst.h" />
<ClInclude Include="..\Include\EGkGdbIterator.h" />
<ClInclude Include="..\Include\EGkGeoCollection.h" />
<ClInclude Include="..\Include\EGkGeoConst.h" />
<ClInclude Include="..\Include\EGkGeoFrame3d.h" />
<ClInclude Include="..\Include\EGkGeomDB.h" />
<ClInclude Include="..\Include\EGkGeoObj.h" />
<ClInclude Include="..\Include\EGkGeoObjType.h" />
<ClInclude Include="..\Include\EGkGeoPoint3d.h" />
<ClInclude Include="..\Include\EGkGeoVector3d.h" />
<ClInclude Include="..\Include\EGkIntersCurves.h" />
<ClInclude Include="..\Include\EGkIntersLineBox.h" />
<ClInclude Include="..\Include\EGkIntersLinePlane.h" />
<ClInclude Include="..\Include\EGkIntersSurfTmSurfTm.h" />
<ClInclude Include="..\Include\EGkIntervals.h" />
<ClInclude Include="..\Include\EGkMaterial.h" />
<ClInclude Include="..\Include\EGkObjGraphics.h" />
<ClInclude Include="..\Include\EGkOffsetCurve.h" />
<ClInclude Include="..\Include\EGkPlane3d.h" />
<ClInclude Include="..\Include\EGkPoint3d.h" />
<ClInclude Include="..\Include\EGkPointGrid3d.h" />
<ClInclude Include="..\Include\EGkPolyArc.h" />
<ClInclude Include="..\Include\EGkPolygon3d.h" />
<ClInclude Include="..\Include\EGkPolyLine.h" />
<ClInclude Include="..\Include\EGkSfrCreate.h" />
<ClInclude Include="..\Include\EGkStmFromCurves.h" />
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h" />
<ClInclude Include="..\Include\EGkStmStandard.h" />
<ClInclude Include="..\Include\EGkStringUtils3d.h" />
<ClInclude Include="..\Include\EGkSurf.h" />
<ClInclude Include="..\Include\EGkSurfBezier.h" />
<ClInclude Include="..\Include\EGkSurfFlatRegion.h" />
<ClInclude Include="..\Include\EGkSurfTriMesh.h" />
<ClInclude Include="..\Include\EGkTriangle3d.h" />
<ClInclude Include="..\Include\EGkUserObj.h" />
<ClInclude Include="..\Include\EGkVector3d.h" />
<ClInclude Include="..\Include\EGnCmdExecutor.h" />
<ClInclude Include="..\Include\EGnCmdParser.h" />
<ClInclude Include="..\Include\EGnFileUtils.h" />
<ClInclude Include="..\Include\EGnGetModuleVer.h" />
<ClInclude Include="..\Include\EGnScanner.h" />
<ClInclude Include="..\Include\EGnStringKeyVal.h" />
<ClInclude Include="..\Include\EGnStringUtils.h" />
<ClInclude Include="..\Include\EGnWriter.h" />
<ClInclude Include="..\Include\EGrScene.h" />
<ClInclude Include="..\Include\EgtExecMgr.h" />
<ClInclude Include="..\Include\EgtILogger.h" />
<ClInclude Include="..\Include\EgtKeyCodes.h" />
<ClInclude Include="..\Include\EgtLibVer.h" />
<ClInclude Include="..\Include\EgtNumCollection.h" />
<ClInclude Include="..\Include\EgtNumUtils.h" />
<ClInclude Include="..\Include\EgtPointerOwner.h" />
<ClInclude Include="..\Include\EgtStringBase.h" />
<ClInclude Include="..\Include\EgtStringConverter.h" />
<ClInclude Include="..\Include\EgtStringDecoder.h" />
<ClInclude Include="..\Include\EgtStringEncoder.h" />
<ClInclude Include="..\Include\EgtTargetVer.h" />
<ClInclude Include="..\Include\EgtTrace.h" />
<ClInclude Include="..\Include\ENkCplxCollection.h" />
<ClInclude Include="..\Include\ENkPolynomialRoots.h" />
<ClInclude Include="..\Include\SELkKeyProc.h" />
<ClInclude Include="BeamMgr.h" />
<ClInclude Include="BtlConst.h" />
<ClInclude Include="BtlGeom.h" />
@@ -237,11 +318,13 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
<ClInclude Include="DxfColors.h" />
<ClInclude Include="DxfConst.h" />
<ClInclude Include="ExcExecutor.h" />
<ClInclude Include="Export3dm.h" />
<ClInclude Include="Export3MF.h" />
<ClInclude Include="ExportDxf.h" />
<ClInclude Include="ExportStl.h" />
<ClInclude Include="ExportSvg.h" />
<ClInclude Include="ExportThreeJS.h" />
<ClInclude Include="Import3dm.h" />
<ClInclude Include="Import3MF.h" />
<ClInclude Include="ImportBtl.h" />
<ClInclude Include="BtlGeomCoStru.h" />
@@ -274,11 +357,13 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="ExcExecutor.cpp" />
<ClCompile Include="Export3dm.cpp" />
<ClCompile Include="Export3MF.cpp" />
<ClCompile Include="ExportDxf.cpp" />
<ClCompile Include="ExportStl.cpp" />
<ClCompile Include="ExportSvg.cpp" />
<ClCompile Include="ExportThreeJS.cpp" />
<ClCompile Include="Import3dm.cpp" />
<ClCompile Include="Import3MF.cpp" />
<ClCompile Include="ImportBtl.cpp" />
<ClCompile Include="BtlGeom.cpp" />
+258
View File
@@ -129,6 +129,258 @@
<ClInclude Include="ExportThreeJS.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExBeamConst.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExExcExecutor.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExExport3MF.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExExportSvg.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExExportThreeJS.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExImport3MF.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EExImportPnt.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkAngle.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkArcSpecial.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkBBox3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkChainCurves.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkColor.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurve.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveArc.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveAux.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveBezier.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveByInterp.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveComposite.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurveLine.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkCurvePointDiffGeom.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkExtDimension.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkExtText.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkFrame3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGdbConst.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGdbIterator.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoCollection.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoFrame3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeomDB.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoObj.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoObjType.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoPoint3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkGeoVector3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersCurves.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersLineBox.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersLinePlane.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntersSurfTmSurfTm.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkIntervals.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkMaterial.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkObjGraphics.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkOffsetCurve.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPlane3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPoint3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPointGrid3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolyArc.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolygon3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkPolyLine.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSfrCreate.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkStmFromCurves.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkStmFromTriangleSoup.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkStmStandard.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkStringUtils3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurf.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurfBezier.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurfFlatRegion.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkSurfTriMesh.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkTriangle3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkUserObj.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGkVector3d.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnCmdExecutor.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnCmdParser.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnFileUtils.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnGetModuleVer.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnStringKeyVal.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnStringUtils.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGnWriter.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EGrScene.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtExecMgr.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtILogger.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtKeyCodes.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtLibVer.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtNumCollection.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtNumUtils.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtPointerOwner.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtStringBase.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtStringConverter.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtStringDecoder.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtStringEncoder.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtTargetVer.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\EgtTrace.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\ENkCplxCollection.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\ENkPolynomialRoots.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="..\Include\SELkKeyProc.h">
<Filter>File di intestazione\Include</Filter>
</ClInclude>
<ClInclude Include="Import3dm.h">
<Filter>File di intestazione</Filter>
</ClInclude>
<ClInclude Include="Export3dm.h">
<Filter>File di intestazione</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
@@ -209,6 +461,12 @@
<ClCompile Include="ExportThreeJS.cpp">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="Import3dm.cpp">
<Filter>File di origine</Filter>
</ClCompile>
<ClCompile Include="Export3dm.cpp">
<Filter>File di origine</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="EgtExchange.rc">
+37
View File
@@ -22,6 +22,7 @@
#include "/EgtDev/Include/EExImportCnc.h"
#include "/EgtDev/Include/EExImportDxf.h"
#include "/EgtDev/Include/EExImportStl.h"
#include "/EgtDev/Include/EExImport3dm.h"
using namespace std ;
@@ -43,6 +44,7 @@ ExcExecutor::ExcExecutor( void)
m_ExecMgr.Insert( "IMPORTCNC", &ExcExecutor::ExecuteImportCnc) ;
m_ExecMgr.Insert( "IMPORTDXF", &ExcExecutor::ExecuteImportDxf) ;
m_ExecMgr.Insert( "IMPORTSTL", &ExcExecutor::ExecuteImportStl) ;
//m_ExecMgr.Insert( "IMPORT3DM", &ExcExecutor::ExecuteImport3dm) ;
}
//----------------------------------------------------------------------------
@@ -234,3 +236,38 @@ ExcExecutor::ExecuteImportStl( const string& sCmd2, const STRVECTOR& vsParams)
return bOk ;
}
////----------------------------------------------------------------------------
//bool
//ExcExecutor::ExecuteImport3dm( const string& sCmd2, const STRVECTOR& vsParams)
//{
// // 2 o 3 parametri : nome del file, Id del gruppo[, ScaleFactor]
// if ( vsParams.size() != 2 && vsParams.size() != 3)
// return false ;
// // eventuale conversione di token nel nome file
// string sFile = vsParams[0] ;
// m_pParser->DirReplace( sFile) ;
// // recupero l'Id
// int nId = m_pParser->GetIdParam( vsParams[1]) ;
// if ( nId == CMD_ID_ERROR)
// return false ;
// // gestisco ScaleFactor
// double dScaleFactor = 1 ;
// if ( vsParams.size() >= 3)
// FromString( vsParams[2], dScaleFactor) ;
//
// // preparo l'importatore
// IImport3dm* pImp3dm = CreateImport3dm() ;
// if ( pImp3dm == nullptr) {
// LOG_ERROR( GetEExLogger(), "Error : CreateImportStl")
// return false ;
// }
// // eseguo l'importazione
// //bool bOk = pImp3dm->Import( sFile, m_pGDB, nId, dScaleFactor) ;
// // cancello l'importatore
// delete pImp3dm ;
//
// //return bOk ;
//
// //return true ;
//}
+1
View File
@@ -40,6 +40,7 @@ class ExcExecutor : public IExcExecutor
bool ExecuteImportDxf( const std::string& sCmd2, const STRVECTOR& vsParams) ;
bool ExecuteImportCnc( const std::string& sCmd2, const STRVECTOR& vsParams) ;
bool ExecuteImportStl( const std::string& sCmd2, const STRVECTOR& vsParams) ;
//bool ExecuteImport3dm( const std::string& sCmd2, const STRVECTOR& vsParams) ;
private :
IGeomDB* m_pGDB ;
+35 -10
View File
@@ -28,14 +28,17 @@
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
using namespace Lib3MF ;
using namespace Lib3MF ;
//----------------------------------------------------------------------------
static string sInfoNamespace = "CustomInfo" ;
//----------------------------------------------------------------------------
IExport3MF*
CreateExport3MF( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IExport3MF*> ( new(nothrow) Export3MF) ;
@@ -65,7 +68,7 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
return false ;
}
// libreria 3MF
// libreria 3MF
m_wrapper = CWrapper::loadLibrary() ;
if ( ! m_wrapper) {
LOG_ERROR( GetEExLogger(), "Export3MF : Error on lib3mf Wrapper")
@@ -87,6 +90,17 @@ Export3MF::Export( IGeomDB* pGDB, int nId, const string& sFile)
if ( IsNull( pIter))
return false ;
pIter->GoTo( nId) ;
// assegno le info dell'oggetto al modello
PMetaDataGroup metaDataGrp = m_model->GetMetaDataGroup() ;
STRVECTOR vInfo ;
pIter->GetAllInfo( vInfo) ;
for ( const string& sInfo : vInfo) {
string sKey, sVal ;
SplitFirst( sInfo, "=", sKey, sVal) ;
metaDataGrp->AddMetaData( sInfoNamespace, sKey, sVal, "xs:string", 0) ;
}
// esporto l'oggetto e i suoi eventuali figli
if ( ! ExportObject( *pIter))
return false ;
@@ -139,17 +153,20 @@ Export3MF::ExportObject( const IGdbIterator& iIter)
string sName ;
if ( ! iIter.GetName( sName))
sName = ToString( iIter.GetId()) ;
// recupero il colore
// recupero il colore
Color cCol ;
bool bCol = GetColor( cCol, iIter.GetGDB(), iIter.GetId()) ;
// recupero le proprietà
STRVECTOR vInfo ;
iIter.GetAllInfo( vInfo) ;
// emetto l'oggetto
switch ( pGeoObj->GetType()) {
case SRF_TRIMESH :
if ( ! ExportSTM( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr))
if ( ! ExportSTM( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, vInfo))
return false ;
break ;
case SRF_FLATRGN :
if ( ! ExportSFR( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr))
if ( ! ExportSFR( sName, pGeoObj, frFrame, bCol ? &cCol : nullptr, vInfo))
return false ;
break ;
default :
@@ -188,7 +205,7 @@ Export3MF::TestFilter( int nLev, int nMode, int nStat)
//----------------------------------------------------------------------------
bool
Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol)
Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo)
{
// verifico oggetto
const ISurfFlatRegion* pSFR = GetSurfFlatRegion( pGeoObj) ;
@@ -196,12 +213,12 @@ Export3MF::ExportSFR( const string& sName, const IGeoObj* pGeoObj, const Frame3d
return false ;
// ricavo la trimesh equivalente
const ISurfTriMesh* pStm = pSFR->GetAuxSurf() ;
return ExportSTM( sName, pStm, frFrame, pCol) ;
return ExportSTM( sName, pStm, frFrame, pCol, vInfo) ;
}
//----------------------------------------------------------------------------
bool
Export3MF::ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol)
Export3MF::ExportSTM( const string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol, const STRVECTOR& vInfo)
{
// verifico oggetto
const ISurfTriMesh* pSTM = GetSurfTriMesh( pGeoObj) ;
@@ -248,11 +265,19 @@ Export3MF::ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Fr
meshObject->SetName( sName) ;
meshObject->SetGeometry( vVertices, vTriangles) ;
// assegno il colore
// assegno il colore
if ( pCol != nullptr) {
Lib3MF_uint32 nColId = ColorHandler3MF( pCol) ;
meshObject->SetObjectLevelProperty( 1, nColId) ;
}
// assegno le info
PMetaDataGroup metaDataGrp = meshObject->GetMetaDataGroup() ;
for ( const string& sInfo : vInfo) {
string sKey, sVal ;
SplitFirst( sInfo, "=", sKey, sVal) ;
metaDataGrp->AddMetaData( sInfoNamespace, sKey, sVal, "xs:string", 0) ;
}
m_model->AddBuildItem( meshObject.get(), m_wrapper->GetIdentityTransform()) ;
return true ;
+4 -2
View File
@@ -33,8 +33,10 @@ class Export3MF : public IExport3MF
bool ExportObject( const IGdbIterator& iIter) ;
bool ScanGroup( const IGdbIterator& iIter) ;
bool TestFilter( int nLev, int nMode, int nStat) ;
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol) ;
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol) ;
bool ExportSFR( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol,
const STRVECTOR& vInfo) ;
bool ExportSTM( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color* pCol,
const STRVECTOR& vInfo) ;
Lib3MF_uint32 ColorHandler3MF( const Color* pCol) ;
bool GetColor( Color& pCol, const IGeomDB * pGBD, const int& nId) ;
+732
View File
@@ -0,0 +1,732 @@
//----------------------------------------------------------------------------
// EgalTech 2023
//----------------------------------------------------------------------------
// File : Export3dm.cpp Data : 21.09.23 Versione :
// Contenuto : Implementazione della classe per l'esportazione in formato 3dm.
//
//
//
// Modifiche : 21.09.23 DB Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "Export3dm.h"
#include "DllMain.h"
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkSurfBezier.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveBezier.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EGkGeoObjType.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Extern/opennurbs/Include/opennurbs.h"
#include <fstream>
#include <map>
using namespace std ;
//N.B.:
// se si vuole richiamare qualche variabile di default definita in una classe come statica e a cui viene assegnato un valore
// nel file opennurbs_statics.cpp bisogna richiamarla in questo elenco per evitare problemi di compilazione ( errore di LINK)
//----------------------------------------------------------------------------
IExport3dm*
CreateExport3dm( void)
{
// verifico la chiave e le opzioni
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IExport3dm*> ( new( nothrow) Export3dm) ;
}
//----------------------------------------------------------------------------
bool
Export3dm::SetOptions( int nFilter)
{
m_nFilter = nFilter ;
CalcGroupFilter() ;
return true ;
}
//----------------------------------------------------------------------------
static void
Internal_SetExampleModelProperties( ONX_Model& model, const char* source_file_name)
{
const bool bHaveFileName = ( nullptr != source_file_name && 0 != source_file_name[0]) ;
if ( ! bHaveFileName)
source_file_name = "" ;
model.m_sStartSectionComments = "This file was created using openNURBS to convert an .nge into .3dm" ;
// set application information
const ON_wString wide_source_file_name( source_file_name) ;
model.m_properties.m_Application.m_application_URL = L"http://www.opennurbs.org" ;
// set revision history information
model.m_properties.m_RevisionHistory.NewRevision() ;
}
//----------------------------------------------------------------------------
bool
Export3dm::Export( IGeomDB* pGDB, int nId, const string& sFile)
{
Internal_SetExampleModelProperties( m_model, sFile.c_str()) ;
ON::Begin() ;
// verifico il DB geometrico
if ( pGDB == nullptr) {
LOG_ERROR( GetEExLogger(), "Export3dm : Error on GeomDB")
return false ;
}
// verifico l'Id dell'oggetto da esportare
if ( ! pGDB->ExistsObj( nId)) {
LOG_ERROR( GetEExLogger(), "Export3dm : Error on Id")
return false ;
}
//// file settings ( units, tolerances, views, ...)
//// OPTIONAL - change values from defaults
m_model.m_settings.m_ModelUnitsAndTolerances.m_unit_system = ON::LengthUnitSystem::Millimeters ;
m_model.m_settings.m_ModelUnitsAndTolerances.m_absolute_tolerance = 0.01 ;
m_model.m_settings.m_ModelUnitsAndTolerances.m_angle_tolerance = ON_PI/180.0 ;// radians
m_model.m_settings.m_ModelUnitsAndTolerances.m_relative_tolerance = 0.01 ;// 1%
m_model.m_settings.m_current_material_source = ON::object_material_source::material_from_object ;
m_model.m_settings.m_RenderSettings.m_bFlatShade = true ;
// creo un iteratore
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( pGDB)) ;
if ( IsNull( pIter))
return false ;
pIter->GoTo( nId) ;
// esporto l'oggetto e i suoi eventuali figli
bool bOk = ExportObject( *pIter, 0) ;
// stampo il file
int version = 7 ;
// errors printed to stdout
ON_TextLog error_log ;
// writes model to archive
bOk = bOk && m_model.Write( ConvertString( sFile).c_str(), version, &error_log) ;
ON::End() ;
return bOk ;
}
//----------------------------------------------------------------------------
bool
Export3dm::ExportObject( const IGdbIterator& iIter, const int& nLayer)
{
// recupero il livello dell'oggetto
int nLev = GDB_LV_USER ;
iIter.GetCalcLevel( nLev) ;
// recupero il modo dell'oggetto
int nMode = GDB_MD_STD ;
iIter.GetCalcMode( nMode) ;
// recupero lo stato dell'oggetto
int nStat = GDB_ST_ON ;
iIter.GetCalcStatus( nStat) ;
int nType = iIter.GetGdbType() ;
// se il filtro lo abilita
if ( TestFilter( nLev, nMode, nStat, nType == GDB_TY_GROUP)) {
switch ( nType) {
case GDB_TY_GEO :
{
// recupero il riferimento globale dell'oggetto
Frame3d frFrame ;
if ( ! iIter.GetGlobFrame( frFrame))
return false ;
//recupero il colore dell'oggetto
Color cCol ;
iIter.GetCalcMaterial( cCol) ;
// recupero eventuale nome
string sName ;
if ( ! iIter.GetName( sName))
sName = ToString( iIter.GetId()) ;
// emetto l'oggetto
switch ( iIter.GetGeoType()) {
case GEO_PNT3D: {
if ( ! ExportPnt( sName, iIter, frFrame, cCol, nLayer))
return false ;
break ;
}
case SRF_BEZIER: {
if ( ! ExportSrfBz( sName, iIter, frFrame, cCol, nLayer))
return false ;
break ;
}
case SRF_FLATRGN :
case SRF_TRIMESH :
if ( ! ExportSTM( sName, iIter, frFrame, cCol, nLayer))
return false ;
break ;
case CRV_ARC : {
if ( ! ExportCrvArc( sName, iIter, frFrame, cCol, nLayer))
return false ;
break ;
}
case CRV_BEZIER : {
if ( ! ExportCrvBezier( sName, iIter, frFrame, cCol, nLayer))
return false ;
break ;
}
case CRV_COMPO : {
if ( ! ExportCrvCompo( sName, iIter, frFrame, cCol, nLayer))
return false ;
break ;
}
case CRV_LINE : {
if ( ! ExportCrvLine( sName, iIter, frFrame, cCol, nLayer))
return false ;
break ;
}
default :
break ;
}
}
return true ;
case GDB_TY_GROUP: {
int nLayer = iIter.GetId() ;
if ( nLayer == 0) {
m_model.RemoveModelComponent( ON_ModelComponent::Type::Layer, m_model.LayerFromIndex( 0).ModelComponentId()) ;
return ScanGroup( iIter, nLayer) ;
}
// creo il layer e setto le proprietà
ON_Layer* layer = new ON_Layer() ;
std::string sLayName ;
iIter.GetName( sLayName) ;
if ( sLayName == "" ) {
sLayName = "Layer " + ToString( nLayer) ;
}
layer->SetName( ConvertString( sLayName).c_str()) ;
layer->SetIndex( nLayer) ;
ON_Color onCol( 0, 0, 0) ; // black
layer->SetColor( onCol) ;
layer->SetVisible( true) ;
layer->SetLocked( false) ;
int nParent = iIter.GetParentId() ;
if ( nParent != 0) {
// setto il parent
const ON_Layer* onParLay = ON_Layer::Cast( m_model.LayerFromIndex( m_mLayer[nParent]).ModelComponent()) ;
layer->SetParentLayerId( onParLay->Id()) ;
}
// copio le info
STRVECTOR vStrInfo, vStrInfo_split ;
iIter.GetAllInfo( vStrInfo) ;
for ( string sInfo : vStrInfo) {
Tokenize( sInfo, "=", vStrInfo_split) ;
layer->SetUserString( ConvertString( vStrInfo_split[0]).c_str(), ConvertString( vStrInfo_split[1]).c_str()) ;
}
// aggiungo il layer
ON_ModelComponentReference mcr = m_model.AddManagedModelComponent( layer) ;
int nIndex = mcr.ModelComponentIndex() ;
m_mLayer.insert( pair< int, int>( nLayer, nIndex)) ;
// esploro il gruppo
return ScanGroup( iIter, nIndex) ;
}
default :
return false ;
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
Export3dm::AddObjectToModel( const IGdbIterator& iIter, ON_Object* onObject, const int& nLayer, const std::string& sName, const Color& cCol,
ON_3dmObjectAttributes* pOnAttr)
{
if ( pOnAttr == nullptr)
pOnAttr = new ON_3dmObjectAttributes() ;
pOnAttr->m_layer_index = nLayer ;
pOnAttr->m_name = ConvertString( sName).c_str() ;
pOnAttr->SetColorSource( ON::color_from_object) ;
//N.B. RHINO ha i valori di Alpha invertiti rispetto ai nostri, oltre che su una scala diversa! per loro 0 = opaco e 255 = trasparente
// per noi invece 0 = trasparente, 100 = opaco
ON_Color onCol( cCol.GetIntRed(), cCol.GetIntGreen(), cCol.GetIntBlue(), abs( int( cCol.GetIntAlpha() * 2.55) - 255)) ;
pOnAttr->m_color = onCol ;
// se è una mesh aggiungo il materiale
if ( const ON_Mesh* onMesh = ON_Mesh::Cast( onObject)) {
// aggiungo il materiale al modello se necessario
std::string sCol = ToString(cCol.GetIntRed()) + "," + ToString( cCol.GetIntGreen()) + "," + ToString( cCol.GetIntBlue()) ;
if ( m_mMaterial.find( sCol) == m_mMaterial.end()) {
ON_Material* onMat = new ON_Material ;
ON_Color onCAmb( 126, 126, 126) ; // gray126
onMat->m_reflection_glossiness = 0.0 ;
onMat->SetEmission( onCol) ;
onMat->SetDiffuse( onCol) ;
onMat->SetAmbient( onCAmb) ;
onMat->SetReflectivity( 0) ;
ON_ModelComponentReference mcr = m_model.AddManagedModelComponent( onMat) ;
int nIndex = mcr.ModelComponentIndex() ;
m_mMaterial.insert( pair< std::string, int>( sCol, nIndex)) ;
pOnAttr->SetMaterialSource( ON::object_material_source::material_from_object) ;
pOnAttr->m_material_index = nIndex ;
}
// sennò richiamo un materiale già definito
else {
pOnAttr->SetMaterialSource( ON::object_material_source::material_from_object) ;
pOnAttr->m_material_index = m_mMaterial[sCol] ;
}
}
// copio le info
STRVECTOR vStrInfo, vStrInfo_split ;
iIter.GetAllInfo(vStrInfo) ;
for ( string sInfo : vStrInfo) {
Tokenize( sInfo, "=", vStrInfo_split) ;
pOnAttr->SetUserString( ConvertString( vStrInfo_split[0]).c_str(), ConvertString( vStrInfo_split[1]).c_str()) ;
}
// aggiungo al modello
ON_ModelComponentReference mcr = m_model.AddManagedModelGeometryComponent( onObject, pOnAttr) ;
return ! mcr.IsEmpty() ;
}
//----------------------------------------------------------------------------
bool
Export3dm::AddInfoToObject( const IGdbIterator& iIter, ON_Object* onObject)
{
// copio le info
STRVECTOR vStrInfo, vStrInfo_split ;
iIter.GetAllInfo( vStrInfo) ;
for ( string sInfo : vStrInfo) {
Tokenize( sInfo, "=", vStrInfo_split) ;
onObject->SetUserString( ConvertString( vStrInfo_split[0]).c_str(), ConvertString( vStrInfo_split[1]).c_str()) ;
}
return true ;
}
//----------------------------------------------------------------------------
wstring
Export3dm::ConvertString( const std::string& sName)
{
wstring ws = wstring( sName.begin(), sName.end()) ;
return ws ;
}
//----------------------------------------------------------------------------
ON_3dPoint
Export3dm::ConvertPoint( const Point3d& pt)
{
ON_3dPoint onPt( pt.x, pt.y, pt.z) ;
return onPt ;
}
//----------------------------------------------------------------------------
ON_3dVector
Export3dm::ConvertVector( const Vector3d& vt)
{
ON_3dVector onVt( vt.x, vt.y, vt.z) ;
return onVt ;
}
//----------------------------------------------------------------------------
bool
Export3dm::TestFilter( int nLev, int nMode, int nStat, bool bGroup)
{
int nFilter = bGroup ? m_nGroupFilter : m_nFilter ;
if ( ( nLev == GDB_LV_USER && ( nFilter & EEXFLT_LEVUSER) == 0) ||
( nLev == GDB_LV_SYSTEM && ( nFilter & EEXFLT_LEVSYSTEM) == 0) ||
( nLev == GDB_LV_TEMP && ( nFilter & EEXFLT_LEVTEMP) == 0))
return false ;
if ( ( nMode == GDB_MD_STD && ( nFilter & EEXFLT_MODESTD) == 0) ||
( nMode == GDB_MD_LOCKED && ( nFilter & EEXFLT_MODELOCKED) == 0) ||
( nMode == GDB_MD_HIDDEN && ( nFilter & EEXFLT_MODEHIDDEN) == 0))
return false ;
if ( ( nStat == GDB_ST_OFF && ( nFilter & EEXFLT_STAOFF) == 0) ||
( nStat == GDB_ST_ON && ( nFilter & EEXFLT_STAON) == 0) ||
( nStat == GDB_ST_SEL && ( nFilter & EEXFLT_STASEL) == 0))
return false ;
return true ;
}
//----------------------------------------------------------------------------
bool
Export3dm::CalcGroupFilter( void)
{
m_nGroupFilter = 0 ;
// Status
if ( ( m_nFilter & EEXFLT_STASEL) != 0)
m_nGroupFilter += EEXFLT_STASEL + EEXFLT_STAOFF + EEXFLT_STAON ;
else if ( ( m_nFilter & EEXFLT_STAOFF) != 0)
m_nGroupFilter += EEXFLT_STAOFF + EEXFLT_STAON ;
else
m_nGroupFilter += EEXFLT_STAON ;
// Mode
if ( ( m_nFilter & EEXFLT_MODELOCKED) != 0)
m_nGroupFilter += EEXFLT_MODELOCKED + EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
else if ( ( m_nFilter & EEXFLT_MODEHIDDEN) != 0)
m_nGroupFilter += EEXFLT_MODEHIDDEN + EEXFLT_MODESTD ;
else
m_nGroupFilter += EEXFLT_MODESTD ;
// Level
if ( ( m_nFilter & EEXFLT_LEVSYSTEM) != 0)
m_nGroupFilter += EEXFLT_LEVSYSTEM + EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
else if ( ( m_nFilter & EEXFLT_LEVTEMP) != 0)
m_nGroupFilter += EEXFLT_LEVTEMP + EEXFLT_LEVUSER ;
else
m_nGroupFilter += EEXFLT_LEVUSER ;
return true ;
}
//----------------------------------------------------------------------------
bool
Export3dm::ExportPnt(const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
{
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return false ;
// verifico oggetto
PtrOwner<IGeoPoint3d> pGeoPnt( GetGeoPoint3d( pGeoObj->Clone())) ;
if ( IsNull( pGeoPnt))
return false ;
// lo porto nel riferimento globale
pGeoPnt->ToGlob( frFrame) ;
Point3d pt = pGeoPnt->GetPoint() ;
ON_Point* onPt = new ON_Point( ConvertPoint( pt)) ;
// aggiungo l'oggetto al modello
return AddObjectToModel( iIter, onPt, nLayer, sName, cCol) ; ;
}
//----------------------------------------------------------------------------
bool
Export3dm::ExportSrfBz( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
{
//MANCA DA IMPLEMENTARE IL TRIM DELLE SUPERFICI!!/////////////////////////////////////////////////////////////////////////////////////////////////////
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return false ;
// verifico oggetto
PtrOwner<ISurfBezier> pSrfBz( GetSurfBezier( pGeoObj->Clone())) ;
if ( IsNull( pSrfBz))
return false ;
// lo porto nel riferimento globale
pSrfBz->ToGlob( frFrame) ;
bool bOk = true ;
int nDegU, nDegV, nSpanU, nSpanV ;
bool bRat = false ;
bool bTrimmed = false ;
pSrfBz->GetInfo( nDegU, nDegV, nSpanU, nSpanV, bRat, bTrimmed) ;
int nCPU = nDegU * nSpanU + 1 ;
int nCPV = nDegV * nSpanV + 1 ;
ON_NurbsSurface* onNurbsSurf = new ON_NurbsSurface( 3, bRat, nDegU + 1, nDegV + 1, nCPU, nCPV) ;
for ( int u = 0 ; u < nCPU ; ++u) {
for ( int v = 0 ; v < nCPV ; ++v) {
Point3d ptCV = pSrfBz->GetControlPoint( u, v, &bOk) ;
if ( ! bRat) {
onNurbsSurf->SetCV( u, v, ConvertPoint( ptCV)) ;
}
else {
double dW = pSrfBz->GetControlWeight( u, v, &bOk) ;
onNurbsSurf->SetCV( u, v, ConvertPoint( ptCV * dW)) ;
onNurbsSurf->SetWeight( u, v, dW) ;
}
}
}
// imposto il vettore dei nodi in U
int nKnotCountU = nDegU + nCPU - 1 ;
double dKnot = 0 ;
// per costruzione nKnotCount é un multiplo di nDegU
for ( int u = 0 ; u < int ( nKnotCountU / nDegU) ; ++u) {
for ( int p = 0 ; p < nDegU ; ++p)
onNurbsSurf->SetKnot( 0, u * nDegU + p, dKnot) ;
++dKnot ;
}
// imposto il vettore dei nodi in V
int nKnotCountV = nDegV + nCPV - 1 ;
dKnot = 0 ;
// per costruzione nKnotCount é un multiplo di nDegU
for ( int v = 0 ; v < int ( nKnotCountV / nDegV) ; ++v) {
for ( int p = 0 ; p < nDegV ; ++p)
onNurbsSurf->SetKnot( 0, v * nDegV + p, dKnot) ;
++dKnot ;
}
// aggiungo l'oggetto al modello
return AddObjectToModel( iIter, onNurbsSurf, nLayer, sName, cCol) ;
}
//----------------------------------------------------------------------------
bool
Export3dm::ExportSTM( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
{
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return false ;
// verifico oggetto
PtrOwner<ISurfTriMesh> pSrfTm ;
if ( pGeoObj->GetType() == SRF_TRIMESH)
pSrfTm.Set( GetSurfTriMesh( pGeoObj->Clone())) ;
else {
const ISurfFlatRegion* pSrfFr = GetSurfFlatRegion( pGeoObj) ;
const ISurfTriMesh* pSrfTm_ = pSrfFr->GetAuxSurf() ;
if ( pSrfTm_ == nullptr){
return false ;
}
pSrfTm.Set( pSrfTm_->Clone()) ;
}
if ( IsNull( pSrfTm))
return false ;
// lo porto nel frame globale
pSrfTm->ToGlob( frFrame) ;
int nVertices = pSrfTm->GetVertexCount() ;
int nTriangles = pSrfTm->GetTriangleCount() ;
ON_Mesh* onMesh = new ON_Mesh ;
for ( int v = 0 ; v < nVertices ; ++v) {
Point3d pt ; pSrfTm->GetVertex( v, pt) ;
onMesh->SetVertex( v, ConvertPoint( pt)) ;
}
for ( int t = 0 ; t < nTriangles ; ++t) {
int nIdVert[3] ; pSrfTm->GetTriangle( t, nIdVert) ;
onMesh->SetTriangle( t, nIdVert[0], nIdVert[1], nIdVert[2]) ;
}
// aggiungo l'oggetto al modello
return AddObjectToModel( iIter, onMesh, nLayer, sName, cCol) ;
}
//----------------------------------------------------------------------------
ON_ArcCurve*
Export3dm::ConvertCrvArc( const ICurveArc* pCrvArc)
{
double dRad = pCrvArc->GetRadius() ;
Point3d ptCen ;
pCrvArc->GetCenterPoint( ptCen) ;
PtrOwner<ON_ArcCurve> onArcCrv( new ON_ArcCurve()) ;
if ( ! pCrvArc->IsACircle()) {
Vector3d vtZ = pCrvArc->GetNormVersor() ;
Vector3d vtX, vtY ;
vtX = pCrvArc->GetStartVersor() ;
vtY = vtZ ^ vtX ;
double dAngDeg = pCrvArc->GetAngCenter() ;
ON_Plane onPlane( ConvertPoint( ptCen), ConvertVector( vtX), ConvertVector( vtY)) ;
onArcCrv.Set( new ON_ArcCurve( ON_Arc( onPlane, dRad, dAngDeg * DEGTORAD))) ;
}
else
onArcCrv.Set( new ON_ArcCurve ( ON_Circle( ConvertPoint( ptCen), dRad))) ;
return Release( onArcCrv) ;
}
//----------------------------------------------------------------------------
bool
Export3dm::ExportCrvArc( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
{
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return false ;
// verifico oggetto
PtrOwner<ICurveArc> pCrvArc( GetCurveArc( pGeoObj->Clone())) ;
if ( IsNull( pCrvArc))
return false ;
// lo porto nel fram globale
pCrvArc->ToGlob( frFrame) ;
ON_ArcCurve* onArcCrv = ConvertCrvArc( pCrvArc) ;
if ( onArcCrv == nullptr)
return false ;
// aggiungo l'oggetto al modello
return AddObjectToModel( iIter, onArcCrv, nLayer, sName, cCol) ;
}
//----------------------------------------------------------------------------
ON_NurbsCurve*
Export3dm::ConvertCrvBezier( const ICurveBezier* pCrvBz)
{
// creo l'oggetto da esportare
int nDeg = pCrvBz->GetDegree() ;
int nCV = nDeg + 1 ;
PtrOwner<ON_NurbsCurve> onNurbsCrv( new ON_NurbsCurve( 3, // dim
pCrvBz->IsRational(), // bRat
nDeg + 1, // order = deg + 1
nCV)) ; // numero di CP
// imposto i punti di controllo con gli eventuali pesi
if ( ! pCrvBz->IsRational()) {
bool bOk = true ;
for ( int i = 0 ; i < nCV ; ++i) {
ON_3dPoint onPt = ConvertPoint( pCrvBz->GetControlPoint( i, &bOk)) ;
onNurbsCrv->SetCV( i, onPt) ;
}
}
else {
bool bOk = true ;
for ( int i = 0 ; i < nCV ; ++i) {
ON_3dPoint onPt = ConvertPoint( pCrvBz->GetControlPoint( i, &bOk)) ;
double dWeight = pCrvBz->GetControlWeight( i, &bOk) ;
onNurbsCrv->SetCV( i, onPt * dWeight) ;
onNurbsCrv->SetWeight( i, dWeight) ;
}
}
// imposto il vettore dei nodi
int nKnotCount = nDeg + nCV - 1 ;
double dKnot = 0 ;
for ( int u = 0 ; u < int ( nKnotCount / nDeg) ; ++u) {
for ( int p = 0 ; p < nDeg ; ++p)
onNurbsCrv->SetKnot( u * nDeg + p, dKnot) ;
++dKnot ;
}
return Release( onNurbsCrv) ;
}
//----------------------------------------------------------------------------
bool
Export3dm::ExportCrvBezier( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
{
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return false ;
// verifico oggetto
PtrOwner<ICurveBezier> pCrvBz( GetCurveBezier( pGeoObj->Clone())) ;
if ( IsNull( pCrvBz))
return false ;
// lo porto nel riferimento globale
pCrvBz->ToGlob( frFrame) ;
ON_NurbsCurve* onNurbsCrv = ConvertCrvBezier( pCrvBz) ;
if ( onNurbsCrv == nullptr)
return false ;
// aggiungo l'oggetto al modello
return AddObjectToModel( iIter, onNurbsCrv, nLayer, sName, cCol) ;
}
//----------------------------------------------------------------------------
bool
Export3dm::ExportCrvCompo( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
{
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return false ;
// verifico oggetto
PtrOwner<ICurveComposite> pCrvCompo( GetCurveComposite( pGeoObj->Clone())) ;
if ( IsNull( pCrvCompo))
return false ;
// lo porto nel riferimento globale
pCrvCompo->ToGlob( frFrame) ;
ON_PolyCurve* onPolyCrv = new ON_PolyCurve ;
for ( const ICurve* pCrv = pCrvCompo->GetFirstCurve() ; pCrv != nullptr ; pCrv = pCrvCompo->GetNextCurve()) {
GeoObjType type = pCrv->GetType() ;
switch ( type) {
case CRV_LINE : {
PtrOwner<ICurveLine> pCrvL( GetCurveLine( pCrv->Clone())) ;
if ( IsNull( pCrvL)) {
delete onPolyCrv ;
return false ;
}
ON_LineCurve* onLine = ConvertCrvLine( pCrvL) ;
if ( onLine == nullptr) {
delete onPolyCrv ;
return false ;
}
onPolyCrv->Append( onLine) ;
break ;
}
case CRV_ARC : {
PtrOwner<ICurveArc> pCrvArc( GetCurveArc( pCrv->Clone())) ;
if ( IsNull( pCrvArc)) {
delete onPolyCrv ;
return false ;
}
ON_ArcCurve* onArcCrv = ConvertCrvArc( pCrvArc) ;
if ( onArcCrv == nullptr) {
delete onPolyCrv ;
return false ;
}
onPolyCrv->Append( onArcCrv) ;
break ;
}
case CRV_BEZIER : {
PtrOwner<ICurveBezier> pCrvBz( GetCurveBezier( pCrv->Clone())) ;
if ( IsNull( pCrvBz)) {
delete onPolyCrv ;
return false ;
}
ON_NurbsCurve* onNurbsCrv = ConvertCrvBezier( pCrvBz) ;
if ( onNurbsCrv == nullptr) {
delete onPolyCrv ;
return false ;
}
onPolyCrv->Append( onNurbsCrv) ;
break ;
}
default : break ;
}
}
// aggiungo l'oggetto al modello
return AddObjectToModel( iIter, onPolyCrv, nLayer, sName, cCol) ;
}
//----------------------------------------------------------------------------
ON_LineCurve*
Export3dm::ConvertCrvLine( const ICurveLine* pCrvL)
{
Point3d ptStart, ptEnd ;
pCrvL->GetStartPoint( ptStart) ;
pCrvL->GetEndPoint( ptEnd) ;
PtrOwner<ON_LineCurve> onCrvLine( new ON_LineCurve( ON_Line( ConvertPoint( ptStart), ConvertPoint( ptEnd)))) ;
return Release( onCrvLine) ;
}
//----------------------------------------------------------------------------
bool
Export3dm::ExportCrvLine( const string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer)
{
// recupero l'oggetto geometrico
const IGeoObj* pGeoObj = iIter.GetGeoObj() ;
if ( pGeoObj == nullptr)
return false ;
// verifico oggetto
PtrOwner<ICurveLine> pCrvL( GetCurveLine( pGeoObj->Clone())) ;
if ( IsNull( pCrvL))
return false ;
// lo porto nel frame globale
pCrvL->ToGlob( frFrame) ;
ON_LineCurve* onCrvLine = ConvertCrvLine( pCrvL) ;
// aggiungo l'oggetto al modello
return AddObjectToModel( iIter, onCrvLine, nLayer, sName, cCol) ;
}
//----------------------------------------------------------------------------
bool
Export3dm::ScanGroup( const IGdbIterator& iIter, const int& nLayer)
{
// creo un iteratore
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( iIter.GetGDB())) ;
if ( IsNull( pIter))
return false ;
// scandisco il gruppo
bool bOk = true ;
for ( bool bNext = pIter->GoToFirstInGroup( iIter) ;
bNext ;
bNext = pIter->GoToNext()) {
if ( ! ExportObject( *pIter, nLayer))
bOk = false ;
}
return bOk ;
}
+79
View File
@@ -0,0 +1,79 @@
//----------------------------------------------------------------------------
// EgalTech 2023
//----------------------------------------------------------------------------
// File : Export3dm.cpp Data : 21.09.23 Versione :
// Contenuto : Dichiarazione della classe ExportStl.
//
//
//
// Modifiche : 21.09.23 DB Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#define NOMINMAX
#include "/EgtDev/Include/EExExport3dm.h"
#include "/EgtDev/Include/EGnWriter.h"
#include "/EgtDev/Extern/opennurbs/Include/opennurbs.h"
#include <map>
class IGdbIterator ;
class IGeoObj ;
class Frame3d ;
class Point3d ;
class ICurveBezier ;
class ICurveArc ;
class ICurveLine ;
class ISurfFlatRegion ;
class ON_3dPoint ;
class ON_3dVector ;
class ON_Object ;
class ON_NurbsCurve ;
class ON_ArcCurve ;
class ON_LineCurve ;
//----------------------------------------------------------------------------
class Export3dm : public IExport3dm
{
public :
virtual bool SetOptions( int nFilter) ;
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile) ;
public :
Export3dm(void) : m_nFilter(EEXFLT_DEFAULT) {
CalcGroupFilter() ;
}
private :
bool ExportObject( const IGdbIterator& iIter, const int& nLayer) ;
bool AddObjectToModel( const IGdbIterator& iIter, ON_Object* onObject, const int& nLayer, const std::string& sName, const Color& cCol,
ON_3dmObjectAttributes* pOnAttr = nullptr) ;
bool AddInfoToObject( const IGdbIterator& iIter, ON_Object* onObject) ;
bool ScanGroup( const IGdbIterator& iIter, const int& nLayer) ;
bool TestFilter( int nLev, int nMode, int nStat, bool bGroup = false) ;
std::wstring ConvertString( const std::string& sName) ;
ON_3dPoint ConvertPoint( const Point3d& pt) ;
ON_3dVector ConvertVector( const Vector3d& vt) ;
ON_NurbsCurve* ConvertCrvBezier( const ICurveBezier* pCrvBz) ;
ON_ArcCurve* ConvertCrvArc( const ICurveArc* pCrvArc) ;
ON_LineCurve* ConvertCrvLine( const ICurveLine* pCrvL) ;
bool ExportPnt( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
bool ExportSrfBz( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
bool ExportSTM( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
bool ExportCrvArc( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
bool ExportCrvBezier( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
bool ExportCrvCompo( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
bool ExportCrvLine( const std::string& sName, const IGdbIterator& iIter, const Frame3d& frFrame, const Color& cCol, const int& nLayer) ;
bool CalcGroupFilter( void) ;
private :
int m_nFilter ; // filtro su livello, modo e stato, se l'oggeto da valutare è un oggetto geometrico
int m_nGroupFilter ; // filtro su livello, modo e stato, se l'oggetto da valutare è un gruppo
Writer m_Writer ; // scrittore di file di testo
ONX_Model m_model ; // modello opennurbs
std::map<int,int> m_mLayer ; // mappa dei layer <indice layer nge, indice del componente layer nel modello 3dm>
std::map<std::string,int> m_mMaterial ; // mappa dei materiali <stringa del colore ( R,G,B), indice del componente material nel modello 3dm>
} ;
+1 -1
View File
@@ -46,7 +46,7 @@ IExportDxf*
CreateExportDxf( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IExportDxf*> ( new(nothrow) ExportDxf) ;
+1 -1
View File
@@ -34,7 +34,7 @@ IExportStl*
CreateExportStl( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IExportStl*> ( new(nothrow) ExportStl) ;
+179 -6
View File
@@ -41,7 +41,7 @@ IExportSvg*
CreateExportSvg( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_EXPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_EXPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IExportSvg*> ( new(nothrow) ExportSvg) ;
@@ -93,8 +93,8 @@ ExportSvg::Export( IGeomDB* pGDB, int nId, const string& sFile)
{ return a.second < b.second ; }) ;
// scrivo la sezione di intestazione
double dDimX = b3All.GetMax().x - b3All.GetMin().x ;
double dDimY = b3All.GetMax().y - b3All.GetMin().y ;
double dDimX = b3All.GetDimX() ;
double dDimY = b3All.GetDimY() ;
if ( ! ExportHeader( dDimX, dDimY))
bOk = false ;
@@ -189,6 +189,9 @@ ExportSvg::ExportHeader( double dDimX, double dDimY)
{
if ( ! m_Writer.OutText( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"))
return false ;
const double MIN_DIM = 10 ;
dDimX = max( dDimX, MIN_DIM) ;
dDimY = max( dDimY, MIN_DIM) ;
const double COEFF = 0.05 ;
double dExtraX = COEFF * dDimX ;
double dExtraY = COEFF * dDimY ;
@@ -333,6 +336,18 @@ ExportSvg::ExportPoint( const string& sName, const Color& colObj, const IGeoObj*
return m_Writer.OutText( sOut) ;
}
//----------------------------------------------------------------------------
static bool
AddLink( const Point3d& ptStart, const Vector3d& vtDir, double dLen, const Frame3d& frFrame, ICRVLINEPOVECTOR& vLink)
{
if ( ! ptStart.IsValid() || vtDir.IsSmall() || abs( dLen) < 2 * EPS_SMALL)
return false ;
vLink.emplace_back( CreateCurveLine()) ;
vLink.back()->SetPVL( ptStart, vtDir, dLen) ;
vLink.back()->ToGlob( frFrame) ;
return true ;
}
//----------------------------------------------------------------------------
bool
ExportSvg::ExportLine( const string& sName, const Color& colObj, const IGeoObj* pGeoObj, const Frame3d& frFrame)
@@ -346,9 +361,34 @@ ExportSvg::ExportLine( const string& sName, const Color& colObj, const IGeoObj*
if ( IsNull( pMyLine))
return false ;
pMyLine->ToGlob( frFrame) ;
// eventuali curve per spessore e collegamenti
PtrOwner<ICurveLine> pMyLine2 ;
ICRVLINEPOVECTOR vMyLink ;
Vector3d vtExtr ; double dThick ;
if ( pLine->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
pLine->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
// curva sullo spessore
pMyLine2.Set( pLine->Clone()) ;
if ( IsNull( pMyLine2))
return false ;
pMyLine2->Translate( dThick * vtExtr) ;
pMyLine2->ToGlob( frFrame) ;
// collegamenti
for ( double dU = 0 ; dU < 1 + EPS_PARAM ; dU += 1) {
Point3d ptP ;
pLine->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
}
}
// porto nel piano XY globale (se si riduce ad un punto la salto)
if ( ! pMyLine->Scale( GLOB_FRM, 1, 1, 0))
return true ;
// trasformo anche l'eventuale copia
if ( ! IsNull( pMyLine2))
pMyLine2->Scale( GLOB_FRM, 1, 1, 0) ;
// trasformo anche gli eventuali collegamenti
for ( auto& pLink : vMyLink)
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
// questo oggetto non può avere fill
bool bFill = false ;
// assegno tipo
@@ -361,6 +401,16 @@ ExportSvg::ExportLine( const string& sName, const Color& colObj, const IGeoObj*
sOut +=GetStartString( pMyLine) ;
// arco
sOut += GetCurveString( pMyLine) ;
// eventuale curva copia per spessore
if ( ! IsNull( pMyLine2)) {
sOut += GetStartString( pMyLine2) ;
sOut += GetCurveString( pMyLine2) ;
}
// eventuali collegamenti per spessore
for ( const auto& pLink : vMyLink) {
sOut += GetStartString( pLink) ;
sOut += GetCurveString( pLink) ;
}
// termino i dati geometrici
sOut += "\"" ;
// colore e spessore
@@ -379,18 +429,44 @@ ExportSvg::ExportArc( const string& sName, const Color& colObj, const IGeoObj* p
const ICurveArc* pArc = GetCurveArc( pGeoObj) ;
if ( pArc == nullptr)
return false ;
// lo inglobo in una curva composita e lo porto in globale
// lo copio e lo porto in globale
PtrOwner<ICurveComposite> pMyCompo( CreateCurveComposite()) ;
if ( IsNull( pMyCompo))
return false ;
pMyCompo->AddCurve( *pArc) ;
pMyCompo->ToGlob( frFrame) ;
// eventuali curve per spessore e collegamenti
PtrOwner<ICurveComposite> pMyCompo2 ;
ICRVLINEPOVECTOR vMyLink ;
Vector3d vtExtr ; double dThick ;
if ( pArc->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
pArc->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
// curva sullo spessore
pMyCompo2.Set( CreateCurveComposite()) ;
if ( IsNull( pMyCompo2))
return false ;
pMyCompo2->AddCurve( *pArc) ;
pMyCompo2->Translate( dThick * vtExtr) ;
pMyCompo2->ToGlob( frFrame) ;
// collegamenti
for ( double dU = 0 ; dU < 1 + EPS_PARAM ; dU += 0.25) {
Point3d ptP ;
pArc->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
}
}
// verifico se la curva giace in un piano parallelo a XY globale
Plane3d plPlane ;
if ( ! pMyCompo->IsFlat( plPlane, false, 10 * EPS_SMALL) ||
! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX)) {
// porto nel piano XY globale
pMyCompo->Scale( GLOB_FRM, 1, 1, 0) ;
// trasformo anche l'eventuale copia
if ( ! IsNull( pMyCompo2))
pMyCompo2->Scale( GLOB_FRM, 1, 1, 0) ;
// trasformo anche gli eventuali collegamenti
for ( auto& pLink : vMyLink)
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
}
// assegno tipo
string sOut = " <path" ;
@@ -402,6 +478,16 @@ ExportSvg::ExportArc( const string& sName, const Color& colObj, const IGeoObj* p
sOut +=GetStartString( pMyCompo) ;
// arco
sOut += GetCurveString( pMyCompo) ;
// eventuale curva copia per spessore
if ( ! IsNull( pMyCompo2)) {
sOut += GetStartString( pMyCompo2) ;
sOut += GetCurveString( pMyCompo2) ;
}
// eventuali collegamenti per spessore
for ( const auto& pLink : vMyLink) {
sOut += GetStartString( pLink) ;
sOut += GetCurveString( pLink) ;
}
// termino i dati geometrici
sOut += "\"" ;
// colore e spessore
@@ -425,6 +511,25 @@ ExportSvg::ExportBezier( const string& sName, const Color& colObj, const IGeoObj
if ( IsNull( pMyBez))
return false ;
pMyBez->ToGlob( frFrame) ;
// eventuali curve per spessore e collegamenti
PtrOwner<ICurveBezier> pMyBez2 ;
ICRVLINEPOVECTOR vMyLink ;
Vector3d vtExtr ; double dThick ;
if ( pBez->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
pBez->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
// curva sullo spessore
pMyBez2.Set( pBez->Clone()) ;
if ( IsNull( pMyBez2))
return false ;
pMyBez2->Translate( dThick * vtExtr) ;
pMyBez2->ToGlob( frFrame) ;
// collegamenti
for ( double dU = 0 ; dU < 1 + EPS_PARAM ; dU += 0.25) {
Point3d ptP ;
pBez->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
}
}
// verifico se la curva giace in un piano parallelo a XY globale
Plane3d plPlane ;
if ( ! pMyBez->IsFlat( plPlane, false, 10 * EPS_SMALL) ||
@@ -432,6 +537,12 @@ ExportSvg::ExportBezier( const string& sName, const Color& colObj, const IGeoObj
// la porto nel piano XY globale (se si riduce ad un punto la salto)
if ( ! pMyBez->Scale( GLOB_FRM, 1, 1, 0))
return true ;
// trasformo anche l'eventuale copia
if ( ! IsNull( pMyBez2))
pMyBez2->Scale( GLOB_FRM, 1, 1, 0) ;
// trasformo anche gli eventuali collegamenti
for ( auto& pLink : vMyLink)
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
}
// assegno tipo
string sOut = " <path" ;
@@ -443,6 +554,16 @@ ExportSvg::ExportBezier( const string& sName, const Color& colObj, const IGeoObj
sOut +=GetStartString( pMyBez) ;
// curva di Bezier
sOut += GetCurveString( pMyBez) ;
// eventuale curva copia per spessore
if ( ! IsNull( pMyBez2)) {
sOut += GetStartString( pMyBez2) ;
sOut += GetCurveString( pMyBez2) ;
}
// eventuali collegamenti per spessore
for ( const auto& pLink : vMyLink) {
sOut += GetStartString( pLink) ;
sOut += GetCurveString( pLink) ;
}
// termino i dati geometrici
sOut += "\"" ;
// colore e spessore
@@ -466,6 +587,42 @@ ExportSvg::ExportComposite( const string& sName, const Color& colObj, const IGeo
if ( IsNull( pMyCompo))
return false ;
pMyCompo->ToGlob( frFrame) ;
// eventuali curve per spessore e collegamenti
PtrOwner<ICurveComposite> pMyCompo2 ;
ICRVLINEPOVECTOR vMyLink ;
Vector3d vtExtr ; double dThick ;
if ( pCompo->GetExtrusion( vtExtr) && ! vtExtr.IsSmallXY() &&
pCompo->GetThickness( dThick) && abs( dThick) > EPS_SMALL) {
// curva sullo spessore
pMyCompo2.Set( pCompo->Clone()) ;
if ( IsNull( pMyCompo2))
return false ;
pMyCompo2->Translate( dThick * vtExtr) ;
pMyCompo2->ToGlob( frFrame) ;
// collegamenti
const ICurve* pSmpCrv = pCompo->GetFirstCurve() ;
while ( pSmpCrv != nullptr) {
// tipo di curva
int nType = pSmpCrv->GetType() ;
// step sui collegamenti a seconda del tipo
double dDelta = 1 ;
if ( nType == CRV_ARC)
dDelta = 0.5 ;
else if ( nType == CRV_BEZIER)
dDelta = 0.25 ;
// calcolo i collegamenti
for ( double dU = 0 ; dU < 1 - EPS_PARAM ; dU += dDelta) {
Point3d ptP ;
pSmpCrv->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
AddLink( ptP, vtExtr, dThick, frFrame, vMyLink) ;
}
// passo alla curva successiva
pSmpCrv = pCompo->GetNextCurve() ;
}
Point3d ptEnd ;
pCompo->GetEndPoint( ptEnd) ;
AddLink( ptEnd, vtExtr, dThick, frFrame, vMyLink) ;
}
// verifico se la curva giace in un piano parallelo a XY globale
Plane3d plPlane ;
if ( ! pMyCompo->IsFlat( plPlane, false, 10 * EPS_SMALL) ||
@@ -473,6 +630,12 @@ ExportSvg::ExportComposite( const string& sName, const Color& colObj, const IGeo
// la porto nel piano XY globale (se si riduce ad un punto la salto)
if ( ! pMyCompo->Scale( GLOB_FRM, 1, 1, 0))
return true ;
// trasformo anche l'eventuale copia
if ( ! IsNull( pMyCompo2))
pMyCompo2->Scale( GLOB_FRM, 1, 1, 0) ;
// trasformo anche gli eventuali collegamenti
for ( auto& pLink : vMyLink)
pLink->Scale( GLOB_FRM, 1, 1, 0) ;
}
// assegno tipo
string sOut = " <path" ;
@@ -484,6 +647,16 @@ ExportSvg::ExportComposite( const string& sName, const Color& colObj, const IGeo
sOut += GetStartString( pMyCompo) ;
// curva composita
sOut += GetCurveString( pMyCompo) ;
// eventuale curva copia per spessore
if ( ! IsNull( pMyCompo2)) {
sOut += GetStartString( pMyCompo2) ;
sOut += GetCurveString( pMyCompo2) ;
}
// eventuali collegamenti per spessore
for ( const auto& pLink : vMyLink) {
sOut += GetStartString( pLink) ;
sOut += GetCurveString( pLink) ;
}
// termino i dati geometrici
sOut += "\"" ;
// colore e spessore
@@ -533,7 +706,7 @@ ExportSvg::ExportFlatRegion( const string& sName, const Color& colObj, const IGe
if ( IsNull( pMyCompo))
return false ;
pMyCompo->AddCurve( Release( pLoop)) ;
pLoop.Set( Release( pMyCompo)) ;
pLoop.Set( pMyCompo) ;
}
pLoop->Scale( GLOB_FRM, 1, 1, 0) ;
}
@@ -601,7 +774,7 @@ ExportSvg::ExportTriMesh( const string& sName, const Color& colObj, const IGeoOb
continue ;
POLYLINEVECTOR vPL ;
if ( ! pStm->GetFacetLoops( nF, vPL))
return false ;
continue ;
// ciclo sui loop di una faccia
for ( int nL = 0 ; nL < int( vPL.size()) ; ++ nL) {
PtrOwner<ICurveComposite> pLoop( CreateCurveComposite()) ;
+2917 -2943
View File
File diff suppressed because it is too large Load Diff
+28 -34
View File
@@ -35,15 +35,14 @@ class ExportThreeJS : public IExportThreeJS
{
public:
virtual bool SetOptions( int nFilter) ;
virtual bool Export( IGeomDB* pGDB, int nId, const std::string& sFile, IEGrScene* pScene, bool bUdm) ;
virtual bool Export( IGeomDB* pGDB, int nId, IEGrScene* pScene, bool bUdm, const std::string& sFile) ;
public:
ExportThreeJS( void) : m_nFilter( EEXFLT_DEFAULT) {}
ExportThreeJS( void) : m_nFilter( EEXFLT_DEFAULT), m_bShowGrid( true), m_nGroupCount( -1), m_nCont( 0) {}
private:
bool CreateFolderSpace( const std::string& SFileName, const std::string& sUserPath, const std::string& sLibPath) ;
bool HeadAmbient( IEGrScene* pScene, IGeomDB* pGDB, int nId) ;
bool FinishAmbient() ;
bool FinishAmbient( void) ;
bool CompressAll( const std::string& sFile) ;
bool ExportVector3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
bool ExportPoint3D( const std::string& sName, const IGeoObj* pGeoObj, const Frame3d& frFrame, const Color& cCol, const int nIdGroup) ;
@@ -60,35 +59,30 @@ class ExportThreeJS : public IExportThreeJS
bool TestFilter( int nLev, int nMode, int nStat) ;
private:
int m_nFilter ; // filtro su livello, modo e stato
Writer m_Writer ; // scrittore di file di testo oggetto
std::string m_sUdm ; // udm della scena
Point3d m_ptMin ; // punto minimo del box3d
double m_dimX ; // dimX Box3d Global
double m_dimY ; // dimY Box3d Global
double m_dimZ ; // dimZ Box3d Global
double m_dDistance ; // scala per pan e zoom
int m_nCont = 0 ; // contatore per linee interne ai testi
Point3d m_ptCamera ; // Camera look at
Point3d m_ptCenter ; // Camera center
double m_dHalfWidth ; // Lunghezza/2 piano di proiezione (culling)
double m_dHalfHeight ; // Altezza/2 piano di proiezione (culling)
double m_ZNear ; // Distanza (lungo Z) piano di proiezione da origine (culling)
double m_ZFar ; // Distanza (lungo Z) piano di culling da origine (culling)
double m_dCameraPhi ; // [0,180] angolo phi in coordinate polari della telecamera
double m_dCameraTheta ; // [0, 360) angolo Theta in coordinate polari della telecamera
int m_ANG_TOL_STD_DEG = 15 ; // Interpolazione testo
Frame3d m_frTHREEJSFrame ; // frame di ThreeJS
std::list< sSurfDist> m_lTranspSurf ; // Lista di superfici trasparenti
int m_nGroupCount = -1 ; // Contatore del gruppo
int m_nFilter ; // Filtro su livello, modo e stato
Point3d m_ptMin ; // Punto minimo del box3d
double m_dimX ; // DimX Box3d Global
double m_dimY ; // DimY Box3d Global
double m_dimZ ; // DimZ Box3d Global
double m_dDistance ; // Scala per pan e zoom
Point3d m_ptCamera ; // Camera position
Point3d m_ptCenter ; // Camera look at
double m_dHalfWidth ; // Semilunghezza piano di proiezione (culling)
double m_dHalfHeight ; // Semialtezza piano di proiezione (culling)
double m_dZNear ; // Distanza (lungo Z) piano di proiezione da origine (culling)
double m_dZFar ; // Distanza (lungo Z) piano di culling da origine (culling)
double m_dCameraPhi ; // Angolo phi in coordinate polari della telecamera [0,180]
double m_dCameraTheta ; // Angolo Theta in coordinate polari della telecamera [0, 360)
Frame3d m_frTHREEJSFrame ; // Frame di ThreeJS
bool m_bShowGrid ; // Flag di esportazione griglia di scena
bool m_bUdm_mm ; // Flag unità di misura in mm
std::string m_sUdm ; // Stringa per unità di misura della scena
int m_nGroupCount ; // Contatore del gruppo
int m_nCont ; // contatore per linee interne ai testi
std::vector< sSurfDist> m_vTranspSurf ; // Vettore di superfici trasparenti
std::string m_sCodMenu ; // Stringa per la creazione del menu laterale della scena
Writer m_Writer ; // Scrittore di file di testo oggetto
// Parametri...
bool m_bShowGrid = true ; // se esportare o meno la griglia dalla scena
bool m_bUdm_mm ; // se l'unità di misura è in mm
std::string m_sPath ; // Path aggiuntivo dove salvare il file (il vero path è nel LUA)
public:
static std::string m_sThreeJSAuxDir ; // direttorio librerie
};
public :
static std::string m_sThreeJSLibDir ; // Direttorio librerie
} ;
+1 -3
View File
@@ -17,10 +17,8 @@
#include "stdafx.h"
#include "Import3MF.h"
#include "DllMain.h"
#include "pugixml.hpp"
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGkStmFromTriangleSoup.h"
#include "/EgtDev/Extern/libzip/Include/zip.h"
using namespace std ;
using namespace Lib3MF ;
@@ -30,7 +28,7 @@ IImport3MF*
CreateImport3MF( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImport3MF*> ( new( nothrow) Import3MF) ;
+1401
View File
File diff suppressed because it is too large Load Diff
+64
View File
@@ -0,0 +1,64 @@
//----------------------------------------------------------------------------
// EgalTech 2023
//----------------------------------------------------------------------------
// File : Import3dm.h Data : 23.06.23 Versione : 2.5f1
// Contenuto : Dichiarazione della classe Import3dm.
//
//
//
// Modifiche : 23.06.23 DB Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EExImport3dm.h"
#include "/EgtDev/Include/EGkSurf.h"
//#include "/EgtDev/opennurbs/opennurbs.h"
class ON_Point ;
class ON_4dPoint ;
class ON_3fPoint ;
class ON_Object ;
class ON_3dPoint ;
class ON_Curve ;
class ON_Surface ;
class ON_Brep ;
class ON_BrepLoop ;
class ON_3dVector ;
class ON_2dVector ;
class ON_NurbsSurface ;
class ICurve ;
class ICurveArc ;
class ICurveLine ;
class ISurf ;
class ISurfTriMesh ;
class ISurfFlatRegion ;
//----------------------------------------------------------------------------
class Import3dm : public IImport3dm
{
public :
bool Import( const std::string& sFile, IGeomDB* pGDB, int nIdGroup, double dScaleFactor = 1,
double dTextHeight = 2.0, double dExtLine = 5.0, double dArrLen = 5.0, double dTextDist = 2.0,
bool bLenIsMM = true, int nDecDig = -2, std::string sFont = "ModernPropS.Nfe") override ;
private :
Point3d ConvertPoint( const ON_Point& onPoint) ;
Point3d ConvertPoint( const ON_3dPoint& on3dPoint) ;
Point3d ConvertPoint( const ON_4dPoint& on4dPoint) ;
Point3d ConvertPoint( const ON_3fPoint& on3fPoint) ;
Vector3d ConvertVector( const ON_3dVector& onVector) ;
Vector3d ConvertVector( const ON_2dVector& onVector) ;
ICurve* ConvertCurve( const ON_Curve* onCurve) ;
ISurf* ConvertSurface( const ON_Surface* onSurf) ;
ISURFPVECTOR ConvertBrep( const ON_Brep* onBrep, const bool bForceTriMesh) ;
ICurve* ConvertBrepLoop( const ON_BrepLoop* onBrepLoop) ;
bool MakeUniform( ISurfFlatRegion** sfr, ON_NurbsSurface onNurbsSurface, double& dScaleU, double& dScaleV) ;
private :
IGeomDB* m_pGDB ;
int m_nIdGroup ;
double m_dScaleFactor ;
} ;
+34
View File
@@ -0,0 +1,34 @@
//----------------------------------------------------------------------------
// EgalTech 2023
//----------------------------------------------------------------------------
// File : Import3dmEnts.cpp Data : 27.06.23 Versione : 2.5f1
// Contenuto : Implementazione di Import3dm : gestione delle entità.
//
//
//
// Modifiche : 27.06.23 DB Creazione modulo.
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "Import3dm.h"
#include "DllMain.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkCurveAux.h"
#include "/EgtDev/Include/EGkCurveByInterp.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkGdbIterator.h"
#include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EgtStringEncoder.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
+13 -1
View File
@@ -39,7 +39,7 @@ IImportBtl*
CreateImportBtl( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPADV, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPADV))
return nullptr ;
// creo l'oggetto
return static_cast<IImportBtl*> ( new(nothrow) ImportBtl) ;
@@ -156,6 +156,9 @@ ImportBtl::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
m_BtlGeom.AdjustRefForRawParts() ;
m_BtlGeom.AdjustRefForComposites() ;
// verifica definizione e unicità SN ed eventuale sistemazione
m_BtlGeom.AdjustSnForParts() ;
// eventuale ordinamento degli oggetti secondo SN
bool bSort = (( nFlag & EIBFLAG_SORT) != 0) ;
if ( bSort) {
@@ -1230,6 +1233,9 @@ ImportBtl::GetParam( const string& sText, const string& sPar, string& sVal)
bool
ImportBtl::GetParamP( const string& sText, int nInd, int& nVal)
{
// verifico se dummy
if ( nInd < 0)
return true ;
// creo l'identificativo
string sPar = PAR_P + ToString( nInd, 2) ;
// leggo il parametro
@@ -1243,6 +1249,9 @@ ImportBtl::GetParamP( const string& sText, int nInd, int& nVal)
bool
ImportBtl::GetParamP( const string& sText, int nInd, double& dVal)
{
// verifico se dummy
if ( nInd < 0)
return true ;
// creo l'identificativo
string sPar = PAR_P + ToString( nInd, 2) ;
// leggo il parametro
@@ -1253,6 +1262,9 @@ ImportBtl::GetParamP( const string& sText, int nInd, double& dVal)
bool
ImportBtl::GetParamP( const string& sText, int nInd, string& sVal)
{
// verifico se dummy
if ( nInd < 0)
return true ;
// creo l'identificativo
string sPar = PAR_P + ToString( nInd, 2) ;
// leggo il parametro
+85 -182
View File
@@ -20,6 +20,7 @@
#include "/EgtDev/Include/EgtKeyCodes.h"
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
using namespace std ;
@@ -42,7 +43,7 @@ IImportBtlx*
CreateImportBtlx( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPADV, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPADV))
return nullptr ;
// creo l'oggetto
return static_cast<IImportBtlx*> ( new(nothrow) ImportBtlx) ;
@@ -83,7 +84,7 @@ ImportBtlx::Import( const string& sFile, IGeomDB* pGDB, int nFlag)
// inizializzo il documento
pugi::xml_document doc ;
pugi::xml_parse_result ParseResult = doc.load_file( sFile.c_str()) ;
pugi::xml_parse_result ParseResult = doc.load_file( stringtoW( sFile)) ;
if ( ! ParseResult) {
string sError = " Error parsing file : " ;
sError += ParseResult.description() ;
@@ -514,7 +515,6 @@ ImportBtlx::ReadPart( pugi::xml_node node)
}
// Outline
bool bOutLineOk = m_BtlGeom.UpdateOutLine() ;
if ( ! bOutLineOk ){
LOG_ERROR( GetEExLogger(), " Error reading Part : BtlGeom.UpdateOutLine error") ;
@@ -1085,15 +1085,15 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : ID missing") ;
return false ;
}
int id = node.attribute( "ID").as_int() ;
int nId = node.attribute( "ID").as_int() ;
if ( node.child( "Position") == nullptr) {
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : Position missing") ;
return false ;
}
Point3d Origin ;
Vector3d VectX, VectY ;
Point3d ptOrig ;
Vector3d vX, vY ;
// Origin
if ( node.child( "Position").child( "ReferencePoint") == nullptr ||
@@ -1104,9 +1104,9 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
return false ;
}
Origin.x = node.child( "Position").child( "ReferencePoint").attribute( "X").as_double() ;
Origin.y = node.child( "Position").child( "ReferencePoint").attribute( "Y").as_double() ;
Origin.z = node.child( "Position").child( "ReferencePoint").attribute( "Z").as_double() ;
ptOrig.x = node.child( "Position").child( "ReferencePoint").attribute( "X").as_double() ;
ptOrig.y = node.child( "Position").child( "ReferencePoint").attribute( "Y").as_double() ;
ptOrig.z = node.child( "Position").child( "ReferencePoint").attribute( "Z").as_double() ;
// VectX
if ( node.child( "Position").child( "XVector") == nullptr ||
@@ -1116,9 +1116,9 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : VectorX error") ;
return false ;
}
VectX.x = node.child( "Position").child( "XVector").attribute( "X").as_double() ;
VectX.y = node.child( "Position").child( "XVector").attribute( "Y").as_double() ;
VectX.z = node.child( "Position").child( "XVector").attribute( "Z").as_double() ;
vX.x = node.child( "Position").child( "XVector").attribute( "X").as_double() ;
vX.y = node.child( "Position").child( "XVector").attribute( "Y").as_double() ;
vX.z = node.child( "Position").child( "XVector").attribute( "Z").as_double() ;
// VectY
if ( node.child( "Position").child( "YVector") == nullptr ||
@@ -1128,26 +1128,28 @@ ImportBtlx::ReadUserReferencePlane( pugi::xml_node node)
LOG_ERROR( GetEExLogger(), " Error reading Part ReferencePlane : VectorY error") ;
return false ;
}
VectY.x = node.child( "Position").child( "YVector").attribute( "X").as_double() ;
VectY.y = node.child( "Position").child( "YVector").attribute( "Y").as_double() ;
VectY.z = node.child( "Position").child( "YVector").attribute( "Z").as_double() ;
vY.x = node.child( "Position").child( "YVector").attribute( "X").as_double() ;
vY.y = node.child( "Position").child( "YVector").attribute( "Y").as_double() ;
vY.z = node.child( "Position").child( "YVector").attribute( "Z").as_double() ;
Point3d ptOnX = Origin + 100 * VectX ;
Point3d ptOnY = Origin + 100 * VectY ;
Point3d ptOnX = ptOrig + 100 * vX ;
Point3d ptOnY = ptOrig + 100 * vY ;
Frame3d FrRef ;
FrRef.Set( Origin, ptOnX, ptOnY) ;
MapURefPlanes.emplace( id, FrRef) ;
Frame3d frRef ;
frRef.Set( ptOrig, ptOnX, ptOnY) ;
if ( ! frRef.IsValid()) {
LOG_ERROR( GetEExLogger(), ( " Error reading Part Process: User Reference Plane " + to_string( nId) + " is not valid").c_str()) ;
return false ;
}
m_mapRefPlanes.emplace( nId, frRef) ;
return true ;
}
//------------------------------------------------------------------------
bool
ImportBtlx::ReadProcessings( pugi::xml_node node)
{
int curve_counter = 1 ; // serve per free contour
{
int nProcId = 0 ; // conto le lavorazioni
// Scorro tutte le lavorazioni
@@ -1174,7 +1176,6 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
LOG_ERROR( GetEExLogger(), " Error reading Part Processing : missing name") ;
return false ;
}
sDes = it->attribute( "Name").value() ;
// Attributi comuni a tutti i processi:
@@ -1210,101 +1211,53 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
return false ;
}
// JackRafterCut
else if ( sProcessName == "JackRafterCut") {
else if ( sProcessName == "JackRafterCut")
bProcessOk = ReadJackRafterCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// LongitudinalCut
else if ( sProcessName == "LongitudinalCut") {
else if ( sProcessName == "LongitudinalCut")
bProcessOk = ReadLongitudinalCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// DoubleCut
else if ( sProcessName == "DoubleCut") {
else if ( sProcessName == "DoubleCut")
bProcessOk = ReadDoubleCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// RidgeValleyCut
else if ( sProcessName == "RidgeValleyCut") {
else if ( sProcessName == "RidgeValleyCut")
bProcessOk = ReadRidgeValleyCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// SawCut
else if ( sProcessName == "SawCut") {
else if ( sProcessName == "SawCut")
bProcessOk = ReadSawCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// Slot
else if ( sProcessName == "Slot") {
else if ( sProcessName == "Slot")
bProcessOk = ReadSlotParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// BirdsMouth
else if ( sProcessName == "BirdsMouth") {
else if ( sProcessName == "BirdsMouth")
bProcessOk = ReadBirdsMouthParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// HipValleyRafterNotch
else if ( sProcessName == "HipValleyRafterNotch") {
else if ( sProcessName == "HipValleyRafterNotch")
bProcessOk = ReadHipValleyRafterNotchParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// Lap
else if ( sProcessName == "Lap") {
else if ( sProcessName == "Lap")
bProcessOk = ReadLapParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// LogHouseHalfLap
else if ( sProcessName == "LogHouseHalfLap") {
else if ( sProcessName == "LogHouseHalfLap")
bProcessOk = ReadLogHouseHalfLapParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// FrenchRidgeLap
else if ( sProcessName == "FrenchRidgeLap") {
else if ( sProcessName == "FrenchRidgeLap")
bProcessOk = ReadFrenchRidgeLapParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// Chamfer
else if ( sProcessName == "Chamfer") {
else if ( sProcessName == "Chamfer")
bProcessOk = ReadChamferParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// LogHouseJoint
else if ( sProcessName == "LogHouseJoint") {
else if ( sProcessName == "LogHouseJoint")
bProcessOk = ReadLogHouseJointParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// LogHouseFront
else if ( sProcessName == "LogHouseFront") {
else if ( sProcessName == "LogHouseFront")
bProcessOk = ReadLogHouseFrontParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// Pocket
else if ( sProcessName == "Pocket") {
else if ( sProcessName == "Pocket")
bProcessOk = ReadPocketParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// Drilling
else if ( sProcessName == "Drilling") {
else if ( sProcessName == "Drilling")
bProcessOk = ReadDrillingParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// Tenon
else if ( sProcessName == "Tenon") {
bProcessOk = ReadTenonParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
@@ -1312,17 +1265,15 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
return false ;
bProcessOk = m_BtlGeom.AddTenonBTLX( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
bAdd = false ; // non devo aggiungere il processo una volta terminati questi if
if ( ! bProcessOk ){
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddTenonBTLX error")
return false ;
if ( ! bProcessOk) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddTenonBTLX error") ;
return false ;
}
}
// Moritse
else if ( sProcessName == "Mortise") {
else if ( sProcessName == "Mortise")
bProcessOk = ReadMortiseParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// House
else if ( sProcessName == "House") {
// I parametri sono quasi gli stessi di Tenon, quindi chiamo la stessa funzione
@@ -1335,7 +1286,7 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
bProcessOk = m_BtlGeom.AddTenonBTLX( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
bAdd = false ;
if ( ! bProcessOk ) {
if ( ! bProcessOk) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddHouseBTLX error") ;
return false ;
}
@@ -1343,7 +1294,7 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
// House contiene un tenon o un dovetailtenon :
pugi::xml_node housetenon = it->child( "Tenon") ;
pugi::xml_node housedtenon = it->child( "DovetailTenon") ;
if ( housetenon != nullptr){
if ( housetenon != nullptr) {
// Con GetProcessParamInfos viene fatto emplace_back sul vettore dei parametri quindi devono essere vuoti
vnDPar.clear() ; vdPar.clear() ; nSPar = 0 ; sPar.clear() ; vsUAtt.clear() ;
bProcessOk = ReadTenonParams( housetenon, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
@@ -1355,14 +1306,13 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
return false ;
}
}
if ( housedtenon != nullptr) {
vnDPar.clear() ; vdPar.clear() ; nSPar = 0 ; sPar.clear() ; vsUAtt.clear() ;
bProcessOk = ReadDovetailTenonParams( housedtenon, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
bProcessOk = m_BtlGeom.AddDovetailTenonBTLX( nGroup, nProc, nSide, "DovetailTenon", nProcId, vnDPar, vdPar, vsUAtt) ;
if ( ! bProcessOk ){
if ( ! bProcessOk) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddHouseBTLX error") ;
return false ;
}
@@ -1380,7 +1330,7 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
bAdd = false ;
if ( ! bProcessOk ){
if ( ! bProcessOk) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddMortiseBTLX error") ;
return false ;
}
@@ -1389,7 +1339,7 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
// House contiene una mortise/dovetailmortise :
pugi::xml_node housemortise = it->child( "Mortise") ;
pugi::xml_node housedtmortise = it->child( "DovetailMortise") ;
if ( housemortise != nullptr){
if ( housemortise != nullptr) {
vnDPar.clear() ; vdPar.clear() ; nSPar = 0 ; sPar.clear() ; vsUAtt.clear() ;
bProcessOk = ReadMortiseParams( housemortise, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
@@ -1406,20 +1356,17 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
if ( ! bProcessOk)
return false ;
bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, "DovetailMortise", nProcId, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
if ( ! bProcessOk ){
if ( ! bProcessOk) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddMortiseBTLX error") ;
return false ;
}
}
}
// DovetailTenon
else if ( sProcessName == "DovetailTenon") {
// I parametri sono quasi gli stessi di Mortise, quindi chiamo la stessa funzione
bProcessOk = ReadDovetailTenonParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
bProcessOk = m_BtlGeom.AddDovetailTenonBTLX( nGroup, nProc, nSide, sDes, nProcId, vnDPar, vdPar, vsUAtt) ;
bAdd = false ; // non devo aggiungere il processo una volta terminati questi if
if ( ! bProcessOk ){
@@ -1428,128 +1375,84 @@ ImportBtlx::ReadProcessings( pugi::xml_node node)
}
}
// DovetailMortise
else if ( sProcessName == "DovetailMortise") {
// I parametri sono quasi gli stessi di Mortise, quindi chiamo la stessa funzione
else if ( sProcessName == "DovetailMortise")
bProcessOk = ReadDovetailMortiseParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
bAdd = false ; // non devo aggiungere il processo una volta terminati questi if
if ( ! bProcessOk ){
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddDovetailMortiseBTLX error") ;
return false ;
}
}
// Marking
else if ( sProcessName == "Marking") {
bProcessOk = ReadMarkingParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
else if ( sProcessName == "Marking")
bProcessOk = ReadMarkingParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
// Text
else if ( sProcessName == "Text") {
else if ( sProcessName == "Text")
bProcessOk = ReadTextParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// SimpleScarf
else if ( sProcessName == "SimpleScarf") {
else if ( sProcessName == "SimpleScarf")
bProcessOk = ReadSimpleScarfParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// ScarfJoint
else if ( sProcessName == "ScarfJoint") {
else if ( sProcessName == "ScarfJoint")
bProcessOk = ReadScarfJointParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// StepJoint
else if ( sProcessName == "StepJoint") {
else if ( sProcessName == "StepJoint")
bProcessOk = ReadStepJointParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// StepJointNotch
else if ( sProcessName == "StepJointNotch") {
else if ( sProcessName == "StepJointNotch")
bProcessOk = ReadStepJointNotchParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// Planing
else if ( sProcessName == "Planing") {
LOG_ERROR( GetEExLogger(), " Warning reading Part Process: Planing ignored") ;
//bProcessOk = ReadPlaningParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
//if ( ! bProcessOk)
// return false ;
}
// ProfileFront
else if ( sProcessName == "ProfileFront") {
else if ( sProcessName == "ProfileFront")
bProcessOk = ReadProfileFrontParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// ProfileCambered
else if ( sProcessName == "ProfileCambered") {
else if ( sProcessName == "ProfileCambered")
bProcessOk = ReadProfileCamberedParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// RoundArch
else if ( sProcessName == "RoundArch") {
else if ( sProcessName == "RoundArch")
bProcessOk = ReadRoundArchParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// ProfileHead
else if ( sProcessName == "ProfileHead") {
else if ( sProcessName == "ProfileHead")
bProcessOk = ReadProfileHeadParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// Sphere
else if ( sProcessName == "Sphere") {
LOG_ERROR( GetEExLogger(), " Warning reading Part Process: Sphere ignored") ;
//bProcessOk = ReadSphereParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
//if ( ! bProcessOk)
// return false ;
// bProcessOk = ReadSphereParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
}
// TriangleCut
else if ( sProcessName == "TriangleCut") {
else if ( sProcessName == "TriangleCut")
bProcessOk = ReadTriangleCutParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// TyroleanDovetail
else if ( sProcessName == "TyroleanDovetail") {
else if ( sProcessName == "TyroleanDovetail")
bProcessOk = ReadTyroleanDovetailParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// Dovetail
else if ( sProcessName == "Dovetail") {
else if ( sProcessName == "Dovetail")
bProcessOk = ReadDovetailParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bProcessOk)
return false ;
}
// FreeContour
else if ( sProcessName == "FreeContour") {
bProcessOk = ReadFreeContourParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar, curve_counter, vsUAtt) ;
if ( ! bProcessOk)
return false ;
bProcessOk = ReadFreeContourParams( *it, vsUAtt) ;
bAdd = false ;
}
// Aggiungo il processo
if ( bProcessOk && bAdd) {
if ( ! bProcessOk)
return false ;
// aggiungo il processo
if ( bAdd) {
// se riferimento non è una delle facce, lo recupero da UserReferencePlanes
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_RIGHT) {
// se non esiste, errore
if ( m_mapRefPlanes.find( nSide) == m_mapRefPlanes.end()) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: Reference Plane unknown") ;
return false ;
}
frRef = m_mapRefPlanes[nSide] ;
}
bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nProcId, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
if ( ! bProcessOk ) {
if ( ! bProcessOk) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddProcess error") ;
return false ;
}
}
nProcId ++ ;
} // end sui sottonodi di Processings
+6 -7
View File
@@ -115,17 +115,16 @@ public :
DBLVECTOR& vdPar, std::string& sPar) ;
bool ReadDovetailParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide, INTVECTOR& vnDPar, int& nSPar,
DBLVECTOR& vdPar, std::string& sPar) ;
bool ReadFreeContourParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide, INTVECTOR& vnDPar, int& nSPar,
DBLVECTOR& vdPar, std::string& sPar, int& curve_counter, STRVECTOR& vsUAtt) ;
bool ReadSContourParams( pugi::xml_node process, int nType, int nOtherId, int& nGroup, int& nProc, int& nSide,
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar, int& curve_counter, STRVECTOR& vsUAtt) ;
bool ReadDContourParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar, int& curve_counter, STRVECTOR& vsUAtt) ;
bool ReadFreeContourParams( pugi::xml_node process, const STRVECTOR& vsUAtt) ;
bool ReadSContourParams( pugi::xml_node process, int nType, int nOtherId, int nGroup, int nProc, int nSide, bool bCounterSink,
int& nCrvCnt, const STRVECTOR& vsUAtt) ;
bool ReadDContourParams( pugi::xml_node process, int nGroup, int nProc, int nSide, bool bCounterSink,
int& nCrvCnt, const STRVECTOR& vsUAtt) ;
private :
BtlGeom m_BtlGeom ; // gestore geometria pezzi Btl
std::string m_sVersion ; // versione btlx
std::unordered_map< int, Frame3d> MapURefPlanes ;
std::unordered_map< int, Frame3d> m_mapRefPlanes ;
} ;
+95 -102
View File
@@ -990,8 +990,8 @@ ImportBtlx::ReadDovetailTenonParams( pugi::xml_node process, int& nGroup, int& n
vdPar[9] *= 2 ;
vdPar[6] = dWidth - vdPar[9] * ( 1 - sin( vdPar[7] * DEGTORAD)) / cos( vdPar[7] * DEGTORAD) ; // P09
if ( vdPar[6] < 0 ) {
LOG_ERROR( GetEExLogger(), " Error : Dovetail tenon width")
return false ;
LOG_ERROR( GetEExLogger(), " Error : Dovetail tenon width") ;
return false ;
}
}
else {
@@ -1029,19 +1029,17 @@ ImportBtlx::ReadDovetailMortiseParams( pugi::xml_node process, int& nGroup, int&
return false ;
}
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
// Riempio i vettori dei parametri vdPar, se qualche valore non ci fosse lascio quello di default
vdPar[0] = Clamp( ReadProcessChild( process, "StartX", vdPar[0]), -100000.0, 100000.0) ; // P01
vdPar[1] = Clamp( ReadProcessChild( process, "StartY", vdPar[1]), -50000.0, 50000.0) ; // P02
vdPar[2] = Clamp( ReadProcessChild( process, "StartDepth", vdPar[2]), 0.0, 50000.0) ; // P03
vdPar[3] = ReadProcessChildBool( process, "LengthLimitedBottom", 0, true) ; // P04
vdPar[5] = Clamp( ReadProcessChild( process, "Angle", vdPar[5]), -180.0, 180.0) ; // P06
double dWidth = Clamp( ReadProcessChild( process, "Width", 40.0), 0.0, 1000.0) ;
vdPar[8] = Clamp( ReadProcessChild( process, "ConeAngle", vdPar[8]), 0.1, 179.9) ; // P16
vdPar[8] = Clamp( ReadProcessChild( process, "ConeAngle", vdPar[8]), 0.1, 179.9) ; // P10
vdPar[9] = Clamp( ReadProcessChild( process, "Depth", vdPar[9]), 0.0, 1000.0) ; // P11
vdPar[10] = Clamp( ReadProcessChild( process, "ShapeRadius", vdPar[10]), 0.0, 1000.0) ; // P10
vdPar[10] = Clamp( ReadProcessChild( process, "ShapeRadius", vdPar[10]), 0.0, 1000.0) ; // P12
vdPar[11] = Clamp( ReadProcessChild( process, "Length", vdPar[11]), 0.0, 50000.0) ; // P13
// P04
string sLimitationTop = process.child( "LimitationTop").text().get() ; // P05
if ( sLimitationTop == "unlimited")
@@ -1063,10 +1061,10 @@ ImportBtlx::ReadDovetailMortiseParams( pugi::xml_node process, int& nGroup, int&
vdPar[10] = MILL_DEF_RAD ;
vdPar[10] *= 2 ; // P12
vdPar[7] = dWidth - vdPar[10] * ( 1 - sin( vdPar[8] * DEGTORAD)) / cos( vdPar[8] * DEGTORAD) ; // P09
if ( vdPar[7] < 0 ) {
if ( vdPar[7] < - EPS_SMALL) {
LOG_ERROR( GetEExLogger(), " Error : Dovetail mortise width") ;
return false ;
}
}
}
else {
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Dovetail mortise Shape is unknown") ;
@@ -1952,60 +1950,47 @@ ImportBtlx::ReadDovetailParams( pugi::xml_node process, int& nGroup, int& nProc,
//---------------------------------------------------------------------------------------------------------------------------
bool
ImportBtlx::ReadFreeContourParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar, int& curve_counter, STRVECTOR& vsUAtt)
ImportBtlx::ReadFreeContourParams( pugi::xml_node process, const STRVECTOR& vsUAtt)
{
// Identifico il processo con sigle usate nel btl
nProc = 250 ;
nSide = process.attribute( "ReferencePlaneID").as_int() ;
// identifico il processo con sigle usate nel btl
int nProc = 250 ;
int nSide = process.attribute( "ReferencePlaneID").as_int() ;
string sToolPosition = process.attribute( "ToolPosition").value() ;
int nGroup = 0 ;
if ( sToolPosition == "left")
nGroup = 3 ;
else if (sToolPosition == "center")
nGroup = 0 ;
else if (sToolPosition == "right")
else if ( sToolPosition == "right")
nGroup = 4 ;
else {
else if ( sToolPosition != "center") {
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: Free Contour group not defined") ;
return false ;
}
// Inizializzo i vettori dei parametri
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it ++ ) {
// recupero parametri del free contour
bool bCounterSink = false ;
string sCounterSink = process.attribute( "CounterSink").value() ;
if ( sCounterSink == "yes")
bCounterSink = true ;
else if ( sCounterSink == "no")
bCounterSink = false ;
else {
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FreeContour CounterSink is wrong") ;
return false ;
}
// Reinizializzo i contenitori dei parametri
vnDPar.clear() ; nSPar = 0 ; vdPar.clear() ; sPar.clear() ;
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bParamsInfoOk) {
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
return false ;
}
if ( vdPar.size() != 14) {
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FreeContour number of parameters is wrong") ;
return false ;
}
int nCrvCnt = 1 ;
// scrorro i contours
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it ++) {
string sCounterSink = process.attribute( "CounterSink").value() ;
if ( sCounterSink == "yes")
vdPar[5] = 1 ;
else if ( sCounterSink == "no")
vdPar[5] = 0 ;
else {
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FreeContour CounterSink is wrong") ;
return false ;
}
// Studio i nodi
string itName = it->name() ;
bool bContOk = true ;
if ( itName == "Contour") {
bContOk = ReadSContourParams( *it, 0, 0, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar, curve_counter, vsUAtt) ;
bContOk = ReadSContourParams( *it, 0, 0, nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
if ( ! bContOk)
return false ;
}
else if ( itName == "DualContour") {
bContOk = ReadDContourParams( *it, nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar, curve_counter, vsUAtt) ;
bContOk = ReadDContourParams( *it, nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
if ( ! bContOk)
return false ;
}
@@ -2020,45 +2005,73 @@ ImportBtlx::ReadFreeContourParams( pugi::xml_node process, int& nGroup, int& nPr
//---------------------------------------------------------------------------------------------------------------------------
bool
ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId, int& nGroup, int& nProc, int& nSide,
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, string& sPar, int& curve_counter, STRVECTOR& vsUAtt)
ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId, const int nGroup, const int nProc, const int nSide,
bool bCounterSink, int& nCrvCnt, const STRVECTOR& vsUAtt)
{
// Parametri propri del contour che non cambiano
// recupero eventuale riferimento da UserReferencePlanes
Frame3d frRef ;
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_RIGHT) {
// se non esiste, errore
if ( m_mapRefPlanes.find( nSide) == m_mapRefPlanes.end()) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Reference Plane unknown") ;
return false ;
}
frRef = m_mapRefPlanes[nSide] ;
if ( ! frRef.IsValid()) {
LOG_ERROR( GetEExLogger(), (" Error reading Part Process: FreeContour User Reference Plane " + to_string( nSide) + " is not valid").c_str()) ;
return false ;
}
}
// inizializzo i parametri
INTVECTOR vnDPar ;
int nSPar ;
DBLVECTOR vdPar ;
string sPar ;
bool bParamsInfoOk = m_BtlGeom.GetProcessParamInfos( nGroup, nProc, nSide, vnDPar, nSPar, vdPar, sPar) ;
if ( ! bParamsInfoOk) {
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: BtlGeom.GetProcessParamInfos") ;
return false ;
}
if ( vdPar.size() != 14) {
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: FreeContour number of parameters is wrong") ;
return false ;
}
// parametri propri del contour che non cambiano
vdPar[5] = bCounterSink ? 1 : 0 ;
string sDepthBounded = process.attribute( "DepthBounded").value() ;
if ( sDepthBounded == "no")
vdPar[3] = 0 ;
else
vdPar[3] = process.attribute( "Depth").as_double() ;
int contour_counter = 0 ;
vdPar[3] = process.attribute( "Depth").as_double() ;
int nContourCnt = 0 ;
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it++)
contour_counter ++ ;
nContourCnt ++ ;
int i = 0 ;
for ( pugi::xml_node_iterator it = process.begin() ; it != process.end() ; it++) {
// Reinizializzo i parametri
// reinizializzo i parametri
vdPar[0] = 0.0 ; vdPar[1] = 0.0 ; vdPar[2] = 0.0 ; vdPar[6] = 0.0 ; vdPar[8] = 0.0 ; vdPar[9] = 0.0 ; vdPar[10] = 0.0 ;
vdPar[4] = process.attribute( "Inclination").as_double() ;
vdPar[4] = it->attribute( "Inclination").as_double() ;
i++ ;
if ( i != contour_counter)
vdPar[7] = curve_counter + 1 ;
if ( i != nContourCnt)
vdPar[7] = nCrvCnt + 1 ;
else
vdPar[7] = 0 ;
string sName = it->name() ;
// START POINT
// Start Point
if ( sName == "StartPoint") {
vdPar[6] = nType ;
if ( nType == 100 || nType == 101) { // salvo id del contour associato
if ( nType == 100 || nType == 101) // salvo id del contour associato
vdPar[4] = nOtherId ;
}
if ( it->attribute( "X") == nullptr || it->attribute( "Y") == nullptr || it->attribute( "Z") == nullptr){
if ( it->attribute( "X") == nullptr || it->attribute( "Y") == nullptr || it->attribute( "Z") == nullptr) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour StartPoint component missing") ;
return false ;
}
@@ -2067,16 +2080,16 @@ ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId,
vdPar[2] = it->attribute( "Z").as_double() ;
}
// LINE
// Line
else if ( sName == "Line") {
vdPar[6] = 1 ;
if ( it->child( "EndPoint") == nullptr){
if ( it->child( "EndPoint") == nullptr) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Line EndPoint missing") ;
return false ;
}
if ( it->child( "EndPoint").attribute( "X") == nullptr ||it->child( "EndPoint").attribute( "Y") == nullptr ||
it->child( "EndPoint").attribute( "Z") == nullptr){
if ( it->child( "EndPoint").attribute( "X") == nullptr || it->child( "EndPoint").attribute( "Y") == nullptr ||
it->child( "EndPoint").attribute( "Z") == nullptr) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Line EndPoint component missing") ;
return false ;
}
@@ -2085,7 +2098,7 @@ ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId,
vdPar[2] = it->child( "EndPoint").attribute( "Z").as_double() ;
}
// ARC
// Arc
else if ( sName == "Arc") {
vdPar[6] = 2 ;
@@ -2112,36 +2125,19 @@ ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId,
vdPar[8] = it->child( "PointOnArc").attribute( "X").as_double() ;
vdPar[9] = it->child( "PointOnArc").attribute( "Y").as_double() ;
vdPar[10] = it->child( "PointOnArc").attribute( "Z").as_double() ;
}
else {
LOG_ERROR ( GetEExLogger(), " Error reading Part Process: FreeContour Contour element unknown") ;
return false ;
}
Frame3d frRef ;
// Se riferimento non è una delle facce, lo cerco fra UserReferencePlanes
if ( nSide < BTL_SIDE_FRONT || nSide > BTL_SIDE_RIGHT) {
// se non esiste, errore
if ( MapURefPlanes.find( nSide) == MapURefPlanes.end()) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: FreeContour Contour Reference Plane unknown") ;
return false ;
}
frRef = MapURefPlanes[nSide] ;
if ( ! frRef.IsValid()) {
LOG_ERROR( GetEExLogger(), (" Error reading Part Process: FreeContour User Reference Plane " + to_string( nSide) + " is not valid").c_str()) ;
return false ;
}
}
string sDes ;
bool bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, curve_counter, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
bool bProcessOk = m_BtlGeom.AddProcess( nGroup, nProc, nSide, sDes, nCrvCnt, frRef, vnDPar, nSPar, vdPar, sPar, vsUAtt, 0) ;
if ( ! bProcessOk) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: BtlGeom.AddProcess error") ;
return false ;
}
curve_counter ++ ;
nCrvCnt ++ ;
}
return true ;
@@ -2149,39 +2145,36 @@ ImportBtlx::ReadSContourParams( pugi::xml_node process, int nType, int nOtherId,
//---------------------------------------------------------------------------------------------------------------------------
bool
ImportBtlx::ReadDContourParams( pugi::xml_node process, int& nGroup, int& nProc, int& nSide,
INTVECTOR& vnDPar, int& nSPar, DBLVECTOR& vdPar, std::string& sPar, int& curve_counter, STRVECTOR& vsUAtt)
ImportBtlx::ReadDContourParams( pugi::xml_node process, const int nGroup, const int nProc, const int nSide, bool bCounterSink,
int& nCrvCnt, const STRVECTOR& vsUAtt)
{
if ( process.child( "PrincipalContour") == nullptr || process.child( "AssociatedContour") == nullptr) {
LOG_ERROR( GetEExLogger(), " Error reading Part Process: DualContour contour missing") ;
return false ;
}
// Principal Contour
int nPrincipalId = curve_counter + 1 ;
int nPrincipalContCurves = 0 ;
// conto il numero di curve nel PrincipalContour
// principal contour
int nPrincipalId = nCrvCnt + 1 ;
int nPrincipalCrvCnt = 0 ;
// numero di curve nel principal contour
for ( pugi::xml_node_iterator it = process.child( "PrincipalContour").child( "Contour").begin() ;
it != process.child( "PrincipalContour").child( "Contour").end() ; it ++)
nPrincipalContCurves ++ ;
it != process.child( "PrincipalContour").child( "Contour").end() ; it ++)
nPrincipalCrvCnt ++ ;
bool bContourOk = ReadSContourParams( process.child( "PrincipalContour"), 100, curve_counter + nPrincipalContCurves,
nGroup, nProc, nSide, vnDPar, nSPar,vdPar, sPar, curve_counter, vsUAtt) ;
bool bContourOk = ReadSContourParams( process.child( "PrincipalContour"), 100, nCrvCnt + nPrincipalCrvCnt,
nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
if ( ! bContourOk)
return false ;
// Associated Contour
// associated Contour
bContourOk = ReadSContourParams( process.child( "AssociatedContour"), 101, nPrincipalId,
nGroup, nProc, nSide, vnDPar, nSPar,vdPar, sPar, curve_counter, vsUAtt) ;
nGroup, nProc, nSide, bCounterSink, nCrvCnt, vsUAtt) ;
if ( ! bContourOk)
return false ;
return true ;
}
// -------------------------------------------------------------------------------------------------------------
// ------------------------- Funzioni ausiliarie ----------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------
@@ -2249,7 +2242,7 @@ ReadProcessChildBool( const pugi::xml_node& process, const string& sChild, const
return 1 ;
}
// se sValue fosse empty o valore non ammesso restituisco valore di default
// se sValue fosse empty o valore non ammesso restituisco valore di default
return nDefaultVal ;
}
+13 -4
View File
@@ -23,6 +23,7 @@
#include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkArcSpecial.h"
#include "/EgtDEv/Include/EGnScanner.h"
#include "/EgtDev/Include/SELkKeyProc.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
@@ -52,7 +53,7 @@ IImportCnc*
CreateImportCnc( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportCnc*> ( new(nothrow) ImportCnc) ;
@@ -170,7 +171,7 @@ ImportCnc::ProcessLine( const string& sLine)
return ParseRemark( sLine) ;
// altre linee da saltare
if ( sLine[0] == '$' || sLine[0] == '!')
if ( sLine[0] == '$' || sLine[0] == '!' || ( sLine[0] == 'M' && sLine[1] == 'S' && sLine[2] == 'G'))
return true ;
// eliminazione di commenti intermedi o finali
@@ -498,6 +499,12 @@ ImportCnc::ParseG( const string& sToken)
m_bAbsCoord = false ;
break ;
}
// per saltare le macro custom su NUM (tipo G101... di S3)
if ( m_nCNC == CNC_NUM && nVal > 99) {
m_nCommand = NO_CMD ;
m_nMoveType = RAPID ;
m_bZeroMach = true ;
}
return true ;
}
@@ -995,7 +1002,8 @@ ImportCnc::AddArc( bool bCCW)
switch ( VerifyArcCenter( vtN)) {
case A_ARC :
// punti estremi e centro
if ( ! pCrvArc->SetC2PN( m_ptCen, m_ptLast, m_ptNext, vtN))
pCrvArc.Set( GetArc2PCN( m_ptLast, m_ptNext, m_ptCen, vtN)) ;
if ( IsNull( pCrvArc))
return false ;
// verifico senso di rotazione
if ( ( bCCW && pCrvArc->GetAngCenter() < 0) ||
@@ -1323,7 +1331,8 @@ ImportCnc::PostProcess( void)
int nNextId = m_pGDB->GetNext( nId) ;
// estraggo la curva e la accodo alla composita
ICurve* pCrv = GetCurve( m_pGDB->RemoveGeoObjAndErase( nId)) ;
pCompo->AddCurve( pCrv) ;
if ( ! pCompo->AddCurve( pCrv, true, 10 * EPS_SMALL))
return false ;
// passo alla successiva
nId = nNextId ;
// se G40 termino la composita
+1 -1
View File
@@ -62,7 +62,7 @@ IImportCsf*
CreateImportCsf( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportCsf*> ( new(nothrow) ImportCsf) ;
+1 -1
View File
@@ -30,7 +30,7 @@ IImportDxf*
CreateImportDxf( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportDxf*> ( new(nothrow) ImportDxf) ;
+2 -2
View File
@@ -1378,7 +1378,7 @@ ImportDxf::ReadPoint( bool& bFileEnd)
if ( ! pGeoPnt->Set( ptP))
return false ;
// lo passo all'oggetto geometrico generico
pGeoObj.Set( Release( pGeoPnt)) ;
pGeoObj.Set( pGeoPnt) ;
}
else {
// creo il vettore con punto base
@@ -1389,7 +1389,7 @@ ImportDxf::ReadPoint( bool& bFileEnd)
if ( ! pGeoVect->Set( dThick * vtExtr, ptP))
return false ;
// lo passo all'oggetto geometrico generico
pGeoObj.Set( Release( pGeoVect)) ;
pGeoObj.Set( pGeoVect) ;
}
// inserisco l'entità nel DB
int nId = m_pGDB->AddGeoObj( GDB_ID_NULL, GetGroupId( sLayer), Release( pGeoObj)) ;
+1 -1
View File
@@ -28,7 +28,7 @@ IImportPnt*
CreateImportPnt( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportPnt*> ( new(nothrow) ImportPnt) ;
+1 -1
View File
@@ -34,7 +34,7 @@ IImportStl*
CreateImportStl( void)
{
// verifico la chiave e le opzioni
if ( ! GetEExNetHwKey() && ! TestKeyForEEx( GetEExKey(), KEYOPT_EEX_INPBASE, GetEExLogger()))
if ( ! VerifyKey( KEYOPT_EEX_INPBASE))
return nullptr ;
// creo l'oggetto
return static_cast<IImportStl*> ( new(nothrow) ImportStl) ;
+1
View File
@@ -34,5 +34,6 @@
#pragma comment(lib, EGTLIBDIR "SEgtLock" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "/libzip/Lib/zip" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "/lib3mf/Lib/lib3mf" EGTLIBVER ".lib")
#pragma comment(lib, EGTEXTDIR "/opennurbs/Lib/opennurbs_public" EGTLIBVER ".lib")