Author Topic: Custom Stop positions not working  (Read 565 times)

BAW217

  • Newbie
  • *
  • Posts: 4
Custom Stop positions not working
« on: January 04, 2025, 03:25:13 pm »
Hi,

This is my first attempt doing this and I have zero python knowledge, but I can follow a manual. I believe I've done this correctly, but the custom stop position doesn't work, no matter the aircraft, they stop at the default position. I've only done one stand to make sure I can make it work before continuing.


Can anyone help with what I've possibly done wrong please? The code is below, the COUATL log states Using airport customization from user Python with the correct file name and shows no errors, so I'm stumped. The manual states you should have a "." between aircraftData and icaoTypeDesignator (aircraftData.icaoTypeDesignator) however doing so creates a read error in the COUATL log, and the file is not loaded, removing it, doesn't create the error and the file is loaded. As I said, zero python knowledge, so I must be making a mistake somewhere.


Any help would be appreciated


# -- coding: utf-8 --

msfs_mode = 1
icao = "kjfk"

@AlternativeStopPositions
def customOffsetB2(aircraftDataicaoTypeDesignator):
        TableIcao = {
   "A319" : -7.30,
   "A320" : -7.30,
   "A321" : -7.30,
   "A21N" : -7.30,
   "A332" : 0.00,
   "A333" : 10.30,
   "A359" : 10.30,
   "A35K" : 16.90,
   "B738" : -7.30,
   "B38M" : -7.30,
   "B772" : 10.30,
   "B77W" : 16.90,
   "B788" : -2.30,
   "B789" : 10.30,
   "B78X" : 16.90,
   "CRJ2" : -7.30,
   "CRJ7" : -7.30,
   "CRJ9" : -7.30,
   "E170" : -7.30,
   "E175" : -7.30,
   "E75L" : -7.30,
   "E75S" : -7.30,
   "E190" : -7.30,
   "E195" : -7.30,
}

   return Distance.fromMeters(TableIcao.get(aircraftDataicaoTypeDesignator, 0))

def MyTerminalNames(name, letter, priority):
   return CustomizedName( "%s | Gate #%s§" % (name, letter), priority )
def MyApronNames(name, letter, priority):
   return CustomizedName( "%s | Stand #%s§" % (name, letter), priority )

Terminal8 = MyTerminalNames("Terminal 8", "", 1)
Terminal8ra = MyTerminalNames("Terminal 8 - Remote A", "", 1)
Terminal8rb = MyTerminalNames("Terminal 8 - Remote B", "", 2)
Terminal8rc = MyTerminalNames("Terminal 8 - Remote C", "", 2)
Terminal8rd = MyTerminalNames("Terminal 8 - Remote D", "", 2)
Terminal8ooo = MyTerminalNames("Terminal 8 - No Longer Exist", "", 3)

parkings = {

    GATE_B : {
        None : (),
        1 : (Terminal8, ),
     "1A" : (Terminal8ra, ),
     "1B" : (Terminal8rb, ),
     "1C" : (Terminal8rc, ),
     "1D" : (Terminal8rd, ),
        2 : (Terminal8, customOffsetB2),
        3 : (Terminal8, ),
        4 : (Terminal8, ),
        5 : (Terminal8, ),
        6 : (Terminal8, ),
        7 : (Terminal8, ),
        8 : (Terminal8, ),
       10 : (Terminal8, ),
       12 : (Terminal8, ),
       14 : (Terminal8, ),
       16 : (Terminal8, ),
       18 : (Terminal8, ),
       20 : (Terminal8, ),
    "31A" : (Terminal8ooo, ),
    "31B" : (Terminal8ooo, ),   
    "31C" : (Terminal8ooo, ),   
    "31D" : (Terminal8ooo, ),   
    "31E" : (Terminal8ooo, ),   
    "32F" : (Terminal8ooo, ),   
    "32G" : (Terminal8ooo, ),   
    "32H" : (Terminal8ooo, ),   
    "32I" : (Terminal8ooo, ),   
       33 : (Terminal8, ),   
       34 : (Terminal8, ),   
       35 : (Terminal8, ),   
       36 : (Terminal8, ),   
       37 : (Terminal8, ),   
       38 : (Terminal8, ),   
       39 : (Terminal8, ),   
       40 : (Terminal8, ),   
       41 : (Terminal8, ),   
       42 : (Terminal8, ),   
       43 : (Terminal8, ),   
       44 : (Terminal8, ),   
       45 : (Terminal8, ),   
       46 : (Terminal8, ),   
       47 : (Terminal8, ),   
    },
}

virtuali

  • Administrator
  • Hero Member
  • *****
  • Posts: 51931
    • VIRTUALI Sagl
Re: Custom Stop positions not working
« Reply #1 on: January 07, 2025, 03:34:40 pm »
Please don't quote Python code in a forum message, because the forum software might alter the formatting. ZIP the code and ATTACH it to a post, so it can be examined unmodified.

BAW217

  • Newbie
  • *
  • Posts: 4
Re: Custom Stop positions not working
« Reply #2 on: January 12, 2025, 05:34:00 pm »
As requested.

virtuali

  • Administrator
  • Hero Member
  • *****
  • Posts: 51931
    • VIRTUALI Sagl
Re: Custom Stop positions not working
« Reply #3 on: January 14, 2025, 11:12:35 am »
The problem is surely you have used aircraftDataicaoTypeDesignator without a dot, like the manual says. This is the correct form:

aircraftData.icaoTypeDesignator

The aircraftData is a Python object that contains several fields, and the dot separates the object name from it members, like this:

aircraftData.idMajor
aircraftData.idMinor
aircraftData.icaoTypeDesignator

Also, check the manual better about how to pass aircraftData when defining a custom alternative position function:

@AlternativeStopPositions
def customOffset_T1_Gates(aircraftData):


Here, you pass the aircraftData entire object, but when you use it inside the called function, you access the required member:


  TableIcao = {
  “B738” : -2.0,
  “B744” : 5.0,
  “A20N” : 1.0,
}
return Distance.fromMeters(TableIcao.get(aircraftData.icaoTypeDesignator, 0))
« Last Edit: January 14, 2025, 11:19:25 am by virtuali »