This short but effective script is selecting the highest point of a cloud and then drawing a trajectory from this one to the next one in terms of height until it reaches the lowest point. That is a nice starting for the machine to know how to remove tires from a mountain given their center points.
Option Explicit
‘If it is working then scripted by Eduardo Mayoral
‘If Not scripted by anyone else
‘Script version Saturday, October 04, 2008 5:40:27 PM
Call Trajectory()
Sub Trajectory()
’============================================
’ Points Selection
’============================================
Dim arrStPt : arrStPt = Rhino.GetPointCoordinates(“Select Points”)
Dim i, j
For i = 0 To UBound(arrStPt)
Dim arrPts, arrBBox, maxZ, arrPt, pt
arrPts = ObjectsByType(1)
’============================================
’ Getting Highest Point
’============================================
arrBBox = Rhino.BoundingBox(arrPts)
maxZ = arrBBox(4)(2)
’Rhino.Print(maxz)
For Each arrPt In arrPts
pt = Rhino.PointCoordinates(arrPt)
If Abs(pt(2)- maxZ) <= 0 Then
arrStPt(i) = Rhino.PointCoordinates(arrPt)
Rhino.DeleteObject(arrPt)
End If
Next
Next
’============================================
’ Drawing Trajectory
’============================================
For j = 1 To UBound(arrStPt)
Dim k : k = j-1
Dim Lines, Trajectory
Call Rhino.AddLine(arrStPt(j), arrStPt(k))
Next
Lines = Rhino.ObjectsByType(4)
Trajectory = Rhino.JoinCurves(Lines)
Rhino.DeleteObjects(Lines)
End Sub
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.