[RESOLVED] Sim Object

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Locked
skeadle6309
Posts: 15
Joined: Mon Feb 12, 2018 9:20 pm

[RESOLVED] Sim Object

Post by skeadle6309 »

I have been scrolling through the SDK documentation and have not been able to find any information on this... but I have UINT ObjectId and I am curious if there is anyway to get the name of the component with that id. Currently using the RayTraceManager to get the returnOnjectId but can not figure out what exactly the returning object is.

Thanks for any help
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Re: Sim Object

Post by BenBaron »

Hi,

you could use the ISimObjectManager and call the GetObject() method on it, which takes an UINT idObject. On the returned IBaseObjectV400 **ppObject you could then call GetTitle() which gives you a LPWSTR pszCfgTitle as out argument.

Greets, Benny
skeadle6309
Posts: 15
Joined: Mon Feb 12, 2018 9:20 pm

Re: Sim Object

Post by skeadle6309 »

Hi Benny,

Thanks for the assistance! So I have:


CComPtr<ISimObjectManagerV440> ObjectManager;
IBaseObjectV400 **ppObject;
...
ObjectManager->GetObject(ResObjID, ppObject);
...

I am able to see in debug mode that the ResObjId is passing the correct value but I am never getting a return **ppObject

Thanks
Seth
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Re: Sim Object

Post by BenBaron »

Hi Seth,

I'd suggest you define

Code: Select all

 CComPtr<IBaseObjectV400>  ppObject = nullptr; 
and then check the returned HRESULT of GetObject() for any problem as to why ppObject isn't filled:

Code: Select all

 HRESULT hr = ObjectManager->GetObject(ResObjID, &ppObject); 
Maybe this helps.

Greets, Benny.
skeadle6309
Posts: 15
Joined: Mon Feb 12, 2018 9:20 pm

Re: Sim Object

Post by skeadle6309 »

Benny,

Thank you that was it!

Seth
BenBaron
Posts: 80
Joined: Fri Jan 16, 2015 7:51 am

Re: Sim Object

Post by BenBaron »

Glad you got it solved.

All the best,

Benny
Locked