A fan is created and assigned using very similar steps:
m = new Material("Internal Fan/Pump");
m.name = "fan";
p = m.property("Flow");
v = p.variation("Constant");
v.setValue(20, "ft3/min");
p.apply(v);
m.setDirection(1.0, 0.0, 0.0);
a.select("FANPART");
a.applyMaterial(m);
A line-by-line description follows.
A new material object called “m” is created, and the type is set as an Internal Fan/Pump. The name of the material is set to “fan1”:
m = new Material("Internal Fan/Pump");
m.name = "fan1";
A property object called “p” is created, and Flow is chosen as the property to modify. In the next line, a variation object called “v” is created, and is set to constant:
p = m.property("Flow");
v = p.variation("Constant");
The value of flow rate is set to 20 ft^3/min, and the value is applied to the property:
v.setValue(20, "ft3/min");
p.apply(v);
The direction on the fan is specified with a unit vector to be in the x direction:
m.setDirection(1.0, 0.0, 0.0);
The part called “FANPART” is selected, and the fan material applied to it:
a.select("FANPART");
a.applyMaterial(m);