odwdinc / Python-SimConnect

Python interface for MSFS2020 SimConnect.dll
GNU Affero General Public License v3.0
270 stars 107 forks source link

Cannot spawn new aircraft #113

Open fyyyyy opened 2 years ago

fyyyyy commented 2 years ago

I figured out how to call the method without errors ( already corrected the AICreateNonATCAircraft args types as in issue #112 ) This script runs fine, but the aircraft doesn't seem to appear in MSFS at Lat 40,Lng-74

from SimConnect import *
from ctypes import *
sm = SimConnect()
aq = AircraftRequests(sm, _time=3)
ae = AircraftEvents(sm)

# get class definition for SIMCONNECT_DATA_INITPOSITION
sm_types = sm.dll.AICreateNonATCAircraft.__ctypes_from_outparam__()
INIT_POSITION = sm_types.argtypes[3]

initPos = INIT_POSITION(c_double(40), c_double(-74), c_double(2000), c_double(0), c_double(0), c_double(0), DWORD(0), DWORD(-1))

sm.dll.AICreateNonATCAircraft( sm.hSimConnect, c_char_p(b"Boeing 747-8f Asobo"), c_char_p(b"ABCD"), initPos, 123 )
bolichin commented 1 month ago

Hi, can someone explain if this is posible? I test the code but I obtain an error