Page 5 - Demo
P. 5


                                    Planar Truss Example for Comrel Add-on RCP Consult, 2021-2025 Page 5 else co:=[0.5,0.6,1.0]: end if: BarN[e]:=polygon([seq(convert(pp[..,i],list),i=1..4)],color=Color(co),thickness=0.5): # rectangle along bar AV[e]:=textplot([x,y,`` || (sprintf(\|| ``]): # value of force N end do: # Plot set #2 PlotS:=[seq(BarN[i],i=1..nfe),seq(AV[i],i=1..nfe)]: elif np = 3 then PlotT:=textplot([12.5,6.,typeset(\__v,\ # Plot for internal member with von Mises stress BarS:=Array(1..nfe): # polygon for each bar AS:=Array(1..nfe): # text for each bar pp:=Matrix(2,4): # polygon points  nco:=21: cm:=Jet(nco): # jet colormap minA:=min(abs(ElementDivide(N, Area)*1e-6)): maxA:=max(abs(ElementDivide(N, Area)*1e-6)): ddA:=maxA-minA: dA:=ddA/(nco-1): for e to nfe do Su:=abs(N[e]/Area[e]*1e-6): l:=leng[e]/2: n:=Su/ddA*0.2: X:=Array([-l, l, l, -l]): Y:=Array([-n, -n, n, n]): c:=cos(theta[e]): s:=sin(theta[e]): Xrot:= X*c - Y*s: Yrot:= X*s + Y*c:  x:=(XY[IEN[e,1],1]+XY[IEN[e,2],1])/2: y:=(XY[IEN[e,1],2]+XY[IEN[e,2],2])/2: pp[1,1..4]:=Xrot+x: pp[2,1..4]:=Yrot+y: nc:=trunc(((Su-minA)/dA-0.01))+1: co:=convert(cm[nc],list): BarS[e]:=polygon([seq(convert(pp[..,i],list),i=1..4)],color=Color(co),thickness=0.5): # rectangle along bar AS[e]:=textplot([x,y,`` || (sprintf(\|| ``]): # von Mises stress end do: mapC:=Array(1..nco): # rectangle for each color mapL:=Array(1..2): # colormap limits dy:=(6.-1.)/nco: y=1.: for i to nco do co:=convert(cm[i],list): mapC[i]:=rectangle([26.5,y],[27,y+dy],color=Color(co),thickness=0.1): y:=y+dy: end do: mapL[1]:=textplot([27.1,1.,`` || (sprintf(\|| ``],align={above,right}): mapL[2]:=textplot([27.1,6.,`` || (sprintf(\|| ``],align={above,right}): # plot set #3 PlotS:=[seq(BarS[i],i=1..nfe),seq(AS[i],i=1..nfe),seq(mapC[i],i=1..nco),seq(mapL[i],i=1..2)]: end if: # Plot frame Rplt:=rectangle([-2,-1],[28,7],transparency=1,thickness=0.5): # Plot values of input data A1p:=textplot([23.5,4.7,`#msup(mi(` || (sprintf(\|| `),mi(2))`],align={above,right}): A2p:=textplot([23.5,4.4,`#msup(mi(` || (sprintf(\|| `),mi(2))`],align={above,right}): E1p:=textplot([23.5,4.1,`#msup(mi(` || (sprintf(\|| `),mi(2))`],align={above,right}): E2p:=textplot([23.5,3.8,`#msup(mi(` || (sprintf(\|| `),mi(2))`],align={above,right}): # Plot a main title of plot if StrurelMode = 0 or StrurelMode = 2 then : T1p:=textplot([0.5,4.6,sprintf(\StrurelName, StrurelModule, StrurelVersion)],align={above,right},font=[\ end if: if StrurelMode = 0 then : # input data at state of mean values T2pt:=\ T3pt:=\ elif StrurelMode = 2 then : # input data at beta-point T2pt:=sprintf(\StrurelIMET, StrurelIOPT): T3pt:=sprintf(\StrurelBeta, StrurelPf): # calculated beta and Pf end if: T2p:=textplot([0.5,4.3,T2pt],align={above,right},font=[\ T3p:=textplot([0.5,4.0,`` || T3pt || ``],align={above,right},font=[\ Tse:=textplot([0,-1,StrurelEngine],align={above,right},font=[\ display(Rplt, PlotT, PlotS, A1p, A2p, E1p, E2p, T1p, T2p, T3p, Tse, scaling=constrained,axis=[thickness=0.5,gridlines=[color=lightblue]],title=tit,titlefont=[\ end proc: for np to 3 do # Complete maplet to display a created plot mapletS := Maplet(Plotter('width'=getmetric(0)/2,'height'=getmetric(1)/2,'reference'='Plotter','value'=TrussPlot(np)), # plot function defined above BoxLayout('reference'='BoxLayout', BoxColumn(BoxCell('value'='Plotter'))), Window('layout'='BoxLayout','reference'='Window','resizable'='false','title'=tit), Action(RunWindow('window'='Window'))): # Show maplet Maplets[Display](mapletS): end do: end if:end if: # end of plot block## Return value of script (proc)return a[8]; # vertical deflection at bottom center (N04)end proc:## Procedure to create \Jet := proc(n)c:=Matrix(n,3,fill=1.):dv:=2/(n-1):v:=-1;for i to n do if v < -0.5 then c[i,1]:=0.: c[i,2]:=4*(v+1.)/2.: elif v < 0. then c[i,1]:=0.: c[i,3]:=1.+4*(-0.5-v)/2: elif v < 0.5 then c[i,1]:=4*v/2: c[i,3]:=0.: else c[i,2]:=1.+4*(0.5-v)/2: c[i,3]:=0: end if: v:=v+dv:end do:return c:end:
                                
   1   2   3   4   5   6   7   8   9   10