1129pt distance check

Option Explicit
‘Script written by Macus Chen
‘Script copyrighted by <insert company name>
‘Script version Wednesday, November 25, 2009 9:42:48 PM

Call Main()
Sub Main()

Dim arrObj, arrCrv, center1, center2, dist, i, j

Dim param, pt1,pt2

arrObj = rhino.GetObjects(“get test pts”,1)
arrCrv = rhino.GetObjects(“get curves to delete”,4)

Dim threshold
threshold = rhino.GetReal(“get threshold”,5)

rhino.AddLayer “void”, RGB(200,50,90)

rhino.EnableRedraw False

For i = 0 To Ubound(arrObj)
center1 = rhino.PointCoordinates(arrObj(i))

For j = 0 To Ubound(arrCrv)
param = rhino.CurveClosestPoint(arrCrv(j),center1)
pt1 = rhino.EvaluateCurve(arrCrv(j),param)

dist = rhino.Distance(center1,pt1)

If dist < threshold Then
rhino.ObjectLayer arrCrv(j),”void”
End If



rhino.EnableRedraw True

End Sub

Function bBoxCenter(obj)

Dim bbox
bbox = Rhino.BoundingBox(obj)
bBoxCenter = Array( (bbox(0)(0) + bbox(6)(0))/2, (bbox(0)(1) + bbox(6)(1))/2, (bbox(0)(2) + bbox(6)(2))/2 )

End Function

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s