Skip to content

Instantly share code, notes, and snippets.

@rondreas
Created June 14, 2022 16:11
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/5030dcd957e85ee0e3ad793658ab9142 to your computer and use it in GitHub Desktop.
Save rondreas/5030dcd957e85ee0e3ad793658ab9142 to your computer and use it in GitHub Desktop.
import lx
import lxu
# get the current active scene and a channel read object,
scene = lx.object.Scene(lxu.select.SceneSelection().current())
channel_read = lx.object.ChannelRead(scene.Channels(None, 0))
# using the channel read get the workplane position and rotation
workplane_position = scene.WorkPlanePosition(channel_read)
workplane_rotation = scene.WorkPlaneRotation(channel_read)
# create a matrix object and set it to the inverse of the workplane,
value_service = lx.service.Value()
matrix = lx.object.Matrix(value_service.CreateValue(lx.symbol.sTYPE_MATRIX4))
matrix.Set3(workplane_rotation)
matrix.SetOffset(workplane_position)
matrix.Invert()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment