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
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
log.info(Markers.USER_MARKER, "Computing " + component.getComponentName() + " tab height.");
|
log.info(Markers.USER_MARKER, "Computing " + component.getComponentName() + " tab height.");
|
||||||
|
|
||||||
|
double inRad = 0.0;
|
||||||
RocketComponent parent = component.getParent();
|
RocketComponent parent = component.getParent();
|
||||||
if (parent instanceof Coaxial) {
|
if (parent instanceof Coaxial) {
|
||||||
try {
|
try {
|
||||||
document.startUndo("Compute fin tabs");
|
document.startUndo("Compute fin tabs");
|
||||||
|
|
||||||
List<CenteringRing> rings = new ArrayList<>();
|
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);
|
Iterator<RocketComponent> iter = parent.iterator(false);
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
RocketComponent rocketComponent = iter.next();
|
RocketComponent rocketComponent = iter.next();
|
||||||
if (rocketComponent instanceof InnerTube) {
|
if (rocketComponent instanceof InnerTube) {
|
||||||
InnerTube it = (InnerTube) rocketComponent;
|
InnerTube it = (InnerTube) rocketComponent;
|
||||||
if (it.isMotorMount()) {
|
if (it.isMotorMount()) {
|
||||||
double depth = ((Coaxial) parent).getOuterRadius() - it.getOuterRadius();
|
inRad = it.getOuterRadius();
|
||||||
//Set fin tab depth
|
|
||||||
if (depth >= 0.0d) {
|
|
||||||
tabHeightModel.setValue(depth);
|
|
||||||
tabHeightModel.setCurrentUnit(UnitGroup.UNITS_LENGTH.getDefaultUnit());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (rocketComponent instanceof CenteringRing) {
|
} else if (rocketComponent instanceof CenteringRing) {
|
||||||
rings.add((CenteringRing) rocketComponent);
|
rings.add((CenteringRing) rocketComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Figure out position and length of the fin tab
|
//Figure out position and length of the fin tab
|
||||||
if (!rings.isEmpty()) {
|
if (!rings.isEmpty()) {
|
||||||
AxialMethod temp = (AxialMethod) em.getSelectedItem();
|
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.
|
//Be nice to the user and set the tab relative position enum back the way they had it.
|
||||||
em.setSelectedItem(temp);
|
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 {
|
} finally {
|
||||||
document.stopUndo();
|
document.stopUndo();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user