Rhinoscript:points
From ksteinfeWiki
Contents |
Overview
The atomic unit of geometric modeling, you'll find that sooner or later, it all comes down to points. Euclid (the originator of Euclidean geometry) describes a point as "that which has no part". This strikes the computer programmer in me as strange, in that it's clear that a point clearly has three parts: three numbers which correspond to an X, Y, and Z coordinate in 3d space...
Data Structure
To get Rhino to make a point for us, we'll need to tell it how. This means we need to construct the proper data structure.
The data structure for a point is as easy as pi(e) - just a single 1d array of three double (or integer) numbers will do just fine.
Dim arrPoint
arrPoint = array(2.0,2.0,1.0)
Creation
Rhino.AddPoint()
The most direct way to create a point is just to call the Rhino.AddPoint() method and supply the proper data structure as an argument.
Dim arrPoint
arrPoint = array(2.0,2.0,1.0)
Call Rhino.AddPoint(arrPoint)
Often, for the sake of brevity, we will use the shortcut of simply creating an array on the fly in order to plot a point, thus sidestepping the creation of any sort of data structure in monkeybrainland.
Call Rhino.AddPoint(array(2.0,2.0,1.0))
Rhino.AddPoints()
Dim arrPtA,arrPtB,arrPtC,arrPtD
arrPtA = array(2.0,2.0,1.0)
arrPtB = array(2.0,1.0,0.0)
arrPtC = array(1.0,2.0,0.0)
arrPtD = array(2.0,0.0,1.0)
Call Rhino.AddPoints(array(arrPtA,arrPtB,arrPtC,arrPtD))
Rhino.AddPointCloud()
Dim arrPtA,arrPtB,arrPtC,arrPtD
arrPtA = array(2.0,2.0,1.0)
arrPtB = array(2.0,1.0,0.0)
arrPtC = array(1.0,2.0,0.0)
arrPtD = array(2.0,0.0,1.0)
Call Rhino.AddPointCloud(array(arrPtA,arrPtB,arrPtC,arrPtD))
ReDim arrPts(99)
Dim n
For n=0 To 99
arrPts(n) = array(Rnd()*2,Rnd()*2,Rnd())
Next
Call Rhino.AddPointCloud(arrPts)
