-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstructural_material.js
More file actions
64 lines (55 loc) · 2.64 KB
/
structural_material.js
File metadata and controls
64 lines (55 loc) · 2.64 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
// TODO: Create a material base class
class StructuralMaterial {
constructor()
{
this.addInput("model_part_name","string");
this.properties = {
"model_part_name" : "Structure.Parts_Solid_Solid_Auto1",
"properties_id" : 1,
"Material" : {
"constitutive_law" : {
"name" : "LinearElasticPlaneStress2DLaw"
},
"Variables" : {
"DENSITY" : 7850.0,
"YOUNG_MODULUS" : 206900000000.0,
"POISSON_RATIO" : 0.29,
"THICKNESS" : 0.1
},
"Tables" : {}
}
};
this.properties_id = this.addWidget("combo","Properties_ID", 1, function(v){}, { values:[1, 2, 3, 4, 5]} );
this.name = this.addWidget("text","Name", "LinearElasticPlaneStress2DLaw", function(v){}, function(v){}, {} );
this.DENSITY= this.addWidget("number","Density", 7850.0, function(v){}, {});
this.YOUNG_MODULUS = this.addWidget("number","Young_Modulus", 206900000000.0, function(v){}, {});
this.POISSON_RATIO = this.addWidget("number","Poisson_Ratio", 0.29, function(v){}, {});
this.THICKNESS = this.addWidget("number","Thinckness", 0.1, function(v){}, {});
this.addInput("tables","process_array");
this.addOutput("Material","material");
this.size = this.computeSize();
}
onExecute()
{
this._value = Object.assign({}, this.properties);
// Current material model part
this._value["model_part_name"] = this.getInputData(0)
// Table
if (this.getInputData(7) != undefined) {
this._value["Material"]["Table"] = this.getInputData(7)
} else {
this._value["Material"]["Table"]= this.properties["Table"]
}
this._value["properties_id"] = this.properties_id.value
this._value["Material"]["constitutive_law"]["name"] = this.name.value
this._value["Material"]["Variables"]["DENSITY"] = this.DENSITY.value
this._value["Material"]["Variables"]["YOUNG_MODULUS"] = this.YOUNG_MODULUS.value
this._value["Material"]["Variables"]["POISSON_RATIO"] = this.POISSON_RATIO.value
this._value["Material"]["Variables"]["THICKNESS"] = this.THICKNESS.value
this.setOutputData(0, this._value);
}
}
StructuralMaterial.title = "Structural material";
StructuralMaterial.desc = "Node to specify a Structurall material.";
LiteGraph.registerNodeType("materials/StructuralMaterial", StructuralMaterial);
console.log("StructuralMaterialNew node created"); //helps to debug