Skip to content

Instantly share code, notes, and snippets.

@yasushisakai
yasushisakai / .gitignore
Last active October 9, 2017 14:51
my django git ignore settings. using pycharm for development.
;; 2013.01.21
;; yasushisakai
;;
;; gitignore for Django using pyCharm
;;
;;files to ignore
settings.py
;;extensions to ignore
@yasushisakai
yasushisakai / CurrentLayer_cmd.py
Last active December 11, 2015 21:18
VERY VERY simple script to change the current layer to the selected object. I run this as a command and set "CL" as an alias. Maybe there is the same built-in command...similar I found was "ChangeToCurrentLayer",which changes the object's layer to the current layer. be sure to save this to the folder that rhino searches when opening.(Rhinoceros/…
import rhinoscript.userinterface
import rhinoscript.geometry
import rhinoscriptsyntax as rs
__commandname__ = "CurrentLayer"
def RunCommand( is_interactive ):
'''
@yasushisakai
yasushisakai / OffsetPointOnCurve_cmd.py
Last active December 14, 2015 04:19
creates a point in a curve with the given distance samething discorverd in... http://wiki.mcneel.com/developer/scriptsamples/curvearclengthpoint 入力:曲線、点、オフセット距離 出力:曲線上でオフセットされた点 似たような事をVBで発見、 http://wiki.mcneel.com/developer/scriptsamples/curvearclengthpoint
import rhinoscript.userinterface
import rhinoscript.geometry
import rhinoscriptsyntax as rs
__commandname__ = "OffsetPointOnCurve"
def RunCommand( is_interactive ):
'''
creates a point in a curve with the given distance
@yasushisakai
yasushisakai / bezierConnection_horizontal.js
Last active December 15, 2015 10:09
script for illustrator connects two objects in a bezier curve (horizontal)
/**
* Created with JetBrains WebStorm.
* Date: 12/05/02
* Time: 13:05
*/
sel = activeDocument.selection;
function getCenter(_obj){
var position = _obj.position;
@yasushisakai
yasushisakai / bezierConnection_vertical.js
Last active December 15, 2015 10:09
script for illustrator connects two objects in a bezier curve (vertical)
/**
* Created with JetBrains WebStorm.
* Date: 12/05/02
* Time: 13:05
*/
sel = activeDocument.selection;
function getCenter(_obj){
var position = _obj.position;
@yasushisakai
yasushisakai / export_to_ArchiCAD_3ds.py
Last active December 17, 2015 13:29
This script exports the current rhino file to 3ds format, separating it by layer. It was intended for exporting it to ArchiCAD which can be inserted as GDL
# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs
documentName = '.'.join(rs.DocumentName().split('.')[:-1])
path = '\\'.join(rs.DocumentPath().split('\\')[:-1])
print rs.LayerNames()
@yasushisakai
yasushisakai / sunPosition.py
Last active December 23, 2015 01:49
calculates the sun position in a given pos(lat,long) and time. See references inside code
# -*- coding: utf-8 -*-
import math
import datetime
#script for getting the sun position
def sunPosition(
@yasushisakai
yasushisakai / reflection.py
Created September 18, 2013 14:54
adding the reflection method.
# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs
import Rhino.Geometry.Vector3d as vec3d
def VectorReflection(_vector,_normal):
'''
反射ベクトルを求める
'''
n = rs.VectorUnitize(_normal)
@yasushisakai
yasushisakai / polarDiagram.py
Last active December 23, 2015 09:59
polar diagram WORK IN PROGRESS
import rhinoscriptsyntax as rs
import math
#再利用出来るように
#なるだけ関数として書くこと!!だらだら書かない!
#plots a point in the Polar Diagram
def plotToPolarGraph(_eye,_target,_graphRadius=1000.0):
angles=rs.Angle(_eye,_target)
orientation = angles[0]
elevationAngle = angles[1]
@yasushisakai
yasushisakai / deleteShortCurves.py
Created November 27, 2013 16:53
deletes short crap curves
import rhinoscriptsyntax as rs
threshold = 5 # curves under this length will be deleted
cnt = 0
for o in rs.AllObjects():
crv = rs.coercecurve(o)
if crv is not None:
length = rs.CurveLength(o)
if length < threshold: