Jun 262012
 

# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs

obj = rs.GetObject("反転させるオブジェクトを選択")

if obj:
	start = rs.GetPoint("対称軸の始点を選択")
	end = rs.GetPoint("対称軸の終点を選択")
	
	if start and end:
		rs.MirrorObject( obj, start, end, True )

(作成:中村健太郎)

Jun 262012
 

# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs

obj1 = rs.GetObject(message = "select first line")
obj2 = rs.GetObject(message = "select second line")

#obj1 LineLineIntersection()のための引数を準備
startpoint1 = rs.CurveStartPoint(obj1)
endpoint1 = rs.CurveEndPoint(obj1)
line1 = (startpoint1,endpoint1)

#obj2 LineLineIntersection()のための引数を準備
startpoint2 = rs.CurveStartPoint(obj2)
endpoint2 = rs.CurveEndPoint(obj2)
line2 = (startpoint2,endpoint2)

#交点をもとめる
points = rs.LineLineIntersection(line1,line2)

#交点が線分上にあるかどうかの判定 各ポイントのX座標を比較して判定する
a = int(startpoint1[0])
b = int(points[0][0])
c = int(endpoint1[0])
if a<b & b<c:
	pt = rs.AddPoint(points[0])
	#点の色を赤にする
	rs.ObjectColor(pt,color = [255,0,0])
elif a>b & b>c:
	pt = rs.AddPoint(points[0])
	#点の色を赤にする
	rs.ObjectColor(pt,color = [255,0,0])
else:
	print "線分上に交点がありません"

(作成:中村健太郎)

Jun 262012
 

# -*- coding: utf-8 -*-
import rhinoscriptsyntax as rs

obj1 = rs.GetObject(message = "select first line")
obj2 = rs.GetObject(message = "select second line")

#obj1 LineLineIntersection()のための引数を準備
startpoint1 = rs.CurveStartPoint(obj1)
endpoint1 = rs.CurveEndPoint(obj1)
line1 = (startpoint1,endpoint1)

#obj2 LineLineIntersection()のための引数を準備
startpoint2 = rs.CurveStartPoint(obj2)
endpoint2 = rs.CurveEndPoint(obj2)
line2 = (startpoint2,endpoint2)

#交点をもとめる
points = rs.LineLineIntersection(line1,line2)
pt = rs.AddPoint(points[0])
#点の色を赤にする
rs.ObjectColor(pt,color = [255,0,0])

(作成:中村健太郎)