Skip to content

Instantly share code, notes, and snippets.

@lukpazera
Created August 21, 2019 11:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukpazera/f8f501a35b3455157045734620867d9d to your computer and use it in GitHub Desktop.
Save lukpazera/f8f501a35b3455157045734620867d9d to your computer and use it in GitHub Desktop.
This is how to read evaluated setup channels using MODO python SDK. The crucial bit is using scene.SetupChannels() in line 11. Stolen from Foundry's coding slack channel.
scene_svc = lx.service.Scene()
sel_svc = lx.service.Selection()
pkt_trans = lx.object.ItemPacketTranslation(sel_svc.Allocate(lx.symbol.sSELTYP_ITEM))
sel_type = sel_svc.LookupType(lx.symbol.sSELTYP_ITEM)
for i in xrange(sel_svc.Count(sel_type)):
pkt = sel_svc.ByIndex(sel_type, i)
item = pkt_trans.Item(pkt)
scene = item.Context()
chanRead = lx.object.ChannelRead(scene.SetupChannels())
index = item.ChannelLookup(lx.symbol.sICHAN_XFRMCORE_WPOSMATRIX)
if index > -1:
matrix_val = chanRead.ValueObj(item, index)
matrix = lx.object.Matrix(matrix_val)
print matrix.Get4()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment