Recent

Author Topic: Basic Question from a beginner (Dummy would like to know)  (Read 11639 times)

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #15 on: January 18, 2018, 07:10:10 pm »
You can use ExtractFileExt to get the extension of a file.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #16 on: January 18, 2018, 08:15:39 pm »
No the extension on flight plan files have a one to many with the Sims.  But you could use it narrow it down to the ones that do use that Flight Plan Doc.
All the Flight plan doc are just text documents except one which is an HTML.

 
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #17 on: January 18, 2018, 08:20:48 pm »
You can use ExtractFileExt to get the extension of a file.

Is that a standard Pascal or Lazarus function.
It sounds like it would work except for the files KPHXKLAX._AOC_UPLINK.txt. TXT is the extention but would it return ".TXT" or  "._AOC_UPLINK.txt"
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #18 on: January 18, 2018, 08:35:34 pm »
It would return '.txt', i.e. it only takes notice of the last '.' character in the file name.
Whereas for your example of KPHXKLAX01_route it would return a blank string.
I presume that was not a typo for KPHXKLAX01._route

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #19 on: January 18, 2018, 08:51:19 pm »
It comes with unit SysUtils and it returns .txt.

If you want the second extension use ExtractFileName from the same unit then use ExtractFileExt

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #20 on: January 18, 2018, 09:05:46 pm »
It would return '.txt', i.e. it only takes notice of the last '.' character in the file name.
Whereas for your example of KPHXKLAX01_route it would return a blank string.
I presume that was not a typo for KPHXKLAX01._route

No it wasn't a typo.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #21 on: January 18, 2018, 09:11:51 pm »
Is the simulator associated with a flight plan always uniquely determined by the flight plan file extension?

Presumably the specific aircraft each flight plan is designed for is data found by parsing the file. Can you post a few example files so we can figure out how to deduce this information, so the correct plane type is associated with the each flight plan?
The more I look at this, the less it seems like a simple beginner's project ... so I think you'll need more help.

No the Flight plan file .fpl has a one to many relationship with Sims and Planes.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #22 on: January 18, 2018, 09:16:02 pm »
Here is one used by FSX:

<?xml version="1.0" encoding="UTF-8"?>

<SimBase.Document Type="AceXML" version="1,0">
    <Descr>AceXML Document</Descr>
    <FlightPlan.FlightPlan>
        <Title>KPHX to KJFK</Title>
        <FPType>IFR</FPType>
        <RouteType>HighAlt</RouteType>
        <CruisingAlt>33000</CruisingAlt>
        <DepartureID>KPHX</DepartureID>
        <DepartureLLA>N33° 26' 3.40",W112° 0' 41.70",+001135.00</DepartureLLA>
        <DestinationID>KJFK</DestinationID>
        <DestinationLLA>N40° 38' 23.73",W73° 46' 43.30",+000013.00</DestinationLLA>
        <Descr>KPHX to KJFK created by SimBrief</Descr>
        <DeparturePosition>26</DeparturePosition>
        <DepartureName>PHOENIX SKY HARBOR INTL</DepartureName>
        <DestinationName>KENNEDY INTL</DestinationName>
        <AppVersion>
            <AppVersionMajor>10</AppVersionMajor>
            <AppVersionBuild>61472</AppVersionBuild>
        </AppVersion>
        <ATCWaypoint id="KPHX">
            <ATCWaypointType>Airport</ATCWaypointType>
            <WorldPosition>N33° 26' 3.40",W112° 0' 41.70",+001135.00</WorldPosition>
            <ICAO>
                <ICAOIdent>KPHX</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="BROAK">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N33° 31' 49.83",W111° 13' 12.53",+000000.00</WorldPosition>
            <ATCAirway>FTHLS5</ATCAirway>
            <ICAO>
                <ICAOIdent>BROAK</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="FTHLS">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N33° 46' 5.05",W110° 21' 48.84",+000000.00</WorldPosition>
            <ATCAirway>FTHLS5</ATCAirway>
            <ICAO>
                <ICAOIdent>FTHLS</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="JNIPR">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N34° 2' 50.46",W109° 19' 22.25",+000000.00</WorldPosition>
            <ATCAirway>FTHLS5</ATCAirway>
            <ICAO>
                <ICAOIdent>JNIPR</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="JSSUA">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N34° 23' 3.42",W108° 0' 43.42",+000000.00</WorldPosition>
            <ATCAirway>FTHLS5</ATCAirway>
            <ICAO>
                <ICAOIdent>JSSUA</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="MAXXO">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N34° 23' 38.32",W106° 41' 47.78",+000000.00</WorldPosition>
            <ATCAirway>FTHLS5</ATCAirway>
            <ICAO>
                <ICAOIdent>MAXXO</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="ACH">
            <ATCWaypointType>VOR</ATCWaypointType>
            <WorldPosition>N35° 6' 42.14",W105° 2' 23.74",+000000.00</WorldPosition>
            <ICAO>
                <ICAOIdent>ACH</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="LBL">
            <ATCWaypointType>VOR</ATCWaypointType>
            <WorldPosition>N37° 2' 39.82",W100° 58' 16.31",+000000.00</WorldPosition>
            <ATCAirway>J231</ATCAirway>
            <ICAO>
                <ICAOIdent>LBL</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="VARNR">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N37° 35' 11.62",W98° 23' 57.79",+000000.00</WorldPosition>
            <ATCAirway>J134</ATCAirway>
            <ICAO>
                <ICAOIdent>VARNR</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="ICT">
            <ATCWaypointType>VOR</ATCWaypointType>
            <WorldPosition>N37° 44' 42.93",W97° 35' 1.79",+000000.00</WorldPosition>
            <ATCAirway>J134</ATCAirway>
            <ICAO>
                <ICAOIdent>ICT</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="ROKNE">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N37° 53' 10.62",W96° 48' 16.53",+000000.00</WorldPosition>
            <ATCAirway>J134</ATCAirway>
            <ICAO>
                <ICAOIdent>ROKNE</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="DOSOA">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N38° 10' 14.59",W95° 7' 36.53",+000000.00</WorldPosition>
            <ATCAirway>J134</ATCAirway>
            <ICAO>
                <ICAOIdent>DOSOA</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="BUM">
            <ATCWaypointType>VOR</ATCWaypointType>
            <WorldPosition>N38° 16' 19.49",W94° 29' 17.74",+000000.00</WorldPosition>
            <ATCAirway>J134</ATCAirway>
            <ICAO>
                <ICAOIdent>BUM</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="KK54K">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N39° 0' 0.00",W90° 0' 0.00",+000000.00</WorldPosition>
            <ICAO>
                <ICAOIdent>KK54K</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="KI57O">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N39° 30' 0.00",W86° 0' 0.00",+000000.00</WorldPosition>
            <ICAO>
                <ICAOIdent>KI57O</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="ROD">
            <ATCWaypointType>VOR</ATCWaypointType>
            <WorldPosition>N40° 17' 16.08",W84° 2' 35.15",+000000.00</WorldPosition>
            <ICAO>
                <ICAOIdent>ROD</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="DJB">
            <ATCWaypointType>VOR</ATCWaypointType>
            <WorldPosition>N41° 21' 29.03",W82° 9' 43.09",+000000.00</WorldPosition>
            <ICAO>
                <ICAOIdent>DJB</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="JHW">
            <ATCWaypointType>VOR</ATCWaypointType>
            <WorldPosition>N42° 11' 18.99",W79° 7' 16.70",+000000.00</WorldPosition>
            <ICAO>
                <ICAOIdent>JHW</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="HOXIE">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N41° 51' 54.04",W77° 51' 9.38",+000000.00</WorldPosition>
            <ATCAirway>J70</ATCAirway>
            <ICAO>
                <ICAOIdent>HOXIE</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="DMACK">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N41° 47' 8.73",W77° 33' 6.92",+000000.00</WorldPosition>
            <ATCAirway>J70</ATCAirway>
            <ICAO>
                <ICAOIdent>DMACK</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="STENT">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N41° 40' 44.57",W77° 9' 9.92",+000000.00</WorldPosition>
            <ATCAirway>J70</ATCAirway>
            <ICAO>
                <ICAOIdent>STENT</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="MAGIO">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N41° 31' 38.58",W76° 35' 47.38",+000000.00</WorldPosition>
            <ATCAirway>J70</ATCAirway>
            <ICAO>
                <ICAOIdent>MAGIO</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="LVZ">
            <ATCWaypointType>VOR</ATCWaypointType>
            <WorldPosition>N41° 16' 22.10",W75° 41' 22.07",+000000.00</WorldPosition>
            <ATCAirway>J70</ATCAirway>
            <ICAO>
                <ICAOIdent>LVZ</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="JENNO">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N41° 9' 10.53",W75° 19' 53.07",+000000.00</WorldPosition>
            <ATCAirway>LENDY6</ATCAirway>
            <ICAO>
                <ICAOIdent>JENNO</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="HARTY">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N41° 4' 16.28",W75° 5' 23.62",+000000.00</WorldPosition>
            <ATCAirway>LENDY6</ATCAirway>
            <ICAO>
                <ICAOIdent>HARTY</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="STW">
            <ATCWaypointType>VOR</ATCWaypointType>
            <WorldPosition>N40° 59' 44.95",W74° 52' 8.51",+000000.00</WorldPosition>
            <ATCAirway>LENDY6</ATCAirway>
            <ICAO>
                <ICAOIdent>STW</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="LENDY">
            <ATCWaypointType>Intersection</ATCWaypointType>
            <WorldPosition>N40° 54' 53.41",W74° 8' 6.93",+000000.00</WorldPosition>
            <ATCAirway>LENDY6</ATCAirway>
            <ICAO>
                <ICAOIdent>LENDY</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="LGA">
            <ATCWaypointType>VOR</ATCWaypointType>
            <WorldPosition>N40° 47' 1.38",W73° 52' 6.96",+000000.00</WorldPosition>
            <ATCAirway>LENDY6</ATCAirway>
            <ICAO>
                <ICAOIdent>LGA</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
        <ATCWaypoint id="KJFK">
            <ATCWaypointType>Airport</ATCWaypointType>
            <WorldPosition>N40° 38' 23.73",W73° 46' 43.30",+000013.00</WorldPosition>
            <ICAO>
                <ICAOIdent>KJFK</ICAOIdent>
            </ICAO>
        </ATCWaypoint>
    </FlightPlan.FlightPlan>
</SimBase.Document>

One used by X-Plane 11 and another Payware Aircraft in X-Plane and another SIM.
Payware aircraft have there own locations for their aircraft.

I
3 version
1
18
1 KMSP 842 44.881972 -93.221778
28 +44.080_-092.763 39000 44.080014 -92.763382
3 RST 39000 43.782903 -92.596961
11 ZZIPR 39000 43.185833 -91.659167
11 WELCM 39000 43.051300 -91.270381
11 TEEOO 39000 42.857672 -90.717178
11 MITEE 39000 42.701589 -90.279442
28 +42.643_-090.117 39000 42.642710 -90.116873
11 BHAWK 33000 42.518469 -89.776892
11 STNLE 26900 42.472789 -89.404039
11 CUUPP 22300 42.437906 -89.121506
11 CHMPN 21300 42.429875 -89.058803
11 CLSBY 18800 42.409111 -88.893742
11 FYTTE 15200 42.380061 -88.667792
11 MOTRR 12800 42.358492 -88.502875
11 COGSS 11000 42.344272 -88.394903
11 MADII 9600 42.300964 -88.313814
11 SOOLU 6000 42.196375 -88.147694
1 KORD 680 41.977319 -87.908006
0 ---- 0 0.000000 0.000000
0 ---- 0 0.000000 0.000000
0 ---- 0 0.000000 0.000000
0 ---- 0 0.000000 0.000000
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #23 on: January 18, 2018, 10:19:36 pm »
OK, so the aircraft type and simulator (and its version) are data known by the program user, but not embedded in the flight plan file which could be used for various aircraft?
So your app needs say a couple of dropdown comboboxes so the user can choose the simulator and aircraft appropriate for each flight plan, in order to know which of the various directories the plan needs to be copied to?

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #24 on: January 18, 2018, 11:21:54 pm »
Exactly right. Now there is one thing I can do to determine AIRAC CYCLES. When a Flight Plan is deposited to the Downloads Dir it has a date stamp on the file. I can determine the AIRAC Cycle by calculation. There are 12 Cycles in a year. The current cycle is 1801 or 2018 first month Jan. Next month it will be 1802.

But this only works if the user knows his current AIRAC Cycle installed and which one he has. AIRAC Cycles are installed on the local user drive and at SimBrief.

Users have to keep them in sync. And you have to have a subscription with Navigraph. Navigraph sends me an E-Mail every month notifying me that a new cycle is available. I login to Naviagraph and activate the new cycle. Feb will be 1802. That same day I run a program Navigraph supplies which will update my system with the new Cycle.

A subscription cost and some SIMer's don't subscribe but buy a spot Cycle. One every three or four months.  It makes Flight Planing more difficult, but it works.
 
So that lead me to believe I needed a second Form for all kinds of info including AIRAC Cycle info.

Just a simple little program.

I think I need a third form to scan the system and delete out of date flight plans.

I think list boxes would be better. Three List boxes. One with the AIRAC Cycle one for the Flight Plans and one for the aircraft . Then a row of check boxes with labels of the Simulator you want updated.

Highlight the flight plan, highlight an aircraft and check off the simulators you have installed and hit install.

A lot of Simer's have two and three different Simulators on one PC. I have two, both X-Plane 11.05 and X-Plane 11.11.

But some like to do beta testing for X-Plane and can have up to 4 Beta's. Those are the same people who like to get root canals.

 
« Last Edit: January 19, 2018, 12:47:11 am by JLWest »
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #25 on: January 21, 2018, 11:03:18 pm »
Attached is a skeleton app that attempts to cover some of your requirements. As mentioned before, this is quite an ambitious task for a beginner project in Lazarus, so don't be put off if some of the code looks daunting.

I've inserted the odd comment in the code to indicate where further work is needed.
In particular I don't think I've understood correctly how a flight plan's ultimate destination directory is determined. I think it is influenced by extension, aircraft type and choice of simulator. You'll almost certainly need to alter the TFlightPlan.GetDestFolder routine to give the right results according to the proper criteria, but anyway I hope this will get you started.
It's developed on Linux, and you're clearly a Windows user, so that may cause problems I have not foreseen.

If it compiles and runs for you, the first thing to do is to set the location of the flight plan download folder.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #26 on: January 21, 2018, 11:42:29 pm »
"In particular I don't think I've understood correctly how a flight plan's ultimate destination directory is determined."

Plans are downloaded without any information as to the Aircraft they are to be used with.
However, they are built for a paticular aircraft.

Rules for where a plan must be installed.

1. Plans for all X-Plane 11 planes:
   x:-Plane 11\output\Flight Plans\
   Note: X-Plane 11 can be installed anywhere and under any dir name.
           f:\Simulator\ - would be valid.old.
2. Payware aircraft can require plans be installed anywhere.

Payware aircraft are planes you buy that will work with X-Plane.        
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #27 on: January 22, 2018, 12:04:38 am »
Attached is a skeleton app that attempts to cover some of your requirements. As mentioned before, this is quite an ambitious task for a beginner project in Lazarus, so don't be put off if some of the code looks daunting.

I've inserted the odd comment in the code to indicate where further work is needed.
In particular I don't think I've understood correctly how a flight plan's ultimate destination directory is determined. I think it is influenced by extension, aircraft type and choice of simulator. You'll almost certainly need to alter the TFlightPlan.GetDestFolder routine to give the right results according to the proper criteria, but anyway I hope this will get you started.
It's developed on Linux, and you're clearly a Windows user, so that may cause problems I have not foreseen.

If it compiles and runs for you, the first thing to do is to set the location of the flight plan download folder.

WOW - it compiled and ran. Wow it looks great. You understood it pretty good.
 Where did you get the airplanes?


FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #28 on: January 22, 2018, 12:18:49 pm »
Where did you get the airplanes?

I know nothing about airplanes or flight simulation. I simply used the names you gave in earlier posts in this thread.
Hence the incompleteness of the skeleton I produced.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Basic Question from a beginner (Dummy would like to know)
« Reply #29 on: January 22, 2018, 07:29:04 pm »
If you saw the movie Scully where they were trying to duplicate his Landing on the Hudson.
The software ruining that Simulator was probably X-Plane 11 Pro. It used in flight schools all over the world. P3D is used to train military pilots. They are very realistic.

My version of X-Plane for the public. It's not expensive $80, but the payware planes can cost 60 to 90 dollars.
 
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018