Skip to content

Instantly share code, notes, and snippets.

@rondreas
Created September 22, 2022 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rondreas/6d9c7b2a1afba4fbfe173920462234c9 to your computer and use it in GitHub Desktop.
Save rondreas/6d9c7b2a1afba4fbfe173920462234c9 to your computer and use it in GitHub Desktop.
Often you end up getting a lx.object.Unknown from Modo's API, this will test the object against all "interfaces" and return list of potentially supported types.
import lx
def get_ifc(obj):
""" From a given object in lx sdk, find supported interfaces"""
supported_interfaces = []
for name, ifc in lx.object.__dict__.items():
try:
if isinstance(ifc, type):
o = ifc(obj)
supported_interfaces.append(ifc)
except TypeError as e:
pass
return supported_interfaces
@rondreas
Copy link
Author

Better solution is using lxu.unknownInfo(obj)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment