From 68904b597a9cf1191609384d5b5fde38a7a88cb3 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 11 Apr 2023 22:08:44 +0200 Subject: [PATCH] Fix wrong fin location referencing in aggregate tubes --- .../sf/openrocket/file/rasaero/export/BoosterDTO.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/file/rasaero/export/BoosterDTO.java b/core/src/net/sf/openrocket/file/rasaero/export/BoosterDTO.java index d0a0db009..632926d66 100644 --- a/core/src/net/sf/openrocket/file/rasaero/export/BoosterDTO.java +++ b/core/src/net/sf/openrocket/file/rasaero/export/BoosterDTO.java @@ -155,6 +155,7 @@ public class BoosterDTO implements BodyTubeDTOAdapter { TrapezoidFinSet finSet = getFinSetFromBodyTube(firstTube); double tubeLength = firstTube.getLength(); + double finLocationOffset = 0; // Aggregate same-sized body tubes for (int i = stage.getChildPosition(firstTube) + 1; i < stage.getChildCount(); i++) { RocketComponent comp = stage.getChild(i); @@ -167,6 +168,11 @@ public class BoosterDTO implements BodyTubeDTOAdapter { if (finSet == null) { finSet = getFinSetFromBodyTube((BodyTube) comp); } + // We need an offset to the fin location, since the fin axial offset is referenced to its parent tube, + // which can be different from the bottom of the aggregate tubes + else { + finLocationOffset += comp.getLength(); + } } else { // If this booster is the last stage, and the last component is a transition, it could be a boattail boolean isBoattail = (comp instanceof Transition && !(comp instanceof NoseCone)) && i == stage.getChildCount() - 1; @@ -196,7 +202,10 @@ public class BoosterDTO implements BodyTubeDTOAdapter { String.format(trans.get("RASAeroExport.error16"), firstTube.getName(), stage.getName())); } - setFin(new FinDTO(finSet, warnings, errors)); + FinDTO finDTO = new FinDTO(finSet, warnings, errors); + double finLocation = finDTO.getLocation(); + finDTO.setLocation(finLocation + finLocationOffset * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH); + setFin(finDTO); setPartType(RASAeroCommonConstants.BOOSTER); setLength(tubeLength * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_LENGTH);