Skip to content

Instantly share code, notes, and snippets.

@GregMalick
GregMalick / shootRay
Last active September 24, 2019 11:25
''' this Command fires a ray down the +Z axis of a locator at a mesh
and selects any poly that the ray intersects
does not yet handle animated positions
Command format:
shootRay LocatorName MeshName '''
NAME_CMD_SHOOTRAY = "shootRay"
NAME_ARG_LOCATOR = "StrLocatorName"
NAME_ARG_MESH = "StrMeshName"
# a snippet from farfarer
# To read the selection sets the polygon belongs to;
# Create a StringTag object - this lets you read tags applied to an object.
# In this case, we're setting it to read tags for the polygon accessor (called polygon_loc in this code).
# Then a quick test to check if it's actually localised OK.
tag_loc = lx.object.StringTag()
tag_loc.set(polygon_loc)
if not tag_loc.test():
import lx
import lxu.command
import traceback
class CmdMyCustomCommand (lxu.command.BasicCommand):
def cmd_Flags (self):
return lx.symbol.fCMD_MODEL | lx.symbol.fCMD_UNDO
def cmd_Enable (self,msg):
return True
def cmd_Interact (self):