TestEgr :

- aggiunta gestione importazione CNC.
This commit is contained in:
Dario Sassi
2014-09-18 15:01:06 +00:00
parent c1a168571c
commit bd41a4e01d
+29 -7
View File
@@ -27,10 +27,11 @@
#include "/EgtDev/Include/EExExcExecutor.h"
#include "/EgtDev/Include/EGrScene.h"
#include "/EgtDev/Include/EGrSceExecutor.h"
#include "/EgtDev/Include/EExImportStl.h"
#include "/EgtDev/Include/EExImportCnc.h"
#include "/EgtDev/Include/EExImportDxf.h"
#include "/EgtDev/Include/EExExportStl.h"
#include "/EgtDev/Include/EExImportStl.h"
#include "/EgtDev/Include/EExExportDxf.h"
#include "/EgtDev/Include/EExExportStl.h"
using namespace std ;
@@ -291,8 +292,8 @@ CTestEGrDlg::OnInitDialog( void)
if ( ! FileOpen( m_sFileToOpen))
AfxMessageBox( L"Error loading file (look at Log file)", MB_ICONSTOP|MB_OK) ;
}
// importo DXF o STL
else if ( sExt == "DXF" || sExt == "STL") {
// importo CNC o DXF o STL
else if ( sExt == "CNC" || sExt == "DXF" || sExt == "STL") {
if ( ! FileImport( m_sFileToOpen))
AfxMessageBox( L"Error importing file (look at Log file)", MB_ICONSTOP|MB_OK) ;
}
@@ -774,7 +775,8 @@ CTestEGrDlg::OnFileImport( void)
OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR,
L"All Files (*.*)|*.*|"
L"AutoCAD Drawing Exchange (*.dxf) |*.dxf|"
L"Stereolithography (*.stl) |*.stl||",
L"Stereolithography (*.stl) |*.stl|"
L"Part Program (*.cnc) |*.cnc||",
NULL, 0, FALSE) ;
// imposto il direttorio iniziale
@@ -1192,7 +1194,7 @@ CTestEGrDlg::FileImport( const string& sFilePath)
ToUpper( sFileExt) ;
// verifico che l'estensione sia supportata
if ( sFileExt != "DXF" && sFileExt != "STL") {
if ( sFileExt != "CNC" && sFileExt != "DXF" && sFileExt != "STL") {
// emetto info
string sInfo = "File type (" + sFileExt + ") not recognized" ;
LOG_INFO( m_pLogGen, sInfo.c_str())
@@ -1211,8 +1213,28 @@ CTestEGrDlg::FileImport( const string& sFilePath)
ClearTree() ;
// reinizializzazione (con pulizia) del DB geometrico
PrepareGeomDB() ;
// importo il file CNC
if ( sFileExt == "CNC") {
// aggiungo un gruppo pezzo
int nPartId = m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
// preparo l'importatore
PtrOwner<IImportCnc> pImpCnc( CreateImportCnc()) ;
if ( IsNull( pImpCnc)) {
LOG_ERROR( m_pLogGen, "Error : CreateImportCnc")
return false ;
}
// eseguo l'importazione
if ( ! pImpCnc->Import( sFilePath, m_pGeomDB, nPartId)) {
LoadTree() ;
return false ;
}
// log dei comandi
LOG_INFO( m_pLogCmd, "RESET( $P1)")
LOG_INFO( m_pLogCmd, "GR.XY( $P1, $ROOT, ORIG)")
LOG_INFO( m_pLogCmd, ( "IMPORTCNC( " + sFilePath + ", $P1)").c_str())
}
// importo il file DXF
if ( sFileExt == "DXF") {
else if ( sFileExt == "DXF") {
// aggiungo un gruppo pezzo
int nPartId = m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, Frame3d()) ;
// preparo l'importatore