Calculate fintab height after calculating length and position.
This commit is contained in:
parent
05d23ce56c
commit
0dd878d1f4
@ -228,31 +228,29 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
log.info(Markers.USER_MARKER, "Computing " + component.getComponentName() + " tab height.");
|
||||
|
||||
|
||||
double inRad = 0.0;
|
||||
RocketComponent parent = component.getParent();
|
||||
if (parent instanceof Coaxial) {
|
||||
try {
|
||||
document.startUndo("Compute fin tabs");
|
||||
|
||||
List<CenteringRing> rings = new ArrayList<>();
|
||||
//Do deep recursive iteration
|
||||
// Do deep recursive iteration to find centering rings and determine
|
||||
// radius of inner tube
|
||||
Iterator<RocketComponent> iter = parent.iterator(false);
|
||||
while (iter.hasNext()) {
|
||||
RocketComponent rocketComponent = iter.next();
|
||||
if (rocketComponent instanceof InnerTube) {
|
||||
InnerTube it = (InnerTube) rocketComponent;
|
||||
if (it.isMotorMount()) {
|
||||
double depth = ((Coaxial) parent).getOuterRadius() - it.getOuterRadius();
|
||||
//Set fin tab depth
|
||||
if (depth >= 0.0d) {
|
||||
tabHeightModel.setValue(depth);
|
||||
tabHeightModel.setCurrentUnit(UnitGroup.UNITS_LENGTH.getDefaultUnit());
|
||||
}
|
||||
inRad = it.getOuterRadius();
|
||||
}
|
||||
} else if (rocketComponent instanceof CenteringRing) {
|
||||
rings.add((CenteringRing) rocketComponent);
|
||||
}
|
||||
}
|
||||
|
||||
//Figure out position and length of the fin tab
|
||||
if (!rings.isEmpty()) {
|
||||
AxialMethod temp = (AxialMethod) em.getSelectedItem();
|
||||
@ -263,7 +261,14 @@ public abstract class FinSetConfig extends RocketComponentConfig {
|
||||
//Be nice to the user and set the tab relative position enum back the way they had it.
|
||||
em.setSelectedItem(temp);
|
||||
}
|
||||
|
||||
|
||||
// compute tab height
|
||||
double height = ((Coaxial) parent).getOuterRadius() - inRad;
|
||||
//Set fin tab height
|
||||
if (height >= 0.0d) {
|
||||
tabHeightModel.setValue(height);
|
||||
tabHeightModel.setCurrentUnit(UnitGroup.UNITS_LENGTH.getDefaultUnit());
|
||||
}
|
||||
} finally {
|
||||
document.stopUndo();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user