odwdinc / Python-SimConnect

Python interface for MSFS2020 SimConnect.dll

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot spawn new aircraft

fyyyyy opened this issue · comments

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 )

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