Skip to content

Instantly share code, notes, and snippets.

View cmStringLength.py
import lx
import lxu.meta
class StringLength(lxu.meta.ChannelModifier):
def init_chan(self, desc):
desc.add ("input", lx.symbol.sTYPE_STRING)
desc.chmod_value (lx.symbol.fCHMOD_INPUT)
desc.add ("length", lx.symbol.sTYPE_INTEGER)
desc.chmod_value (lx.symbol.fCHMOD_OUTPUT)
@rockjail
rockjail / meshOpCurveGroup.py
Created Jan 4, 2018
Manual implementation of a MeshOperation in python for Modo. This is an example showing how to read from a CurveGroup on items connected on a custom graph.
View meshOpCurveGroup.py
#python
import lx
import lxu
import lxifc
sSERVER_NAME = "mopCurveGroup"
sGRAPH_NAME = sSERVER_NAME + ".graph"
sGRAPH_USERNAME = sSERVER_NAME + ".graphUserName"
sCHAN_COUNT = "count"
View mop2PointCurve.py
#python
import lx
import lxifc
SERVER_NAME= "mop.2PointCurve"
class pointVisitor(lxifc.Visitor):
def __init__(self, pointObj, markMode):
self.pointObj = pointObj
self.values = []
View sunflower.py
# !/usr/bin/env python
#sunFlower
# base on https://commons.wikimedia.org/wiki/File:SunflowerModel.svg
# also because of http://community.thefoundry.co.uk/discussion/topic.aspx?f=4&t=114228
# main thread http://community.thefoundry.co.uk/discussion/topic.aspx?f=4&t=114228
# small changes to include the orientation
# eulerToMatrix function from here: https://gist.github.com/Farfarer/4fb11fc8d4290241e92b
import lx
import math
View CMDcurvessmooth.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This Command will smooth the transition between two conected curves.
"""
import lx
import lxu.command
import lxifc
@rockjail
rockjail / rotationAnglesFromMatrix.py
Created Sep 21, 2014
This script builds a rotation matrix based on 3 selected verts. It then calculates the euler angles.
View rotationAnglesFromMatrix.py
#python
import lx
import lxu.vector
import math
# this something I got from stackoverflow some time ago
# if you'd like to know more about it have a look at this: http://www.soi.city.ac.uk/~sbbh653/publications/euler.pdf
def getRot2(m):
if m[0][0] == 1.0:
x = math.atan2(m[0][2],m[2][3])
You can’t perform that action at this time.