Author Topic: [SOLVED] python api help. sdApplication.getLocationContext() return none  (Read 1015 times)

I'm trying to get selected nodes from tutorial.If I use the code below ,the getLocationContext() will return None.

import sd
context = sd.getContext()
sdApplication = context.getSDApplication()
pkgMgr = sdApplication.getPackageMgr()

sdLocationContext = sdApplication.getLocationContext()
print (sdLocationContext)

if I add sdApplication.setLocationContextUID(3) , it will work.

I can't find info about the contextUID. Which UID should I use ? What's the logic?

BTW, I saw some people using aContext beside sd.getContext.What's the aContext?

Last Edit: May 17, 2019, 09:57:43 am

As there can be many graph editors in SD, the location context is only valid within a plugin.
See INSTALL_DIR\resources\python\sdplugins\plugin_node_snap\" file for an example about how to deal with the selected nodes.
I hope it helps.
Best Regards
Lead Software Engineer - Substance Designer