Rhinoscript:meshes
From ksteinfeWiki
Contents |
Overview
TODO
Data Structure
To get Rhino to make a mesh for us, we'll need to tell it how. This means we need to construct the proper data structure.
The data structure for a mesh is one of the most complex that you might encounter in Rhinoscripting. It consists of two 2d arrays: one that defines the vertexes of the mesh, and another that describes how these vertexes are woven together into the faces of the mesh.
The code for producing a mesh might look something like what you see below.
ReDim arrPts(10)
arrPts(0)=array(2.09,1.00,1.36)
arrPts(1)=array(2.00,1.00,0.00)
arrPts(2)=array(3.51,3.25,2.72)
arrPts(3)=array(3.83,1.37,0.00)
arrPts(4)=array(1.23,1.26,2.72)
arrPts(5)=array(1.00,1.00,0.00)
arrPts(6)=array(3.49,3.26,1.36)
arrPts(7)=array(3.40,1.79,2.72)
arrPts(8)=array(1.11,1.13,1.36)
arrPts(9)=array(3.47,3.27,0.00)
arrPts(10)=array(2.19,1.04,2.72)
ReDim arrFaces(7)
arrFaces(0) = array(0,8,4,10)
arrFaces(1) = array(0,1,5,8)
arrFaces(2) = array(0,3,1,0)
arrFaces(3) = array(0,10,7,0)
arrFaces(4) = array(0,7,3,0)
arrFaces(5) = array(3,7,6,3)
arrFaces(6) = array(2,6,7,2)
arrFaces(7) = array(3,6,9,3)
Which would correspond with the mesh and data structure you see here.
To understand how this works, let's take it step-by-step and reproduce the mesh that we see below.
Mesh Vertices
Easiest to understand is the idea that all meshes have vertexes - that is to say, points which lie at the intersection of some number of edges of the mesh. These are the same points which are revealed when you "show control points" in Rhino.
Now, imagine that we wanted to describe the position of each of these points in Rhinoscript using an array. We know that arrays are numbered, so we might imagine that each of these points was labeled with the number which corresponded to it's index in this array.
Mesh Faces
(faces)
(combined)
(monkeybrainland faceints)
(monkeybrainland faceints connected one)
(monkeybrainland faceints connected all)
Creation
TODO
