03-30-2015, 01:41 PM
From my blog: http://edspi31415.blogspot.com/2015/03/h...ttern.html
The program BOLTPAT will calculate a bolt pattern given:
X = center, X coordinate
Y = center, Y coordinate
N = number of bolts
D = diameter of the circle
No angle of rotation is assumed.
Coordinates of each bolt can be calculated by:
X_k = (d/2*COS(360*k/n)+xc)
Y_k = (d/2*SIN(360*k/n)+yc)
Where k = 0 to n-1
The OC-Distance between each bolt is calculated by calculating the linear distance between neighboring bolts.
Output:
Each point where the bolt should be placed. In addition, the on-center distance between bolts is displayed. Finally, each of the coordinates will be presented in a list.
Example:
Build a bolt pattern with 5 bolts of a circle of diameter of 3 units. The center of the circle has the center (1, 4). (X = 1, Y = 4, N = 5, D = 3)
Bolts should be placed at the following points:
(5.5, 1)
(4.4635, 2.4266)
(2.7865, 1.8817)
(2.7865, 0.1183)
(4.4635, -0.4266)
OC-Distance: 1.7634
The program BOLTPAT will calculate a bolt pattern given:
X = center, X coordinate
Y = center, Y coordinate
N = number of bolts
D = diameter of the circle
No angle of rotation is assumed.
Coordinates of each bolt can be calculated by:
X_k = (d/2*COS(360*k/n)+xc)
Y_k = (d/2*SIN(360*k/n)+yc)
Where k = 0 to n-1
The OC-Distance between each bolt is calculated by calculating the linear distance between neighboring bolts.
Output:
Each point where the bolt should be placed. In addition, the on-center distance between bolts is displayed. Finally, each of the coordinates will be presented in a list.
Code:
EXPORT BOLTPAT()
BEGIN
// EWS 2012-02-28
// No pre angle tilt
// Degrees
HAngle:=1;
// Data
LOCAL z0,z1,xc,yc;
LOCAL z,n,d,k,l,xp,yp;
INPUT({xc,yc,n,d},"Bolt Spacing",
{"xc:","yc:","n :","d :"},
{"x center","y center",
"number of bolts",
"diameter"});
l:={};
// Calculation
PRINT();
PRINT("x + y*i");
FOR k FROM 0 TO n-1 DO
xp:=(d/2*COS(360*k/n)+xc);
yp:=(d/2*SIN(360*k/n)+yc);
IF k==0 THEN
z0:=xp+i*yp;
END;
IF k==1 THEN
z1:=xp+i*yp;
END;
l:=CONCAT(l,{xp+yp*i});
PRINT("("+xp+","+yp+")");
END;
PRINT("OC-OC: "+ABS(z1-z0));
RETURN l;
END;
Example:
Build a bolt pattern with 5 bolts of a circle of diameter of 3 units. The center of the circle has the center (1, 4). (X = 1, Y = 4, N = 5, D = 3)
Bolts should be placed at the following points:
(5.5, 1)
(4.4635, 2.4266)
(2.7865, 1.8817)
(2.7865, 0.1183)
(4.4635, -0.4266)
OC-Distance: 1.7634