Created
June 14, 2022 16:11
-
-
Save rondreas/5030dcd957e85ee0e3ad793658ab9142 to your computer and use it in GitHub Desktop.
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 | |
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