哈工大材料力学编程完美UI版.docx
- 文档编号:23179511
- 上传时间:2023-05-15
- 格式:DOCX
- 页数:16
- 大小:231.01KB
哈工大材料力学编程完美UI版.docx
《哈工大材料力学编程完美UI版.docx》由会员分享,可在线阅读,更多相关《哈工大材料力学编程完美UI版.docx(16页珍藏版)》请在冰豆网上搜索。
哈工大材料力学编程完美UI版
材料力学上机编程作业
专业:
机械制造及其自动化
班级:
xxxxxxxx
姓名:
xxx
学号:
xxxxxxxxx
邮箱:
xxxxxxxxxxxxxx
运行界面如下。
功能:
可求解简支梁任意载荷下的任意点弯矩挠度、及作出弯矩挠曲图:
Release版本大小1.39MB。
里面包括六个页面,既编程作业的六题!
运行时桌面如下:
部分代码有:
void__fastcallTc1:
:
cl_5_b_okClick(TObject*Sender)
{
if(cl_5_inp_a->Enabled==false)
{
Application->MessageBoxA("你必须先用ADD添加的作用!
","Erro!
__Bykai",MB_OK);
}
else
{
if(cl_5_inp_a->Modified==false||cl_5_inp_f->Modified==false)
{
Application->MessageBoxA("你需要先输入受作用参数","Erro!
__Bykai",MB_OK);
}
/*
elseif(StrToFloat(cl_5_inp_a->Text)>StrToFloat(cl_5_inp_x->Text))
{
Application->MessageBoxA("a必须要小于L","Erro!
__Bykai",MB_OK);
}
*/
elseif(cl_5_rb_f->Checked==true)
{
//5-1
//Application->MessageBoxA("5-1","Erro!
__Bykai",MB_OK);
/*
intls_a=StrToInt(cl_5_zushu->Caption);
ls_a+=1;
cl_5_zushu->Caption=IntToStr(ls_a);
*/
cl_f5.insert_f(StrToFloat(cl_5_inp_a->Text),StrToFloat(cl_5_inp_f->Text));
cl_5_zushu->Caption=IntToStr(1+StrToInt(cl_5_zushu->Caption));
cl_5_inp_a->Text="输入F成功";
cl_5_inp_c->Text="";
cl_5_inp_f->Text="点击ADD继续";
cl_5_inp_a->Enabled=false;
cl_5_inp_c->Enabled=false;
cl_5_inp_f->Enabled=false;
}
elseif(cl_5_rb_mk->Checked==true)
{
//5-2
cl_mk5.insert_f(StrToFloat(cl_5_inp_a->Text),StrToFloat(cl_5_inp_f->Text));
cl_5_zushu->Caption=IntToStr(1+StrToInt(cl_5_zushu->Caption));
cl_5_inp_a->Text="输入Mk成功";
cl_5_inp_c->Text="";
cl_5_inp_f->Text="点击ADD继续";
cl_5_inp_a->Enabled=false;
cl_5_inp_c->Enabled=false;
cl_5_inp_f->Enabled=false;
}
else
{
if(cl_5_inp_c->Modified==false)
{
Application->MessageBoxA("请输入C","Erro!
__Bykai",MB_OK);
}
//5-3
else{
cl_q5.insert_f(StrToFloat(cl_5_inp_a->Text),StrToFloat(cl_5_inp_c->Text),StrToFloat(cl_5_inp_f->Text));
cl_5_zushu->Caption=IntToStr(1+StrToInt(cl_5_zushu->Caption));
cl_5_inp_a->Text="输入Q成功";
cl_5_inp_c->Text="";
cl_5_inp_f->Text="点击ADD继续";
cl_5_inp_a->Enabled=false;
cl_5_inp_c->Enabled=false;
cl_5_inp_f->Enabled=false;
}
}
}
}
//---------------------------------------------------------------------------
void__fastcallTc1:
:
cl_5_b_solClick(TObject*Sender)
{
if(cl_5_inp_e->Modified==false||cl_5_inp_iz->Modified==false||cl_5_inp_l->Modified==false)
{
Application->MessageBoxA("请输入杆的参数E、Iz、L!
","Erro!
__Bykai",MB_OK);
}
elseif(cl_5_inp_x->Modified==false)
{
Application->MessageBoxA("请输入你需要求的距左端X处","Erro!
__Bykai",MB_OK);
}
elseif(StrToFloat(cl_5_inp_x->Text)<0||(StrToFloat(cl_5_inp_x->Text)>StrToFloat(cl_5_inp_l->Text)))
{
Application->MessageBoxA("猪头!
x不在合理范围内(0 __Bykai",MB_OK); } else { floatcl_iz=StrToFloat(cl_5_inp_iz->Text); floatcl_e=StrToFloat(cl_5_inp_e->Text); floatfl_5_l=StrToFloat(cl_5_inp_l->Text); floatfl_5_x=StrToFloat(cl_5_inp_x->Text); //doublels_m=0,ls_v=0; cl_f5.current=cl_f5.head->next; while(cl_f5.current! =NULL) { //cl_f5.current=cl_f5.head->next; { ls_m+=m_caculate_f(cl_iz,cl_e,cl_f5.current->a,fl_5_l,fl_5_x,cl_f5.current->f); ls_v+=v_caculate_f(cl_iz,cl_e,cl_f5.current->a,fl_5_l,fl_5_x,cl_f5.current->f); } cl_f5.current=cl_f5.current->next; } cl_mk5.current=cl_mk5.head->next; while(cl_mk5.current! =NULL) { //cl_mk5.current=cl_mk5.head->next; { ls_m+=m_caculate_m(cl_iz,cl_e,cl_mk5.current->a,fl_5_l,fl_5_x,cl_mk5.current->mk); ls_v+=v_caculate_m(cl_iz,cl_e,cl_mk5.current->a,fl_5_l,fl_5_x,cl_mk5.current->mk); } cl_mk5.current=cl_mk5.current->next; } cl_q5.current=cl_q5.head->next; while(cl_q5.current! =NULL) { //cl_q5.current=cl_q5.head->next; { ls_m+=m_caculate_q(cl_iz,cl_e,cl_q5.current->a,cl_q5.current->c,fl_5_l,fl_5_x,cl_q5.current->q); ls_v+=v_caculate_q(cl_iz,cl_e,cl_q5.current->a,cl_q5.current->c,fl_5_l,fl_5_x,cl_q5.current->q); } cl_q5.current=cl_q5.current->next; } cl_5_outp_m->Text=FloatToStr(ls_m); cl_5_outp_v->Text=FloatToStr(ls_v); /// }} 实现小数点,正负的输入(不会出现字母其他字符) bool_fastcallTc1: : DotInStr(AnsiStringass) {intii,ll; ll=ass.Length(); for(ii=0;ii {if(ass.c_str()[ii]=='.') { returntrue; }} returnfalse; } bool__fastcallTc1: : SignInStr(AnsiStringass) {if(ass.Length()==0) {returntrue; }returnfalse; } 作弯矩,挠度图功能代码: void__fastcallTc1: : cl_5_pClick(TObject*Sender) { //if(cl_5_outp_m->Text=="") if(cl_5_inp_e->Text==""||cl_5_inp_iz->Text==""||cl_5_inp_l->Text=="")//||cl_5_inp_x->Text=="") { Application->MessageBoxA("请完成输入后再点击画图! ","Erro! __Bykai",MB_OK); } else { c1->Canvas->Refresh(); //c1->Canvas->~TCanvas(); intcl_5_m_x=500; intcl_5_m_y=96; intcl_5_v_x=500; intcl_5_v_y=300; c1->Constraints->MaxWidth=490; c1->Constraints->MinWidth=740;//490 //c1->Canvas->Brush->Color=clWhite; { c1->Canvas->Pen->Color=clWhite; c1->Canvas->Pen->Width=2; c1->Canvas->MoveTo(cl_5_m_x,cl_5_m_y); c1->Canvas->LineTo(200+cl_5_m_x,cl_5_m_y); c1->Canvas->MoveTo(cl_5_v_x,cl_5_v_y); c1->Canvas->LineTo(200+cl_5_v_x,cl_5_v_y); c1->Canvas->Pen->Color=clWhite; c1->Canvas->Pen->Width=3; c1->Canvas->MoveTo(cl_5_m_x,cl_5_m_y); c1->Canvas->LineTo(cl_5_m_x+10,cl_5_m_y+10); c1->Canvas->LineTo(cl_5_m_x-10,cl_5_m_y+10); c1->Canvas->LineTo(cl_5_m_x,cl_5_m_y); c1->Canvas->MoveTo(cl_5_m_x+200,cl_5_m_y); c1->Canvas->LineTo(cl_5_m_x+10+200,cl_5_m_y+10); c1->Canvas->LineTo(cl_5_m_x-10+200,cl_5_m_y+10); c1->Canvas->LineTo(cl_5_m_x+200,cl_5_m_y); c1->Canvas->Pen->Width=0; c1->Canvas->MoveTo(cl_5_v_x,cl_5_v_y); c1->Canvas->Pen->Width=3; c1->Canvas->LineTo(cl_5_v_x+10,cl_5_v_y+10); c1->Canvas->LineTo(cl_5_v_x-10,cl_5_v_y+10); c1->Canvas->LineTo(cl_5_v_x,cl_5_v_y); c1->Canvas->Pen->Width=0; c1->Canvas->MoveTo(cl_5_v_x+200,cl_5_v_y); c1->Canvas->Pen->Width=3; c1->Canvas->LineTo(cl_5_v_x+10+200,cl_5_v_y+10); c1->Canvas->LineTo(cl_5_v_x-10+200,cl_5_v_y+10); c1->Canvas->LineTo(cl_5_v_x+200,cl_5_v_y); } doubledb_5_m_max=0; doubledb_5_v_max=0; { floatcl_iz=StrToFloat(cl_5_inp_iz->Text); floatcl_e=StrToFloat(cl_5_inp_e->Text); floatfl_5_l=StrToFloat(cl_5_inp_l->Text); //floatfl_5_x=0;//=StrToFloat(cl_5_inp_x->Text); //doublels_m=0,ls_v=0; for(floatfl_5_x=0;fl_5_x<=fl_5_l;fl_5_x+=(fl_5_l/400)) { //doublels_m=0,ls_v=0; ls_m=0; ls_v=0; cl_f5.current=cl_f5.head->next; while(cl_f5.current! =NULL) { //cl_f5.current=cl_f5.head->next; { ls_m+=m_caculate_f(cl_iz,cl_e,cl_f5.current->a,fl_5_l,fl_5_x,cl_f5.current->f); ls_v+=v_caculate_f(cl_iz,cl_e,cl_f5.current->a,fl_5_l,fl_5_x,cl_f5.current->f); } cl_f5.current=cl_f5.current->next; } cl_mk5.current=cl_mk5.head->next; while(cl_mk5.current! =NULL) { //cl_mk5.current=cl_mk5.head->next; { ls_m+=m_caculate_m(cl_iz,cl_e,cl_mk5.current->a,fl_5_l,fl_5_x,cl_mk5.current->mk); ls_v+=v_caculate_m(cl_iz,cl_e,cl_mk5.current->a,fl_5_l,fl_5_x,cl_mk5.current->mk); } cl_mk5.current=cl_mk5.current->next; } cl_q5.current=cl_q5.head->next; while(cl_q5.current! =NULL) { { ls_m+=m_caculate_q(cl_iz,cl_e,cl_q5.current->a,cl_q5.current->c,fl_5_l,fl_5_x,cl_q5.current->q); ls_v+=v_caculate_q(cl_iz,cl_e,cl_q5.current->a,cl_q5.current->c,fl_5_l,fl_5_x,cl_q5.current->q); } cl_q5.current=cl_q5.current->next; } if(ls_m>db_5_m_max) { db_5_m_max=ls_m; } if(ls_v>db_5_v_max) { db_5_v_max=ls_v; } } } floatcl_5_px; floatcl_5_l=StrToFloat(cl_5_inp_l->Text); intcl_n=0; floatls_m_prev=0; floatls_v_prev=0; //c1->Canvas->LineTo(cl_5_m_x,cl_5_m_y); for(cl_5_px=0;cl_5_px<=cl_5_l;cl_5_px+=cl_5_l/100) { cl_n++; floatcl_iz=StrToFloat(cl_5_inp_iz->Text); floatcl_e=StrToFloat(cl_5_inp_e->Text); floatfl_5_l=StrToFloat(cl_5_inp_l->Text); floatfl_5_x=cl_5_px;//StrToFloat(cl_5_inp_x->Text); ls_m=0; ls_v=0; cl_f5.current=cl_f5.head->next; while(cl_f5.current! =NULL) { //cl_f5.current=cl_f5.head->next; { ls_m+=m_caculate_f(cl_iz,cl_e,cl_f5.current->a,fl_5_l,fl_5_x,cl_f5.current->f); ls_v+=v_caculate_f(cl_iz,cl_e,cl_f5.current->a,fl_5_l,fl_5_x,cl_f5.current->f); } cl_f5.current=cl_f5.current->next; } cl_mk5.current=cl_mk5.head->next; while(cl_mk5.current! =NULL) { //cl_mk5.current=cl_mk5.head->next; { ls_m+=m_caculate_m(cl_iz,cl_e,cl_mk5.current->a,fl_5_l,fl_5_x,cl_mk5.current->mk); ls_v+=v_caculate_m(cl_iz,cl_e,cl_mk5.current->a,fl_5_l,fl_5_x,cl_mk5.current->mk); } cl_mk5.current=cl_mk5.current->next; } cl_q5.current=cl_q5.head->next; while(cl_q5.current! =NULL) { //cl_q5.current=cl_q5.head->next; { ls_m+=m_caculate_q(cl_iz,cl_e,cl_q5.current->a,cl_q5.current->c,fl_5_l,fl_5_x,cl_q5.current->q); ls_v+=v_caculate_q(cl_iz,cl_e,cl_q5.current->a,cl_q5.current->c,fl_5_l,fl_5_x,cl_q5.current->q); } cl_q5.current=cl_q5.current->next; } c1->Canvas->Pen->Width=1; if(db_5_m_max! =0) { c1->Canvas->MoveTo(cl_5_m_x+2*cl_n-2,cl_5_m_y+30*ls_m_prev/db_5_m_max); c1->Canvas->LineTo(cl_5_m_x+2*cl_n,cl_5_m_y+30*ls_m/db_5_m_max); } if(db_5_v_max! =0) { c1->Canvas->MoveTo(cl_5_v_x+2*cl_n-2,cl_5_v_y+20*ls_v_prev/db_5_v_max); c1->Canvas->LineTo(cl_5_v_x+2*cl_n,cl_5_v_y+20*ls_v/db_5_v_max); } /* c1->Canvas->Pen->Width=1; c1->Canvas->LineTo(cl_5_v_x+2*cl_n,cl_5_v_y+20*ls_v/db_5_v_max); */ ls_m_prev=ls_m; ls_v_prev=ls_v; } } }
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 哈工大 材料力学 编程 完美 UI