Skip to content

Instantly share code, notes, and snippets.

@radio412
radio412 / gist:2b117658f0a34b3f5a26
Created April 7, 2015 15:37
Export obj, dae, and stl files from Rhino 3d via layers, grouped as layers or as individual objects.
import os
import scriptcontext
import rhinoscriptsyntax as rs
print "//export run started/////////////"
# this function via mcneel/rhinoscriptsyntax
#https://github.com/mcneel/rhinoscriptsyntax/blob/master/Scripts/rhinoscript/layer.py
def layerNames(sort=False):
@radio412
radio412 / gist:6f0f1d0087c956742f49
Created March 27, 2015 21:04
Applying a non-linear data pattern to a measure
establishCurve = function(curveArray,sumTotal,inverse){
if(inverse){
var maxVal = Math.max.apply(Math, curveArray);
var minVal = Math.min.apply(Math, curveArray);
curveArray = curveArray.map(function (x) {
return (maxVal-x)+minVal;
});
}
var curveTotal = curveArray.reduce(function(a, b) {
return a + b;
on searchReplace(theText, SearchString, ReplaceString)
set OldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to SearchString
set newText to text items of theText
set AppleScript's text item delimiters to ReplaceString
set newText to newText as text
set AppleScript's text item delimiters to OldDelims
return newText
end searchReplace