Page 5 - Demo
P. 5


                                    Planar Truss Examplefor ComrelAdd-onRCPConsult, 2021-2025Page 5Y={n,n,n,n};c=Cos[theta[[e]]];s=Sin[theta[[e]]];x=(XY[[IEN[[e,1]],1]]+XY[[IEN[[e,2]],1]])/2;y=(XY[[IEN[[e,1]],2]]+XY[[IEN[[e,2]],2]])/2;Xrot=X*cY*s+x;Yrot=X*s+Y*c+y;If[NN[[e]]>=0,co=RGBColor[1.0,0.6,0.5],co=RGBColor[0.5,0.6,1.0]];If[Abs[NN[[e]]]<0.000001,Nn=0,Nn=NN[[e]]];BarN[[e]]={EdgeForm[{Thin,Gray}],co,Polygon[{{Xrot[[1]],Yrot[[1]]},{Xrot[[2]],Yrot[[2]]},{Xrot[[3]],Yrot[[3]]},{Xrot[[4]],Yrot[[4]]}}]};AN[[e]]=Text[Style[Row[{ToString[N[Nn]],\{x,y},Center];];base={BarN,AN};ep={};,3,(*# plot set #3 *)tit=Text[Style[Row[{\18],{14,6},Center];BarS=Array[0&,nfe];(*! polygon for each bar *)AS=Array[0&,nfe];(*! text for each bar *)minA=Min[Abs[NN/area*1*^6]];maxA=Max[Abs[NN/area*1*^6]];(*! plot for internal member Von Mises stress *)dA=maxA-minA;For[e=1,e<=nfe,e++,Su=Abs[NN[[e]]/area[[e]]*1*^-6];l=leng[[e]]/2;n=Su/dA*0.25;X={l,l,l,l};Y={-n,-n,n,n};c=Cos[theta[[e]]];s=Sin[theta[[e]]];x=(XY[[IEN[[e,1]],1]]+XY[[IEN[[e,2]],1]])/2;y=(XY[[IEN[[e,1]],2]]+XY[[IEN[[e,2]],2]])/2;Xrot=X*c-Y*s+x;Yrot=X*s+Y*c+y;co=jet[(Su-minA)/(maxA-minA)];If[Su <0.000001,Su=0];BarS[[e]]={EdgeForm[{Thin,Gray}],Opacity[0.7],co,Polygon[{{Xrot[[1]],Yrot[[1]]},{Xrot[[2]],Yrot[[2]]},{Xrot[[3]],Yrot[[3]]},{Xrot[[4]],Yrot[[4]]}}]};AS[[e]]=Text[Style[ToString[NumberForm[Su,{10,0}]],11],{x,y},Center];];base={BarS,AS};(*! Color bar *)vr=BarLegend[{jet[Rescale[#,{minA,maxA}]]&,{minA,maxA}}];ep=Epilog>Inset[vr,{Right,Center},{Right,Center}];];(*# plot values of input data *)A1p=Text[Style[Row[{\{23.5,4.5},Left];A2p=Text[Style[Row[{\{23.5,4.2},Left];E1p=Text[Style[Row[{\>(Row[{#1,\{23.5,3.9},Left];E2p=Text[Style[Row[{\>(Row[{#1,\{23.5,3.6},Left];T1p=Text[Style[StrurelName<>\16],{0.5,5},Left];(*! main title of plot *)If[StrurelMode==0,T2Pt=\(*! input data at state of mean values *)T3Pt=\T2Pt=StrurelIMET<>\(*! input data at betapoint *)T3Pt=\(*! calculated beta and Pf *)T2p=Text[Style[T2Pt,12],{0.5,4.6},Left];T3p=Text[T3Pt,{0.5,4.3},Left];TSe=Text[Style[StrurelEngine,8],{0.1,0.9},Left];(*! Process a plot mode *)StrurelPlotCount++;If[StrurelPlotMode==2,df=Identity;,df=$DisplayFunction;];(*! Show a plot *)Fig=Show[Graphics[{tit,base,A1p,A2p,E1p,E2p,T1p,T2p,T3p,TSe}],PlotLabel->Style[title,24],Axes->True,PlotRange->{{0,28},{-1,7}},AspectRatio->8/28,GridLines>Automatic,GridLinesStyle>Directive[LightGray,Dashed],Frame>True,ep,ImageSize->{gm[0]/3,gm[1]/3}];(*! Save a plot *)(*! https://mathematica.stackexchange.com/questions/172192/how-to-correctly-export-image-for-grid-of-plot-in-high-resolution *)If[StrurelPlotMode>1,Export[StrurelPlotName<>ToString[StrurelPlotCount]<>StrurelPlotType,Fig,DisplayFunction->df,ImageResolution->150];];];];];(*! end of plot block *)(*# Return value of script (Module) *)a[[8]](*! vertical deflection at bottom center (N04) *)];(*# Procedure to create \jet[u_?NumericQ]:=Blend[{{0,RGBColor[0,0,9/16]},{1/9,Blue},{23/63,Cyan},{13/21,Yellow},{47/63,Orange},{55/63,Red},{1,RGBColor[1/2,0,0]}},u]/;0<=u<=1;
                                
   1   2   3   4   5   6   7   8   9   10