www.pudn.com > roll.rar > Rolldlg1.cpp


// bbemDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
 
#include "roll.h" 
#include "bbroll.h" 
#include "figure.h" 
#include "rollDlg.h" 
#include "dynamic.h" 
#include "curve2d.h" 
#include "geomwnd.h" 
#include "dynpara.h" 
#include "bgridwnd.h" 
#include "curve2dw.h" 
#include "rigidity.h" 
#include "postfigure.h" 
#include "inputstring.h" 
#include "biemparameter.h" 
#include "inputdatafile.h" 
#include "inputtwostring.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CBbemDlg dialog 
 
void CBbemDlg::OnRollerfiguer()  
{ 
	if(bEditing) return; 
	if(m_pGeomWnd==NULL) return; 
	if(m_pGeomWnd->m_hWnd==NULL) { 
		m_pGeomWnd->CreateEx(0, 
			strGeomWndClass, 
			"Corrugating Roller Figure", 
			WS_OVERLAPPEDWINDOW, 
			0,0,420,350,m_hWnd, 
			NULL,NULL); 
		m_pGeomWnd->ShowWindow(SW_SHOWNORMAL); 
		} 
	m_pGeomWnd->BringWindowToTop(); 
	m_pGeomWnd->UpdateWindow(); 
} 
 
void CBbemDlg::OnCutboundaryelement()  
{ 
	int sp=theRoll.m_ActPoint; 
	if(bEditing) return; 
	CBiemParameter BiemDlg(this,2*(m_LINSEG+m_ARCSEG)-1); 
	if(BiemDlg.DoModal()==IDCANCEL) { 
		theRoll.m_ActPoint=sp; 
		return; 
	} 
	theRoll.m_ActPoint=BiemDlg.m_ActPoint; 
	theRoll.m_force=BiemDlg.m_force; 
	theRoll.m_Press=BiemDlg.m_Press; 
	theRoll.m_Rotate=BiemDlg.m_Rotate; 
	theRoll.m_InnTemperature=BiemDlg.m_InnTemperature; 
	theRoll.m_OutTemperature=BiemDlg.m_OutTemperature; 
	theRoll.m_Young=BiemDlg.m_Young; 
	theRoll.m_Poisson=BiemDlg.m_Poisson; 
	theRoll.m_Thermal=BiemDlg.m_Thermal; 
	theRoll.m_Weight=BiemDlg.m_Weight; 
	if(!theRoll.WriteLoadsParameters(this)) return; 
	BeginWaitCursor(); 
	theRoll.CutToothBoundary(this); 
	EndWaitCursor(); 
	MessageBox("The roller boundary elements have been formed !", 
		"Information",MB_OK|MB_ICONINFORMATION); 
} 
 
void CBbemDlg::OnGridfigure()  
{ 
	if(bEditing) return; 
	if(m_pBgridWnd==NULL) return; 
	CString string="Input the cut BEM Result data file name:"; 
	CInputString Input(string); 
	Input.m_String=m_pBgridWnd->m_pFigure->GetFileName(); 
	if(Input.DoModal()==IDCANCEL) return; 
	if(Input.m_String.IsEmpty()) return; 
	m_pBgridWnd->m_pFigure->SetFileName(Input.m_String); 
	if(m_pBgridWnd->m_hWnd==NULL) { 
		m_pBgridWnd->CreateEx(0, 
			strGeomWndClass, 
			"Corrugating Roller Boundary Grid Figure", 
			WS_OVERLAPPEDWINDOW, 
			0,0,420,350,m_hWnd, 
			NULL,NULL); 
		m_pBgridWnd->ShowWindow(SW_SHOWNORMAL); 
		} 
	m_pBgridWnd->BringWindowToTop(); 
	m_pBgridWnd->UpdateWindow(); 
} 
 
void CBbemDlg::OnContactanalysis()  
{ 
	if(bEditing) return; 
	char CommandLine[150]; 
	CStdioFile f; 
	double st; 
	CInputdatafile Input; 
	Input.m_file=file; 
	if(Input.DoModal()==IDCANCEL) return; 
	strcpy(file,(LPCTSTR)Input.m_file); 
	st=(theRoll.m_OutTemperature-theRoll.m_InnTemperature)/(theRoll.RCENOUT-theRoll.m_thick); 
	sprintf(CommandLine,"d:\\bbiem\\bbiem.exe %s %s %1d %8.3f %8.3f 0.0 0.0 %10.5f %10.5f", 
		BEMGRIDDATA,file,Input.m_YesNo,theRoll.m_InnTemperature,theRoll.m_OutTemperature,theRoll.m_thick,theRoll.m_tthick); 
	if(!f.Open("bbiem.bat",CFile::modeCreate|CFile::modeWrite|CFile::typeText)) { 
		//MessageBox("Unable create nodal coordinates data file","Error"); 
		return; 
	} 
	f.WriteString( CommandLine ); 
	f.Close(); 
//	WinExec(CommandLine,SW_SHOWMAXIMIZED); 
} 
 
void CBbemDlg::OnDisplacementfigure()  
{ 
	if(bEditing) return; 
	if(m_pPostFigure==NULL) return; 
	CString string("Input the BIEM Result File Name:"); 
	CInputString Input(string); 
	Input.m_String=m_pPostFigure->ExitFileName; 
	if(Input.DoModal()==IDCANCEL) return; 
	string=Input.GetString(); 
	if(string.IsEmpty()) return; 
	m_pPostFigure->OpenBIEMDatatFile(string); 
	if(m_pPostFigure->m_hWnd==NULL) { 
		m_pPostFigure->CreateEx(0, 
			strGeomWndClass, 
			string, 
			WS_OVERLAPPEDWINDOW, 
			0,0,450,400,m_hWnd, 
			NULL,NULL); 
		m_pPostFigure->ShowWindow(SW_SHOWNORMAL); 
		} 
	else { 
		m_pPostFigure->InvalidateRect(NULL); 
		m_pPostFigure->SetWindowText(string); 
	} 
	m_pPostFigure->BringWindowToTop(); 
	m_pPostFigure->UpdateWindow(); 
} 
 
void CBbemDlg::OnRigidity() 
{ 
	if(bEditing) return; 
	CString string1("Input the BIEM Result File Name:"); 
	CString string2("Input the Rigidity Data File Name:"); 
	CInputTwoString Input(string1,string2); 
	if(Input.DoModal()==IDCANCEL) return; 
	string1=Input.GetString1(); 
	if(string1.IsEmpty()) return; 
	CRigidity Rigidity(string1,Input.GetString2()); 
	if(Rigidity.CalcRigidity_Deform()) 
		MessageBox("The Rigidity data file has been generated !","OK"); 
	else 
		MessageBox("The Rigidity data file can not been generated !","ERROR"); 
} 
 
CCurve2D My_Curve; 
void CBbemDlg::OnViewcurve()  
{ 
	if(bEditing) return; 
	if(m_pCurve2DW==NULL) return; 
	CString string("Input the Curve(s) Data File Names:"); 
	CInputString Input(string); 
	Input.m_String=My_Curve.filename; 
	if(Input.DoModal()==IDCANCEL) return; 
	string=Input.GetString(); 
	if(string.IsEmpty()) return; 
	if(!My_Curve.ReadDataFile(string)) { 
		MessageBox("Can't open the curve(s) data file!","Error",MB_ICONQUESTION|MB_OK); 
		if(m_pCurve2DW->m_hWnd!=NULL) m_pCurve2DW->DestroyWindow(); 
		return; 
	} 
	if(m_pCurve2DW->m_hWnd==NULL) { 
		m_pCurve2DW->CreateEx(0, 
			strGeomWndClass, 
			"Curve Figure", 
			WS_OVERLAPPEDWINDOW, 
			0,0,450,400,m_hWnd, 
			NULL,NULL); 
		m_pCurve2DW->ShowWindow(SW_SHOWNORMAL); 
		} 
	else { 
		m_pCurve2DW->InvalidateRect(NULL); 
		m_pCurve2DW->BringWindowToTop(); 
	} 
	m_pCurve2DW->UpdateWindow(); 
} 
 
void CBbemDlg::OnMaxdiam() 
{ 
/*	if(bEditing) return; 
	if(m_pDynamic==NULL) return; 
	int ret; 
	CDynPara dynpara; 
	if(dynpara.DoModal()==IDCANCEL) return; 
	ret=m_pDynamic->SetTeethData(dynpara); 
	if(ret==1) { 
		MessageBox("You Must Change the parameters !","Error", 
			MB_ICONQUESTION|MB_OK); 
		return; 
	} 
	ret=m_pDynamic->DynamicAnalysis( this ); 
	if(ret==0) 
		MessageBox("Create the Data File 'ddyn.dat' !","OK", 
			MB_ICONQUESTION|MB_OK); 
	else if(ret==1) 
		MessageBox("Unable to Create the Data File 'ddyn.dat' !","Error", 
			MB_ICONQUESTION|MB_OK);	 
	else 
		MessageBox("You MUST Increase the Driving Moment !","Error", 
			MB_ICONQUESTION|MB_OK);	 
*/}