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

MD-82

  • Jr. Member
  • **
  • Posts: 80
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: 53111
    • 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

MD-82

  • Jr. Member
  • **
  • Posts: 80
Re: py file custom parking spots for existing Gates
« Reply #2 on: June 17, 2025, 09:30:08 am »
Hello Umberto,

thanks for your reply. In the meantime, there is a new TNCC version out. And I have decided again to start this. I have read the manual again and made a base .py file.
Unfortunately, it gives me an error that I cannot figure out why. Since the error starts already at the first custom line, I decided to remove everything else and focus on
formatting for that line. I have attached the Gate Name in SIM, together with the .py and error file.

As you can see from the .py file, I copied the sample exactly over from the GSX manual since in both the example and the airport, there exists a "Gate 1". It still gives me
an error. The 2nd error from 1 : (CustomizedName(“Main Terminal|Gate 01”), customOffset_Main_Terminal_Gates ), was from when I still had my first attempt at
a full set, including all parking spots and a start off list of custom stop positions. But since I could not get it working, I have backed up that file and started from scratch.

What am I doing wrong?

MD-82

  • Jr. Member
  • **
  • Posts: 80
Re: py file custom parking spots for existing Gates
« Reply #3 on: June 18, 2025, 01:50:57 pm »
[CLOSED] - Answered over on Discord. Thank you.