Post Reply 
program SECTION ver 2.0
02-16-2014, 03:53 AM (This post was last modified: 03-17-2015 05:22 AM by churichuro.)
Post: #1
program SECTION ver 2.0
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!
Find all posts by this user
Quote this message in a reply
03-17-2015, 05:24 AM
Post: #2
RE: program SECTION ver 2.0
I update this software and include a short Video.
Find all posts by this user
Quote this message in a reply
03-18-2015, 04:55 PM
Post: #3
RE: program SECTION ver 2.0
Thank you. As a mechanical engineer I will make good use of it!

François
Find all posts by this user
Quote this message in a reply
05-14-2015, 01:13 PM (This post was last modified: 05-16-2015 10:01 AM by akmon.)
Post: #4
RE: program SECTION ver 2.0
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;
Find all posts by this user
Quote this message in a reply
08-04-2015, 06:18 PM (This post was last modified: 08-04-2015 06:35 PM by zmp.)
Post: #5
RE: program SECTION ver 2.0
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


Attached File(s)
.zip  INERTIA COMPARISON.hpappdir.zip (Size: 4.37 KB / Downloads: 47)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)