-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths4.define.bcs.php
110 lines (82 loc) · 2.62 KB
/
s4.define.bcs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
if(isset($_GET["id"])) {
$id = htmlspecialchars($_GET["id"]);
}
?>
<?php
if (isset($_POST["add"])) {
$nodeNum = htmlspecialchars($_POST["nodeNum"]);
$trans_x = htmlspecialchars($_POST["trans_x"]);
$trans_y = htmlspecialchars($_POST["trans_y"]);
$rotation = htmlspecialchars($_POST["rotation"]);
$fp = fopen('input_files/bcs_'.$id.'.csv', 'a');
if($trans_x!=1) {
$trans_x = 0;
}
if($trans_y!=1) {
$trans_y = 0;
}
if($rotation!=1) {
$rotation = 0;
}
$row = $nodeNum.",".$trans_x.",".$trans_y.",".$rotation;
fwrite($fp, $row."\r\n");
fclose($fp);
header("Location: pre_process.php?nodes&matprops&members&bcs&id=".$id);
}
if (isset($_POST["saveAndContinue"])) {
header("Location: pre_process.php?nodes&matprops&members&bcs&loads&id=".$id);
}
if(isset($_POST["undo"])) {
$filename = 'input_files/bcs_'.$id.'.csv';
$arr = file($filename);
if ($arr === false) {
die('Failed to read ' . $filename);
}
if(!isset($arr[1])) {
header("Location: pre_process.php?nodes&matprops&members&bcs&id=".$id);
}
array_pop($arr);
file_put_contents($filename, implode(PHP_EOL, $arr));
//header("Location: pre_process.php?nodes&matprops&members&bcs&id=".$id);
}
?>
<ul id="steps">
<li class="step">Step 1: Define Nodal Points</li>
<li class="step">Step 2: Define Material Properties</li>
<li class="step">Step 3: Define Members</li>
<li class="step current">Step 4: Define Boundary Conditions</li>
<li class="step">Step 5: Define Loads</li>
<li class="step">Step 6: Run Analysis</li>
</ul>
<hr/>
<div class="clear"></div>
<p id="info">
Define supports in the structure. Check for restraint state.</br></br>
Trans-X : Translation in global x direction </br>
Trans-Y : Translation in global x direction </br>
Rotation: Rotation about global z direction </br>
</p>
<div class="clear"></div>
<form action="" method="post">
<div id="inputs">
<div>
<label>Node Number: </label>
<select name="nodeNum">
<?php
$handle = fopen("input_files/nodes_".$id.".csv", "r");
while ($data = fgetcsv($handle, ",")) {
echo '<option value="'.$data[0].'""> '.$data[0].' </option>';
}
?>
</select>
<label>Trans-X</label><input type="checkbox" name="trans_x" value="1">
<label>Trans-Y</label> <input type="checkbox" name="trans_y" value="1">
<label>Rotation</label><input type="checkbox" name="rotation" value="1">
<br>
</div>
</div>
<input id="addButton" name="add" type="submit" value="Add This BC"><input name="undo" type="submit" value="Undo">
<hr/>
<input class="nextstep" name="saveAndContinue" type="submit" value="Next Step >">
</form>