1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00
ski 4084fb643c 0025387: Error appears during export to STEP operation in ImportExport MFC sample
Combo-box for selection of translation mode is available in Export to STEP and CSFDB files.
Default valuer for STEP export mode is set to As Is, i.e. automatic selection.

Added #define in function CFileDialog because it takes only 6 parameters in Visual Studio 2005.
2014-10-30 12:12:56 +03:00

92 lines
2.3 KiB
C++
Executable File

// FileSaveStepDialog.cpp : implementation file
//
#include "stdafx.h"
#include "SaveSTEPDlg.h"
/////////////////////////////////////////////////////////////////////////////
// CFileSaveSTEPDialog dialog
CFileSaveSTEPDialog::CFileSaveSTEPDialog(CWnd* pParent /*=NULL*/)
: CFileDialog(FALSE,_T("*.STEP"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
_T("STEP Files (*.step)|*.step;|STEP Files (*.stp)|*.stp;||"),
pParent
#if (_MSC_VER < 1500)
)
#else
,0,0)
#endif
//dlg.m_ofn.lpstrInitialDir = initdir;
{
//{{AFX_DATA_INIT(CFileSaveSTEPDialog)
m_Cc1ModelType = STEPControl_AsIs;
//}}AFX_DATA_INIT
CString CASROOTValue;
CASROOTValue.GetEnvironmentVariable (L"CASROOT");
CString initdir = (CASROOTValue + "\\..\\data\\step");
m_ofn.lpstrInitialDir = initdir;
m_ofn.Flags |= OFN_ENABLETEMPLATE;
m_ofn.lpTemplateName = MAKEINTRESOURCE(CFileSaveSTEPDialog::IDD);
m_ofn.lpstrTitle = _T("Save as STEP File");
}
void CFileSaveSTEPDialog::DoDataExchange(CDataExchange* pDX)
{
CFileDialog::DoDataExchange(pDX);
if (!pDX->m_bSaveAndValidate)
{
m_DialogType = m_Cc1ModelType;
}
//{{AFX_DATA_MAP(CFileSaveSTEPDialog)
DDX_Control(pDX, IDC_FSaveSTEP_Type, m_SaveTypeCombo);
DDX_CBIndex(pDX, IDC_FSaveSTEP_Type, m_DialogType );
//}}AFX_DATA_MAP
if (pDX->m_bSaveAndValidate)
{
m_Cc1ModelType = (STEPControl_StepModelType)m_DialogType;
}
}
BEGIN_MESSAGE_MAP(CFileSaveSTEPDialog, CFileDialog)
//{{AFX_MSG_MAP(CFileSaveSTEPDialog)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFileSaveSTEPDialog message handlers
BOOL CFileSaveSTEPDialog::OnInitDialog()
{
BOOL bRet = CFileDialog::OnInitDialog();
m_SaveTypeCombo.InsertString(-1, L"As Is");
m_SaveTypeCombo.InsertString(-1, L"Manifold Solid BRep");
m_SaveTypeCombo.InsertString(-1, L"BRep With Voids");
m_SaveTypeCombo.InsertString(-1, L"Faceted BRep");
m_SaveTypeCombo.InsertString(-1, L"Faceted BRep With Voids");
m_SaveTypeCombo.InsertString(-1, L"Shell Based Surface Model");
m_SaveTypeCombo.InsertString(-1, L"Geometric Curve Set");
m_SaveTypeCombo.SetCurSel(m_DialogType);
return bRet;
}
BOOL CFileSaveSTEPDialog::OnFileNameOK()
{
ASSERT_VALID(this);
UpdateData(TRUE);
// Do not call Default() if you override
return FALSE;
}