wiki.ksteinfe.net
Personal tools
 

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.

2582095594_5160991702_o.jpg

To understand how this works, let's take it step-by-step and reproduce the mesh that we see below.

2582095626_cfe9d9091b_o.jpg

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.

2582095662_f6818286ff_o.jpg

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.

2582095724_30ca41a47e_o.jpg

2582208104_f717d85721_o.jpg

Mesh Faces

2582095804_1a34780dce_o.jpg (faces)

2582095844_0226743414_o.jpg (combined)

2581378875_f0b00cb48d_o.jpg (monkeybrainland faceints)

2581378913_1a088b81c6_o.jpg (monkeybrainland faceints connected one)

2581378947_d0dc84d522_o.jpg (monkeybrainland faceints connected all)

Creation

TODO