当前位置:网站首页>ANSYS secondary development - MFC interface calls ADPL file

ANSYS secondary development - MFC interface calls ADPL file

2022-07-28 16:34:00 CaeCoder

Development process

ANSYS-MFC The idea of secondary development is actually very simple , Usually MFC Mainly design interface , And then from MFC Read the parameters to be designed in the interface , Then, according to these set parameters, generate APDL Code , Then call ANSYS Batch processing function , So as to complete the specific program solution . Of course, after the solution , Can also be ANSYS The calculation results are displayed in the interface , So as to complete the finite element parametric model calculation software for a specific model . The specific process is shown in the figure below .

 Insert picture description here

Developing code

 The most commonly used controls for the functions of interface design are nothing more than buttons 、 The text box 、 The drop-down list 、 Picture display and other functions , Complete the trigger function of data and function , No introduction here .
 Then according to the content of parameter settings , Generate apdl Language , And store it in a text document , for example “file.dat”
 Open in batch ANSYS.
// Calculate button 
void ModelSim::OnBnClickedButton10()
{
    
	ModelList.DeleteAllItems();
	DeleteTempFile();// Delete result 

	CString WorkOut = WorkDir +_T("\\Model.out");
	CString path_2 = AnsysDir + _T(" -b -p ane3fl -dir ")+ WorkDir +_T(" -i ")  + WorkPath + _T(" -o ") + WorkOut;
	string path(CT2A(path_2.GetString()));

	WinExec(path.data(),SW_MINIMIZE);// Start 
}

among ,

  • AnsysDir by Ansys directory , for example C:\Program Files\ANSYS Inc\v180\ansys\bin\winx64\ANSYS180.exe
  • WorkDir by Ansys Working directory of , namely ansys Directory of simulation project , for example C:\Users\15321\Desktop\test
  • WorkPath by file.dat directory , for example C:\Users\15321\Desktop\test\file.dat
  • WorkOut by file.out directory , for example C:\Users\15321\Desktop\test\file.out

Reprinted from : https://www.cnblogs.com/gaozihan/p/10844007.html
Original author : Having both ability and political integrity
Date of publication : 2019-05-10


   Scan the QR code below to follow my wechat official account - CAE Second development of software Lab, Read more about !

CAE Second development of software Lab
原网站

版权声明
本文为[CaeCoder]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/209/202207281523121313.html