This file contains hidden or 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 random | |
import lx | |
import lxu | |
import lxu.attributes | |
import lxifc | |
class SelOp(lxifc.SelectionOperation, lxu.attributes.DynamicAttributes): | |
def __init__(self): |
This file contains hidden or 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) |
This file contains hidden or 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 | |
host_svc = lx.service.Host() | |
# look over all lx.symbol.a_* constants, | |
for k, v in lx.symbol.__dict__.items(): | |
if k.startswith("a_"): | |
print(f"{k}: {host_svc.NumServers(v)}") |
This file contains hidden or 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
# definitions for hlsl to be used for unreal shaders, usf, ush etc... | |
--langdef=hlsl | |
--map-hlsl=+.ush | |
--map-hlsl=+.usf | |
# for now just catch all functions, | |
# [a-zA-Z2-4]+ should match any type identifier, | |
# [a-zA-Z_]+ should match the function names, | |
# \((([a-zA-Z2-4]+[[:space:]]+[a-zA-Z]+)([[:space:]]*[,]*[[:space:]]*))*\) should match any inputs to functions, | |
# \2 means the second group is the name, |
This file contains hidden or 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) |
This file contains hidden or 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 | |
notify_system = lx.service.NotifySys() | |
for i in range(notify_system.Count()): | |
notifier = notify_system.ByIndex(i) # get the lx.object.Notifier | |
name = notify_system.NameByIndex(i) # get the str name for the Nofifier | |
# attempt getting arguments for the notifier, | |
try: |
This file contains hidden or 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
@echo off | |
REM adds cl.exe to path | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" x64 | |
REM Set current dir to folder of this script | |
pushd %~dp0 | |
REM Then create and cd into build folder | |
mkdir build |
This file contains hidden or 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 | |
import modo | |
from math import isclose | |
mesh, = modo.Scene().selectedByType('mesh') | |
result = set() | |
with mesh.geometry as geo: | |
normals = set() |
This file contains hidden or 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 xml.etree.ElementTree as ET | |
import os | |
platform = lx.service.Platform() | |
configs = set() # all unique paths to config files | |
for i in range(platform.ImportPathCount()): | |
directory = platform.ImportPathByIndex(i) | |
for filename in os.listdir(directory): |
This file contains hidden or 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
#include <lx_log.hpp> | |
#include <lxu_log.hpp> | |
#include <lxu_command.hpp> | |
#define SRVNAME_COMMAND "hello.world" | |
class CHelloCommand : public CLxCommand | |
{ | |
public: | |
CLxUser_LogService log_service; |