forked from dlubal-software/Dlubal_JavaScript_Library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSection.js
More file actions
343 lines (324 loc) · 14.1 KB
/
Copy pathSection.js
File metadata and controls
343 lines (324 loc) · 14.1 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
/**
* Create Section
* @class
* @constructor
* @param {Number} no Number of the Section, can be undefined
* @param {String} section_name Name of the Section, can be undefined (IPE 300 by default)
* @param {Number} material_no Number of the material
* @param {String} comment Comment
* @param {Object} params Parameters
* @returns Section
*/
function Section(no,
section_name,
material_no,
comment,
params) {
var name = typeof section_name !== "undefined" ? section_name : "IPE 300";
ASSERT(typeof material_no !== "undefined", "Material number must be set");
// if (!materials.exist(material_no)) { due to BUGFIX-45508
// console.log("Material no. " + material_no + " doesn't exist");
// }
this.section = engine.create_section(no, material_no);
this.section.name = name;
set_comment_and_parameters(this.section, comment, params);
}
/**
*
* @returns Number of Section
*/
Section.prototype.GetNo = function() {
return this.section.no;
};
Section.prototype.GetSection = function() {
return this.section;
};
/**
* Sets section type
* @param {String} section_type Section type
* @returns Modified Section
*/
Section.prototype.SectionType = function(section_type) {
ASSERT(section_type !== "undefined", "Section type must be defined");
this.section.type = GetSectionType(section_type);
return this.section;
};
/**
* Sets manufacturing type
* @param {String} manufacturing_type Manufacturing type
* @returns Modified Section
*/
Section.prototype.ManufacturingType = function(manufacturing_type) {
ASSERT(typeof manufacturing_type !== "undefined", "Manufacturing type must be defined");
if (manufacturing_type === "HOT_ROLLED") {
ASSERT(this.section.type === sections.TYPE_STANDARDIZED_STEEL || this.section.type === sections.TYPE_PARAMETRIC_THIN_WALLED || this.section.type === sections.TYPE_PARAMETRIC_BARS, "Manufacturing type cannot be set for this section type");
}
else if (manufacturing_type === "SAWN") {
ASSERT(this.section.type === sections.TYPE_STANDARDIZED_TIMBER, "Manufacturing type cannot be set for this section type");
}
else if (manufacturing_type === "WELDED") {
ASSERT(this.section.type === sections.TYPE_PARAMETRIC_THIN_WALLED, "Manufacturing type cannot be set for this section type");
}
this.section.manufacturing_type = GetManufacturingType(manufacturing_type);
return this.section;
};
/**
* Sets Section properties
* @param {Number} area_shear_y Shear sectional areas, can be undefined
* @param {Number} area_shear_z Shear sectional areas, can be undefined
* @param {Number} warping Warping, van be undefined
* @param {Number} width_temperature_load Width (for non-uniform temperature loads), can be undefined
* @param {Number} depth_temperature_load Depth (for non-uniform temperature loads), can be undefined
* @returns Modified Section
*/
Section.prototype.SectionProperties = function (area_shear_y,
area_shear_z,
warping,
width_temperature_load,
depth_temperature_load) {
if (typeof area_shear_y !== "undefined") {
ASSERT(this.section.shear_stiffness_deactivated, "Shear stiffness is deactivated");
this.section.area_shear_y = area_shear_y;
}
if (typeof area_shear_z !== "undefined") {
ASSERT(this.section.shear_stiffness_deactivated, "Shear stiffness is deactivated");
this.section.area_shear_z = area_shear_z;
}
if (typeof warping !== "undefined") {
ASSERT(TORSIONAL_WARPING.isActive(), "Torsional Warping add-on must be active");
ASSERT(!this.section.warping_stiffness_deactivated, "Warping stiffness must be enabled");
this.section.warping = warping;
}
if (typeof width_temperature_load !== "undefined") {
this.section.width_temperature_load = width_temperature_load;
}
if (typeof depth_temperature_load !== "undefined") {
this.section.depth_temperature_load = depth_temperature_load;
}
return this.section;
};
/**
* Deactivates shear stiffness
* @param {Boolean} deactivated Shear stiffness deactivation/activation, can be undefined (true as default)
* @returns Modified Section
*/
Section.prototype.DeactivateShearStiffness = function (deactivated) {
if (typeof deactivated === "undefined") {
deactivated = true;
}
this.section.shear_stiffness_deactivated = deactivated;
return this.section;
};
/**
* Sets Section rotation
* @param {Number} rotation_angle Rotation angle
* @returns Modified Section
*/
Section.prototype.Rotation = function (rotation_angle) {
ASSERT(typeof rotation_angle !== "undefined", "Rotation angle must be defined");
this.section.rotation_angle = rotation_angle;
return this.section;
};
/**
* Sets thin-walled model
* @param {Boolean} thin_walled_model Thin-walled model enabling/disabling, can be undefined (true as default)
* @returns Modified Section
*/
Section.prototype.ThinWalledModel = function (thin_walled_model) {
if (typeof thin_walled_model === "undefined") {
thin_walled_model = true;
}
this.section.thin_walled_model = thin_walled_model;
return this.section;
};
/**
* Sets US notation for section properties
* @param {Boolean} us_spelling_of_properties US notation enabling/disabling, can be undefined (true as default)
* @returns Modified Section
*/
Section.prototype.UsNotation = function (us_spelling_of_properties) {
if (typeof us_spelling_of_properties === "undefined") {
us_spelling_of_properties = true;
}
this.section.us_spelling_of_properties = us_spelling_of_properties;
return this.section;
};
/**
* Sets stress smoothing to avoid singularities
* @param {Boolean} stress_smoothing_to_avoid_singularities Stress smoothing enabling/disabling, can be undefined (true as default)
* @returns Modified Section
*/
Section.prototype.StressSmoothing = function (stress_smoothing_to_avoid_singularities) {
if (typeof stress_smoothing_to_avoid_singularities === "undefined") {
stress_smoothing_to_avoid_singularities = true;
}
this.section.stress_smoothing_to_avoid_singularities = stress_smoothing_to_avoid_singularities;
return this.section;
};
/**
* Deactivates warping stiffness
* @param {Boolean} deactivated Warping stiffness deactivation/activation, can be undefined (true as default). Torsional Warping add-on must be active.
* @returns Modified Section
*/
Section.prototype.DeactivateWarpingStiffness = function (deactivated) {
ASSERT(TORSIONAL_WARPING.isActive(), "Torsional Warping add-on must be active");
if (typeof deactivated === "undefined") {
deactivated = true;
}
this.section.warping_stiffness_deactivated = deactivated;
return this.section;
};
/**
* Sets cost estimation
* @param {Boolean} cost_estimation Cost estimation apply from material enabling/disabling, can be undefined (true as default). Optimization & Costs / CO2 Emission Estimation add-on must be active.
* @returns Modified Section
*/
Section.prototype.CostEstimation = function (cost_estimation) {
ASSERT(COST_ESTIMATION.isActive(), "Optimization & Costs / CO2 Emission Estimation add-on must be active");
if (typeof cost_estimation === "undefined") {
cost_estimation = true;
}
this.section.has_cost_estimation = cost_estimation;
return this.section;
};
/**
* Sets Cost estimation values
* @param {Number} member_weight Member weight, can be undefined. Optimization & Costs / CO2 Emission Estimation add-on must be active.
* @param {Number} member_volume Member volume, can be undefined. Optimization & Costs / CO2 Emission Estimation add-on must be active.
* @param {Number} member_surface Member surface, can be undefined. Optimization & Costs / CO2 Emission Estimation add-on must be active.
* @param {Number} member_length Member length, can be undefined. Optimization & Costs / CO2 Emission Estimation add-on must be active.
* @returns Modified Section
*/
Section.prototype.CostEstimationValues = function (member_weight,
member_volume,
member_surface,
member_length) {
ASSERT(COST_ESTIMATION.isActive(), "Optimization & Costs / CO2 Emission Estimation add-on must be active");
ASSERT(this.section.has_cost_estimation, "Cost estimation must be enabled");
if (typeof member_weight !== "undefined") {
this.section.members_weight_active = true;
this.members_weight_unit_cost = member_weight;
}
if (typeof member_volume !== "undefined") {
this.section.members_volume_active = true;
this.members_volume_unit_cost = member_volume;
}
if (typeof member_surface !== "undefined") {
this.members_surface_active = true;
this.members_surface_unit_cost = member_surface;
}
if (typeof member_length !== "undefined") {
this.section.members_length_active = true;
this.section.members_length_unit_cost = member_length;
}
return this.section;
};
/**
* Sets estimation of CO2 emissions
* @param {Boolean} emission_estimation Estimation of CO2 emissions enabling/disabling, can be undefined (true as default). Optimization & Costs / CO2 Emission Estimation add-on must be active.
* @returns Modified Section
*/
Section.prototype.EmissionEstimation = function (emission_estimation) {
ASSERT(COST_ESTIMATION.isActive(), "Optimization & Costs / CO2 Emission Estimation add-on must be active");
if (typeof emission_estimation === "undefined") {
emission_estimation = true;
}
this.section.has_emissions_estimation = emission_estimation;
return this.section;
};
/**
* Sets Emission estimation values
* @param {Number} member_weight Member weight, can be undefined. Optimization & Costs / CO2 Emission Estimation add-on must be active.
* @param {Number} member_volume Member volume, can be undefined. Optimization & Costs / CO2 Emission Estimation add-on must be active.
* @param {Number} member_surface Member surface, can be undefined. Optimization & Costs / CO2 Emission Estimation add-on must be active.
* @param {Number} member_length Member length, can be undefined. Optimization & Costs / CO2 Emission Estimation add-on must be active.
* @returns Modified Section
*/
Section.prototype.EmissionEstimationValues = function (member_weight,
member_volume,
member_surface,
member_length) {
ASSERT(COST_ESTIMATION.isActive(), "Optimization & Costs / CO2 Emission Estimation add-on must be active");
ASSERT(this.section.has_emissions_estimation, "Estimation of CO2 emissions must be enabled");
if (typeof member_weight !== "undefined") {
this.section.emissions_estimation_apply_from_material = false;
this.section.emissions_members_weight_active = true;
this.section.emissions_members_weight_unit_emission = member_weight;
}
if (typeof member_volume !== "undefined") {
this.section.emissions_estimation_apply_from_material = false;
this.section.emissions_members_volume_active = true;
this.section.emissions_members_volume_unit_emission = member_volume;
}
if (typeof member_surface !== "undefined") {
this.section.emissions_estimation_apply_from_material = false;
this.section.emissions_members_surface_active = true;
this.section.emissions_members_surface_unit_emission = member_surface;
}
if (typeof member_length !== "undefined") {
this.section.emissions_estimation_apply_from_material = false;
this.section.emissions_members_length_active = true;
this.section.emissions_members_length_unit_emission = member_length;
}
return this.section;
};
/**
* Sets optimization
* @param {Boolean} optimization Optimization enabling/disabling, can be undefined (true as default). Optimization & Costs / CO2 Emission Estimation add-on must be active.
* @returns Modified Section
*/
Section.prototype.Optimization = function (optimization) {
ASSERT(COST_ESTIMATION.isActive(), "Optimization & Costs / CO2 Emission Estimation add-on must be active");
if (typeof optimization === "undefined") {
optimization = true;
}
this.section.optimization = optimization;
return this.section;
};
function GetSectionType(section_type) {
const section_types = {
"STANDARDIZED_STEEL" : sections.TYPE_STANDARDIZED_STEEL,
"STANDARDIZED_TIMBER" : sections.TYPE_STANDARDIZED_TIMBER,
"PARAMETRIC_THIN_WALLED" : sections.TYPE_PARAMETRIC_THIN_WALLED,
"PARAMETRIC_MASSIVE_I" : sections.TYPE_PARAMETRIC_MASSIVE_I,
"PARAMETRIC_MASSIVE_II" : sections.TYPE_PARAMETRIC_MASSIVE_II,
"PARAMETRIC_BARS" : sections.TYPE_PARAMETRIC_BARS,
"BUILT_UP_STEEL" : sections.TYPE_BUILT_UP_STEEL,
"BUILT_UP_TIMBER" : sections.TYPE_BUILT_UP_TIMBER,
"BASIC" : sections.TYPE_BASIC,
"GENERAL_BY_RSECTION" : sections.TYPE_GENERAL_BY_RSECTION,
"PHASE" : sections.TYPE_PHASE
};
if (section_type !== "undefined") {
if (!(section_type in section_types)) {
console.log("Wrong section type. Value was: " + section_type);
console.log("Correct values are: ( " + Object.keys(section_types) + ")");
section_type = "STANDARDIZED_STEEL";
}
return section_types[section_type];
}
else {
return sections.TYPE_STANDARDIZED_STEEL;
}
}
function GetManufacturingType(manufacturing_type) {
const manufacturing_types = {
"HOT_ROLLED" : sections.MANUFACTURING_TYPE_HOT_ROLLED,
"COLD_FORMED" : sections.MANUFACTURING_TYPE_COLD_FORMED,
"WELDED" : sections.MANUFACTURING_TYPE_WELDED,
"SAWN" : sections.MANUFACTURING_TYPE_SAWN,
"NONE" : sections.MANUFACTURING_TYPE_NONE,
"GLULAM" : sections.MANUFACTURING_TYPE_GLULAM
};
if (manufacturing_type !== "undefined") {
if (!(manufacturing_type in manufacturing_types)) {
console.log("Wrong manufacturing type. Value was: " + manufacturing_type);
console.log("Correct values are: ( " + Object.keys(manufacturing_types) + ")");
manufacturing_type = "HOT_ROLLED";
}
return manufacturing_types[manufacturing_type];
}
else {
return sections.MANUFACTURING_TYPE_HOT_ROLLED;
}
}