Jump to content
The simFlight Network Forums

rheitzman

Members
  • Posts

    17
  • Joined

  • Last visited

Posts posted by rheitzman

  1. Thanks - here is my modified code.

     

    This is a simple one button form that gets the lat/lon from the a/c and offers to open a chart web site.

     

    I used your format string but it had some non-numeric'ness to the returned string. I resorted to the deprciated, but handy, Val() to clean it up. The code is verbose, I didn't want to string a bunch of operations together for the post.

     

    Is there an elegant way to check to see if Open() was called and we're still connected?

     

    What's the check that the a/c is "ready?" (loaded by FSX/P3D and ready to respond)

     

    In the code sample I Open() once then error out on other calls. I close the conenction when the form closes. Bad technique?  If the form made other calls to other offsets would things get balled up? GetLatLongString() below should probably have some busy logic to avoid a second call from wherever.

     

    I couldn't find a good list of offsets - is FSUIPC4 Offsets Status.pdf the best available?

    Option Explicit On
    Imports FSUIPC 
    ' Project Reference to FSUIPCClient.dll
    Public Class frmACLocation
        Private Sub btnGetLatLong_Click(sender As Object, e As EventArgs) Handles btnGetLatLong.Click
            Try
                Dim sLatLon As String = GetLatLongString()
                If sLatLon <> "error" Then
                    If MsgBox("a/c Lat/Lon: " & sLatLon & vbCrLf & "Open Chart?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then 
                         Process.Start("http:\\skyvector.com/?ll=" & sLatLon & "&zoom=3")
                    End If
                End If
            Catch ex As Exception
                MsgBox(ex.Message, , "btnGetLatLong_Click")
            End Try
        End Sub
        Function GetLatLongString() As String
            Dim ofsLatitude As Offset(Of Long) = New Offset(Of Long)(&H560)
            Dim ofsLongitude As Offset(Of Long) = New Offset(Of Long)(&H568)
            Dim mlat As FsLatitude
            Dim mlon As FsLongitude
            Dim sLat As String = ""
            Dim sLon As String = ""
            Try             
                Try 
                    ' is there a better test to see if Open() has happened and we're connected
                    FSUIPCConnection.Open()
                Catch ex As Exception
                    ' assume already Open
                    ' next call with throw an error if that was not the case
                End Try
                FSUIPCConnection.Process()
                mlat = New FsLatitude(ofsLatitude.Value)
                mlon = New FsLongitude(ofsLongitude.Value)
                sLat = mlat.ToString(False, "d", 6)
                sLon = mlon.ToString(False, "d", 6)
                sLat = Val(sLat) ' strip off leading zeros and * symbol
                sLon = Val(sLon)
                Return sLat & "," & sLon
            Catch ex As Exception
                ' Badness occurred - show the error message
                MsgBox(ex.Message, , "GetLatLongString")
                Return "error"
            End Try
        End Function
        Private Sub frmACLocation_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
            Try
                FSUIPCConnection.Close()
            Catch ex As Exception
    
            End Try
        End Sub
    End Class
    
  2. Great tool! My BeattlesBlog connection stopped working after I installed P3D and I started looking around for solutions - this one is great!

     

    I think I did look at it ages ago via the old FSUIPC VB.Net demo but I think it required treading which is a huge pain. This tool (is there a short name?) seems to do the trick w/o any serious hoop jumping.

     

    In the VB.Net code below (VS2013 Express, .Net 4.0, FSX) is a minimal proof of concept of opening a connection on demand and getting the curretn lat/long and closing the connection - seems to work OK.

     

    How about garbage collection? This code would run in a "moving map" type tool that would stay open. The app has a button to "Center on the a/c" that gets clicked every once in awhile - it does not try to track the a/c. Can I call GetLatLongString() using the garabge collection code shown - or is it overkill, or?

     

    Also - for the latlong class - how to I get a decimal string instead of DDHHMMSS?

     

    Thanks!

     

    Option Explicit On
    Imports FSUIPC
    Public Class frmACLocation
        Dim ofsLatitude As Offset(Of Long) = New Offset(Of Long)(&H560)
        Dim ofsLongitude As Offset(Of Long) = New Offset(Of Long)(&H568)
        Dim mlat As FsLatitude
        Dim mlon As FsLongitude
        Dim mlatlon As New FsLatLonPoint

        Private Sub btnGetLatLong_Click(sender As Object, e As EventArgs) Handles btnGetLatLong.Click
            Try
                MsgBox(GetLatLongString)
            Catch ex As Exception
                MsgBox(ex.Message, , "btnGetLatLong_Click")
            End Try
        End Sub

        Function GetLatLongString() As String
            Try
                FSUIPCConnection.Open()
                FSUIPCConnection.Process()
                mlat = New FsLatitude(ofsLatitude.Value)
                mlon = New FsLongitude(ofsLongitude.Value)
                mlatlon = New FsLatLonPoint(mlat, mlon)
                Return mlatlon.ToString ' how to get decimal lat/lon?
                FSUIPCConnection.Close()
            Catch ex As Exception
                ' Badness occurred - show the error message
                MsgBox(ex.Message, , "OpenFSUIPC")
                Return "error"
            Finally
                ' cleanup required?
            '    ofsLatitude = Nothing
             '   ofsLongitude = Nothing
                mlat = Nothing
                mlon = Nothing
                mlatlon = Nothing
            End Try
        End Function
    End Class

  3. Has anybody sucessfully adding an area to airspace.txt?

    I'm trying to add Special Use Airspace and have the points. I copied the existing format and rebuilt the DB but they new area does not show up.

    Any ideas?

    I used a '3' in column 1 - not sure of its purpose. Lines are number10,20, etc. as other areas. I added the trailing tabs.

    Here's a typical line:

    3 W228 W228 H H A 10 26.95 -96.37 26.95 -96.37 H HOUSTON CENTER 126.625 M

  4. I'm really surprised no one has replied to this post.

    Maybe the answer is to simple for you old hands but for a new-be they are critical.

    I figured out the AIRAC was an executable and after some confusing word in the installer the patch is applied.

    I eventually found .....\Flight Simulator 9\Modules\FSNavigator\SidStar\readme.txt

    That described how to install the fsnavss8 files. I had already unzipped the files into the directory without deleting the old files. After finding the readme.txt I deleted all the .ss files and replacing them with the download. This process destroyed my user created SIDs.

    If anyone sees a problem with my procedure above (besides losing a couple of hours work on some SIDs) please reply.

  5. I see two downloads I think I need on the web site : fsnavss8.zip and AIRAC

    Fine - what do I do with them after I download them? I can't find either file mentioned in help.

    Also - the Options, Download SIDs/STARs

    Tried that several times and always disconnects before it finishes. What am I downloading and does one of the above replace it?

    TIA

    PS Download of SID/STARs finally went to completion when I tried it at 0200Z

  6. AIBridge is not required for FS2004/SB3 or FSInn integration...

    Maybe... but it seems to be required for TCAS - at least the one I'm using in an F16 on a private network(Apollo). FSInn was working fine, just the TCAS didn't have the "targets" it should have.

    I remove the beta FSInn and TCAS stopped working (slight possibility it wasn't working before I removed the beta - lots of other issues). I moved back to the beta which I believe installed/ran AIBridge (I assume it was FSInn, caus' I didn't run it but it shows up on the icon tray). In any case my TCAS is now working on the private nework. Mileage may vary on VATSIM, offline, etc.

  7. in the 2002 flight sim we had AI bridge which made it work but i can't seem to find one for 2004. Keep in mind that i only fly -online or not at all.

    There's a link for AIBridge on the web page I just gave you...

    The AIBridge link on the "Official" site leads to a dead end.

    Is version 1 from here: a good choice?

    http://www.simradar.com/File/Online_ATC/index.html

    ... didn't appear to work too well - seems to be looking for FS2002.

  8. Suppose you are inbound with no STAR on your filed plan and you are requested to fly a published arrival.

    How can you in a busy cockpit deal with that request?

    How about the case of: you have a STAR on your plan but it isn't the one ATC wants you to use. How can you easily drop an existing STAR and add a different one?

    I assume the answer would be applicable to SIDs as well.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.