Author Topic: py file custom parking spots for existing Gates  (Read 186 times)

MD-82

  • Jr. Member
  • **
  • Posts: 59
py file custom parking spots for existing Gates
« on: June 16, 2024, 11:28:42 am »
Hello Umberto,

I hope you can entertain me with an answer here. I am completely unfamiliar with coding or python, and I am only going by the manual. So, if this is too hard to explain in this situation just tell me. It is fine.

I have an airport that already has the correct names for the Gates. It is a relatively small airport with 6 gates. I only want to create stop positions for these 6 gates. Nothing else. No grouping, no custom names etc. My add-on bgl file to this airport already has correct naming conventions. Group>Gate, and individual gates are named Gate 1, Gate 2 etc. etc.
I am having trouble in the manual to find an example where no need for renaming, grouping or otherwise customizing parking spots is required. Just adding alternative stop positions to existing gate names. This is what I currently have in my .py file;

msfs_mode = 1
icao="TNCC"

parkings = {
     GATE : {
   },
}

@AlternativeStopPositions
def Gate(aircraftData):
   table = {
      0: 15.55,
   747: 0,
   777: 0,
   787: 1,
   11: 1,
...
        }
   try:
      return Distance.fromMeters( table.get(aircraftData.idMajor))
   except:
      return Distance()


Opening MSFS at the airport yields no errors in the log file, however, if I open at a gate with the MD-11 and "Reposition at current gate" the airplane does not move. It doesn't matter if I put 1 meter, 7 meters or whatever. The plane remains on the Stop Position.

Is there a part in the manual that gives an example of simply adding custom stop positions for the ordinary naming conventions already in the bgl? Or does this feature require creating custom alternative gate naming conventions?

Thank you,

Xander

virtuali

  • Administrator
  • Hero Member
  • *****
  • Posts: 50875
    • VIRTUALI Sagl
Re: py file custom parking spots for existing Gates
« Reply #1 on: June 19, 2024, 12:18:20 pm »
You don't see any changes, because you just defined the function which returns the custom stop distances, but is not assigned to any gate:


parkings = {
     GATE : {
   },
}


Most of the times, people customize the name, and then add the Stop position, so the example in the manual assume this, but of course you are not required to rename, so you can skip the name parameter with an extra comma, and define just the stop:


parkings = {
     GATE : {
        None : ( , Gate ),
   },
}


That, assuming your rule can be applied to all gates of the "GATE" group, so "None" has been used here. If you wanted to apply it to a single parking, it would be like this:


parkings = {
     GATE : {
        1: ( , Gate ),
   },
}


In this example, your custom stop position would be applied to just GATE 1