HP Forums
program SECTION ver 2.0 - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: program SECTION ver 2.0 (/thread-687.html)



program SECTION ver 2.0 - churichuro - 02-16-2014 03:53 AM

Hello a leave this simple program for calc some geometric properties
for figures made from rectangles, like W section or so.

1) first you create a Matrix
with 2 columns
col 1 is rectangle width
col 2 is de rectangle depth

for example : in Matrix M1
"I" section with
top Flange 20cm wide and 1.3cm thick
Web 0.6cm thick and 37.40 cm high
bottom Flange 20cm wide and 1.3cm thickness

(you can use more rectangles for you figure, no only 3)

[Image: xcj8.png]

2) call the program named SECTION
(the program return a list with result too. )

[Image: xxsy.png]

3) you can se some like this graphic results
[Image: d4p5.png]

4) press ENTER key and numeric result is return in a list
[Image: fhaa.png]

Code:

EXPORT SECTION(mat)
BEGIN
Local t,d,h,y0,a,ix1,iy1,iy;
Local ssy,ry,yy1,ix,ssx,rx;
Local d1,y,i,n,at,ftor,mx1;
Local mx2,my1,my2, res;

t:= revlist(col(mat,1));
d:= revlist(col(mat,2));
t:= append(t,0); d:= append(d,0);
n:= DIM(t); n:= n(1)−1;

h:=MAKEMAT(0,n+1);
y0:=h; a:=h; ix1:=h; yy1:=h; iy1:=h;
h[1]:=0;

d1:=sum(d);
ftor:= 200/(MAX(d1,MAX(t)));

RECT_P();
LINE_P(G0,160,0,160,220,#0000FF);
LINE_P(G0,0,220,320,220,#0000FF);

FOR i FROM 1 TO n DO
h[i+1]:= h[i]+d[i];
IF t[i]≠0 THEN
my1:=iPart(210-ftor*h[i]+0.5);
my2:=iPart(210-ftor*(h[i]+d[i])+0.5);
mx1:=iPart(240-ftor*(t[i]/2)+.5);
mx2:=iPart(mx1+ftor*t[i]+.5);

LINE_P(G0,mx1,my1,mx1,my2,#FF0000);
LINE_P(G0,mx1,my2,mx2,my2,#FF0000);
LINE_P(G0,mx2,my1,mx2,my2,#FF0000);
LINE_P(G0,mx2,my1,mx1,my1,#FF0000);
END;
END;

y0:=h+ d/2;
a:= t .*d;
ix1:= CAS(t .* (d .^3) /12);
iy1:= CAS(d .* (t .^3) /12);
at:= sum(a);
y:= sum(a .* y0)/at;
yy1:=y0 .- y;
ix:= sum(ix1)+sum(a .* (yy1 .* yy1));
ssx:=ix/(d1-y);
rx:= √(ix/at);
iy:=sum(iy1);
ssy:= 2*iy/(max(t));
ry:= √(iy/at);

res:= MAKELIST(0,X,1,9);

res:= {"ӯ = "+round(y,2)+" cm",
"d = "+round(d1,2)+" cm",
"Ix = "+round(ix,2)+" cm⁴",
"Sx = "+round(ssx,2)+" cm³",
"rx = "+round(rx,2)+" cm",
"Iy = "+round(iy,2)+" cm⁴",
"Sy = "+round(ssy,2)+" cm³",
"ry = "+round(ry,2)+" cm",
"A = "+round(at,2)+" cm²" };

TEXTOUT_P("*** SECTION V1.2 ***",5,5,0,#0000FF);
TEXTOUT_P("by Rafael H. Padilla V.",5,21,0,#0000FF);
TEXTOUT_P("dysup@hotmail.com",5,35,0,#0000FF);
TEXTOUT_P("*** RESULTS ***",5,55,0,#0000FF);
FOR i FROM 1 TO 9 DO
TEXTOUT_P(res(i),10,58+i*16);
END;

my1:=iPart(210-y*ftor+0.5);
FOR i FROM 1 TO 11 DO
mx1:= iPart((i-1)*10+190);
mx2:= mx1+6;
LINE_P(mx1,my1,mx2,my1,#00FF00);
END;

TEXTOUT_P("NA",170,my1-5);
REPEAT
TEXTOUT_P("PRESS <<ENTER>> KEY",90,222,0,#FF0000);
WAIT(.35);
TEXTOUT_P("PRESS <<ENTER>> KEY",90,222,0,#FFFFFF,1000,#FFFFFF);
WAIT(.35);
UNTIL GETKEY ≠ −1;

return(res);

END;

example:




exist some like this for Hp48, with de name iCalc from Nate Morris
but I do this version from scratch

(I do this same program for the TI Voyage 200)

thanks!


RE: program SECTION ver 2.0 - churichuro - 03-17-2015 05:24 AM

I update this software and include a short Video.


RE: program SECTION ver 2.0 - Francois Lanciault - 03-18-2015 04:55 PM

Thank you. As a mechanical engineer I will make good use of it!

François


RE: program SECTION ver 2.0 - akmon - 05-14-2015 01:13 PM

With new firmware version (7820), the picture of section appears for half a second and it comes back to main screen showing "Invalid input".

Update. I´ve erased some part of the code, at the end for not flickering "Press Enter". It does not flick, but the figure and results remain until you press a key.

Code:
EXPORT SECTION(mat)
BEGIN
Local t,d,h,y0,a,ix1,iy1,iy;
Local ssy,ry,yy1,ix,ssx,rx;
Local d1,y,i,n,at,ftor,mx1;
Local mx2,my1,my2, res;

t:= revlist(col(mat,1));
d:= revlist(col(mat,2));
t:= append(t,0); d:= append(d,0);
n:= DIM(t); n:= n(1)−1;

h:=MAKEMAT(0,n+1);
y0:=h; a:=h; ix1:=h; yy1:=h; iy1:=h;
h[1]:=0;

d1:=sum(d);
ftor:= 200/(MAX(d1,MAX(t)));

RECT_P();
LINE_P(G0,160,0,160,220,#0000FF);
LINE_P(G0,0,220,320,220,#0000FF);

FOR i FROM 1 TO n DO
h[i+1]:= h[i]+d[i];
IF t[i]≠0 THEN
my1:=iPart(210-ftor*h[i]+0.5);
my2:=iPart(210-ftor*(h[i]+d[i])+0.5);
mx1:=iPart(240-ftor*(t[i]/2)+.5);
mx2:=iPart(mx1+ftor*t[i]+.5);

LINE_P(G0,mx1,my1,mx1,my2,#FF0000);
LINE_P(G0,mx1,my2,mx2,my2,#FF0000);
LINE_P(G0,mx2,my1,mx2,my2,#FF0000);
LINE_P(G0,mx2,my1,mx1,my1,#FF0000);
END;
END;

y0:=h+ d/2;
a:= t .*d;
ix1:= CAS(t .* (d .^3) /12);
iy1:= CAS(d .* (t .^3) /12);
at:= sum(a);
y:= sum(a .* y0)/at;
yy1:=y0 .- y;
ix:= sum(ix1)+sum(a .* (yy1 .* yy1));
ssx:=ix/(d1-y);
rx:= √(ix/at);
iy:=sum(iy1);
ssy:= 2*iy/(max(t));
ry:= √(iy/at);

res:= MAKELIST(0,X,1,9);

res:= {"ӯ = "+round(y,2)+" cm",
"d = "+round(d1,2)+" cm",
"Ix = "+round(ix,2)+" cm⁴",
"Sx = "+round(ssx,2)+" cm³",
"rx = "+round(rx,2)+" cm",
"Iy = "+round(iy,2)+" cm⁴",
"Sy = "+round(ssy,2)+" cm³",
"ry = "+round(ry,2)+" cm",
"A = "+round(at,2)+" cm²" };

TEXTOUT_P("*** SECTION V1.2 ***",5,5,0,#0000FF);
TEXTOUT_P("by Rafael H. Padilla V.",5,21,0,#0000FF);
TEXTOUT_P("dysup@hotmail.com",5,35,0,#0000FF);
TEXTOUT_P("*** RESULTS ***",5,55,0,#0000FF);
FOR i FROM 1 TO 9 DO
TEXTOUT_P(res(i),10,58+i*16);
END;

my1:=iPart(210-y*ftor+0.5);
FOR i FROM 1 TO 11 DO
mx1:= iPart((i-1)*10+190);
mx2:= mx1+6;
LINE_P(mx1,my1,mx2,my1,#00FF00);
END;

TEXTOUT_P("NA",170,my1-5);
REPEAT
TEXTOUT_P("PRESS <<ENTER>> KEY",90,222,0,#FF0000);
WAIT(.35);
UNTIL GETKEY ≠ −1;

return(res);

END;



RE: program SECTION ver 2.0 - zmp - 08-04-2015 06:18 PM

My spreadsheet based on your program to compare inertia and sectional properties.
I hope it can help.

If you find any issue please keep me inform... It is beta... trying to implement other shapes: c not symmetrical...

Mathieu