Created
September 22, 2022 08:57
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Better solution is using
lxu.unknownInfo(obj)