General Tools

rvb Surface Slope Classification

rvb animation snippet example

Sample script to classify surface slope. It calculates the angle between the normal to the surface in its center and the vertical axis [by default, Z]. It then assigns a material color to the object depending on the value obtain in the angle calculation.

Option Explicit

'Script written by Adolfo Nadal

'Script by archiologics · www.archiologics.com

Call Main()

Sub Main()

Dim arrSrf, strSrf, arrNew 

arrSrf = Rhino.GetObjects("Select surfaces", 8, vbTrue)

If IsNull(arrSrf) Then Exit Sub

If Not isarray(arrSrf)  Then Exit Sub

Call Rhino.AddLayer("slopes analysis",255,vbtrue,vbfalse)

Call Rhino.ObjectLayer(arrSrf,"slopes analysis")

Dim value1, value2, value3, value4

'we ask the user to define the intervals we are going to use to classificate the surfaces

Call Rhino.print ("we are going to classificate the surfaces in 5 cases depending on the slope") 

value1 = Rhino.getInteger ("Please introduce the first threshold (%)to classificate the surfaces depending on the slope", 2)

value2 = Rhino.getInteger ("Please introduce the second threshold (%)to classificate the surfaces depending on the slope", 5)

value3 = Rhino.getInteger ("Please introduce the third threshold (%)to classificate the surfaces depending on the slope", 10)

value4 = Rhino.getInteger ("Please introduce the forth threshold (%)to classificate the surfaces depending on the slope", 25)

Continue Reading... see full rvb Surface Slope Classification

rvb Surface Hexagonal Grid

rvb animation snippet example

Simple script that shows how to create a line grid of hexagonal form based on the UV parameters of its control points, regardless and even distribution. Again, it is a perfect introduction if you are beginning to work with surfaces.More complex examples to come.

Option Explicit

'Script written by Adolfo Nadal

'Script by archiologics · www.archiologics.com

Call GridMaker

Sub GridMaker

Dim strSurface, arrPoints, arrCount

Dim arrpt1,arrpt2,arrpt3,arrpt4

strSurface = Rhino.GetObject("Select surface", 8)

If IsNull(strSurface) Then Exit Sub  

arrPoints = Rhino.SurfacePoints(strSurface)

If Not IsArray(arrPoints) Then Exit Sub

arrCount = Rhino.SurfacePointCount(strSurface)

Dim u, v

Dim ulast : ulast = arrCount(0)

Dim vlast : vlast = arrCount(1)

Dim i : i  = 0

For u = 0 To ulast - 2

For v = 0 To vlast - 2

i =v+u*vlast

arrpt1=arrPoints(i)

arrpt2=arrPoints(i+1)

arrpt3=arrpoints((u+1)*vlast+v+1)

arrpt4=arrpoints((u+1)*vlast+v)

Call addpolygon(arrpt1,arrpt2,arrpt3,arrpt4)

Next

Next

Call rhino.HideObject(strSurface)

End Sub

Continue Reading... see full rvb Surface Hexagonal Grid

rvb Surface Population

rvb animation snippet example

Simple script that shows how to evaluate and frame a surface. It uses the UV parameters of the surface in order to populate it with pretty much any geometry (which you can select as input, in form of polysurfaces]. It is a good introduction to the topology of NURBS surfaces. More complex examples to come.

Option Explicit

'Script written by Adolfo Nadal

'Script by archiologics · www.archiologics.com

Call WhoFramedTheSurface()

Sub WhoFramedTheSurface()

Dim idSurface : idSurface = Rhino.GetObject("Surface to populate", 8, True, True)

If IsNull(idSurface) Then Exit Sub

Dim strBlock, BoundingBox

Dim d1, d2 

Continue Reading... see full rvb Surface Population

rvb Move surface grips

rvb animation snippet example

This script shows how to move object grips with Rhinoscript.

Option Explicit

'Script written by Adolfo Nadal

'Script by archiologics · www.archiologics.com

Call Main()

Sub Main()

Dim strObject, arrGrips

strObject = Rhino.GetObject("Select surface", 8)

If Not IsNull(strObject) Then

Rhino.EnableObjectGrips strObject

Dim intCount, i

intCount = Rhino.ObjectGripCount(strObject)

For i = 0 To intCount

Rhino.SelectObjectGrip strObject, i

Next

arrGrips = Rhino.SelectedObjectGrips(strObject) 

Continue Reading... see full rvb Move surface grips