Professional Documents
Culture Documents
GRASSHOPPER
PRIMER
,
,
,
,
,
Grasshopper Rajaa Issa
Rajaa Robert McNeel and Associates
Rhino ArchCut PanelingTools
70
Scripting
Grasshopper 0.6.0007
Grasshopper Grasshopper
FLUX
Architecture in a Parametric LandscapeCalifornia College of
the Arts
http://www.grashopper.rhino3d.com
Andrew Payne
LIFT architects
www.liftarchitects.com
Rajaa Issa
Robert McNeel and Associates
http://www.rhino3d.com/
Shaper3d Grasshopper
Grasshopper
()
Jessesn/
Shaper3d
http://bbs.shaper3d.cn
Grasshopper
http://g.shaper3d.cn
1
2
3
4
5
6
Grasshopper
1
2
8
11
13
18
7
7.1
7.2
7.2
7.3
7.4
7.5
21
21
23
25
27
29
32
8
8.1
8.2
8.3
8.4
Excel
36
40
43
46
48
9
9.1
9.2
9.3
/
Point Attractors Vector/Scalar Mathematics ()
Point Attractors Vector/Scalar Mathematics ()
53
55
56
61
10
10.1
67
72
11
11.1
11.2
11.3
11.4
74
76
79
84
89
12
92
13
93
93
93
95
96
97
14
Visual Basic DotNET
14.1
14.2
14.3
14.4
14.5
14.6
14.7
14.8
14.9
14.10
14.11 Grasshopper
14.12 Grasshopper
14.13 /
100
100
100
100
101
103
104
104
106
107
110
113
114
116
15
15.1
15.2
15.3
15.4
15.5
15.6
15.7
15.8
15.9
15.10
15.11
15.12
15.13
NURBS
OnNurbsCurve
OnCurve
OnNurbsSurface
OnSurface
OnBrep
118
118
118
121
123
124
124
126
130
132
137
138
147
148
16
155
13.1
13.2
13.3
13.4
13.5
http://g.shaper3d.cn
Getting Started
Grasshopper
Grasshopper http://Grasshopper.rhino3d.com/. Download
Save Target As
http://g.shaper3d.cn
The Interface*
Rhino Grasshopper
Grasshopper
Rhino
* Source: RhinoWiki
http://en.wiki.mcneel.com/default.aspx/McNeel/ExplicitHistoryPluginInterfaceExplained.html
2
http://g.shaper3d.cn
C. Component Panels
"Params"
"Curves"
Grasshopper
Rhino
Grasshopper
_Grasshopper
http://g.shaper3d.cn
View
1.
2.
Photoshopwindows
3.
4.
Photoshop
5.
6.
7.
8.
9.Grasshopper Rhino
10
11.
14. View
http://g.shaper3d.cn
F: The Canvas
B
C
D
E /
G: UI Widgets
http://g.shaper3d.cn
View /
Grasshopper
http://Grasshopper.rhino3d.com Grasshopper
Grasshopper
http://g.shaper3d.cn
a)
b)
c)
d)
Rhino
http://g.shaper3d.cn
Grasshopper Objects*Grasshopper
Grasshopper
C
D
E
* Source: RhinoWiki
For plugin version 0.6.0007
8
http://en.wiki.mcneel.com/default.aspx/McNeel/ExplicitHistoryPluginObjectsExplained.html
http://g.shaper3d.cn
Data Inheritance
Component Parts
A
B
C
http://g.shaper3d.cn
Rhino
Rhino
/
R 1
10
http://g.shaper3d.cn
(
)
Vector
Vector
Single Multiple
Grasshopper Rhino
* Source: RhinoWiki
http://en.wiki.mcneel.com/default.aspx/McNeel/ExplicitHistoryPersistentDataRecordManagement.html
11
http://g.shaper3d.cn
Enter
12
http://g.shaper3d.cn
(
)
Surface Point
Point
* Source: RhinoWiki
http://en.wiki.mcneel.com/default.aspx/McNeel/ExplicitHistoryVolatileDataInheritance.html
For plugin version 0.6.0007
13
http://g.shaper3d.cn
14
http://g.shaper3d.cn
Shift
ADD
CTRL"REM"
15
http://g.shaper3d.cn
16
http://g.shaper3d.cn
Receiver
Receiver 1
17
http://g.shaper3d.cn
Data matching
A B
A B Grasshopper 3
Shortest List
Longest List
Cross Reference
* Source: RhinoWiki
http://en.wiki.mcneel.com/default.aspx/McNeel/ExplicitHistoryDataStreamMatchingAlgorithms.html
For plugin version 0.6.0007
18
http://g.shaper3d.cn
X,Y,Z
X : {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0}
Y : {0.0, 1.0, 2.0, 3.0, 4.0}
Z : {0.0, 1.0}
19
http://g.shaper3d.cn
20
http://g.shaper3d.cn
A) Constants
B) Expressions
C) Intervals
D) Operators
E) Polynomials
F) Trigonometry
G) Utility (Analysis) []
7.1 Operators
Scalar_operators.ghx
21
http://g.shaper3d.cn
Params/Special/ Numeric Slider -
Right click the slider to set:
Integer component
Post-it
Scalar/Operators/Add-
Add A
B
Params/Special/Panel-Post-it
R Post-it
Post-it
Subtraction
Multiplication
Division
Modulus
Power
A
B
5 Post-it
Post-it
22
http://g.shaper3d.cn
Scalar Operators 4
0.6.0007
Equality, Similarity, Larger Than, Smaller
Than
:
Conditional Statements.ghx.
A) Equality
List A List B
Ture False
Longest List
B) Similarity Equality
List A List B
Similarity
23
http://g.shaper3d.cn
24
http://g.shaper3d.cn
Scalar_intervals.ghx
.
0 1.
10 11
0 1. 11 10
3
Series-S 10
1 10 11.
10 series 1
10
25
http://g.shaper3d.cn
Interval Interval
Range
Range 0 Interval
A B
1020 Interval 10.0 20.0
Interval Range D Interval
Range Range 10
10 20 11 interval,
Scalar/Interval tab. Interval,
26
http://g.shaper3d.cn
911 10
.
True()
False()True()
False()
If/Else
Grasshopper
X
Scalar/Expression/F1. F x
5 5 r
5 r
Dispatch p
Dispatch
Dispatch L Dispatch P
Dispatch A Dispatch
B x 5
Circle
Curve/Primitive/Circle
Dispatch A Dispatch
27
http://g.shaper3d.cn
Dispatch
B
N-sided Polygon
(Curve/Primitive/Polygon) Dispatch B Polygon
R number slider 5 number
slider 5
If/Else
If_Else test.ghx
28
http://g.shaper3d.cn
Logic/Sets/Range Range
Params/Special/Slider
o
Name: Crv Length
o
Slider Type: Floating Point (this is set by defualt)
o
Lower Limit: 0.1
o
Upper Limit: 10.0
o
Value: 2.5
o
Name: Num Pts on Crv
o
Slider Type: Integers
o
Lower Limit: 1.0
o
Upper Limit: 100.0
o
Value: 100.0
Logic/Script/F1 Function
Function F Expression Editor
29
http://g.shaper3d.cn
Expression Editor
o
x*sin(5*x)
Errors No syntax
errors detected in expression
o
30
OK
cos sin
o OK
Range R Function X
Range 101 Function
Function
r
Vector/Point/Point XYZ Point XYZ
Function r Point X
Function r Point Y
Range R Point Z
Rhino
Curve/Spline/Curve Curve
Point Pt Curve V
Curve D
Curve degree 1
3 Bezier
http://g.shaper3d.cn
: Zach Downey :
http://www.designalyze.com/2008/07/07/generating-a-spiral-in-rhinos-Grasshopper-plugin/
31
http://g.shaper3d.cn
Function
Grasshopper scalar.,
(sine)cosinetangent
Theta
1822 Joseph
Fourier,
Fourier analysis.
slider
Grasshopper Source Files
Trigonometric_curves.Ghx
definition:
Params/Special/Slider -
Lower Limit: 1
Upper Limit: 50
Value: 40
Lower Limit: 0
Upper Limit: 30
Value: 10
Name: Frequency
Lower Limit: 0
Upper Limit: 30
32
http://g.shaper3d.cn
Value: 12
Logic/Sets/Range - Range
Wave Length Range D
Frequency Range D
Num Pts on Curve Range N
definition
0-10 0-12
Scalar/Trigonometry/Sine - Sine
Range-R Sine-x
Vector/Point/Point XYZ - Point XYZ
Range-R Point XYZ x
Sine-y Point XYZ-y
Rhino Range
Point x
Point y
Sine , y ,
33
http://g.shaper3d.cn
34
Params/Special/Slider
o
Name: Amplitude
o
Slider Type: Floating Point
o
Lower Limit: 0.1
o
Upper Limit: 5.0
o
Value: 2.0
Scalar/Operators/Multiplication Multiplication
Amplitude Multiplication A
Sin y Multiplication B
Multiplication r Point XYZ Y
Amplitude Sine
Sine Y
Amplitude
Vector/Point/Point XYZ Point XYZ
Range R Point XYZ X
Curve/Primitive/Line Line
Point Pt Line B
Point Pt Line A
x Sine
x Line x
Sine
http://g.shaper3d.cn
sine Sine
Cosine Tangent Cosine Tangent
Scalar/Trigonometry
: David Fano :
http://designreform.net/2008/06/01/rhino-3d-sine-curve-explicit-history/
35
http://g.shaper3d.cn
David Rutten
path{0}path
{0}01 2
path
36
http://g.shaper3d.cn
Rhino
Grasshopper curve Divide Curve
(Curve/Division/Divide Curve) 20 21
Polyline (Curve/Spline/Polyline),
Grasshopper
Polyline 0.600xx
Grasshopper Polyline
20
Parameter Viewer (Params/Special/Param
Viewer)
path{0;0} path{0;1}
37
http://g.shaper3d.cn
Grasshopper
Grasshopper
Logic/tree
Flatten Tree (Logic/Tree/Flatten Tree)
0.5
Flatten
38
http://g.shaper3d.cn
Grasshopper Polyline V
Flatten Parameter
Viewer
:
Rhino Curve Paths_base file.3dm.
Curve Paths.ghx
39
http://g.shaper3d.cn
8.1 &
Grasshopper
()
Grasshopper
List
Logic/Lists
:
List Management.ghx
40
http://g.shaper3d.cn
Series 0 1 10.
Series Post-it 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0,
9.0.
:
Post-it Post-it
0 1 2
-5
Series-S List Item-L List Item-i
5List Item
5.0
B) List Length (Logic/List/List Length)
Series-S List Length-L
41
http://g.shaper3d.cn
shift +1
E)
Split List
Split List
A - 0.0, 1.0, 2.0, 3.0, 4.0 B - 5.0, 6.0, 7.0,
8.0, 9.0
F) Cull Nth (Logic/Sets/Cull Nth) N N
Cull Nth-N
2 Cull Nth Cull Nth-L
0.0, 2.0, 4.0, 6.0, 8.0
3 Cull Nth 0.0, 1.0, 3.0, 4.0, 6.0, 7.0,
9.0
G) Cull Pattern (Logic/Sets/Cull Pattern) Cull Nth
Pattern
Ture()False()
42
http://g.shaper3d.cn
8.2
Weaving Data
Grasshopper
Weave Weave
Logics/Lists/Weave
:
Weave Pattern.ghrx
Grasshopper :
Logic/List/Weave Weave
P
0 1 Weave
43
http://g.shaper3d.cn
Params/Primitive/Integer
Manage Integer Collection""
0, 1, 2
44
Params/Primitive/String String
t String Manage String Collection "
"
http://g.shaper3d.cn
5
L0:A, L0:B, L0:C, L0:D, L0:E. L0
0
L1:A,
L1:B, L1:C, L1:D, L1:E
L2:A,
L2:B, L2:C, L2:D, L2:E
Weave-P
Weave-0
Weave-1
Weave-2
Params/Special/Post-it Panel Post-it Panel
Weave-W Post-it Panel
Post-it Panel
0
1 2
0
45
http://g.shaper3d.cn
8.3
Shifting Data
8.1 Shift
David RuttenGrasshopper
shift
http://en.wiki.mcneel.com/default.aspx/McNeel/ExplicitHistoryShiftExample.html
:
Shift Circle.ghx
Circle-C
Rhino "0,0,0"
Circle-R 10.0
46
http://g.shaper3d.cn
Vector/Constants/Unit Z Unit Z
F 10.0
X Form/Euclidean/Move Move
Unit Z-V Move-T
Circle-C Move-G
000 10
Move 10
Curve/Primitive/Line Line
Divid CurveP LineA
Shift-L Line-B
Shift
Shift Shift
47
http://g.shaper3d.cn
8.4 Excel
Grasshopper
:
dfinition Stream Contents_Excel.ghx
Range (Logic/Sets/Range)
0.0 10.0 Range-N 100
0.0 10.0 101
Graph Mapper (Params/Special/Graph Mapper)
Graph Mappper type Linear Range-R Graph
Mapper Post-it Panel Graph
Mapper
Graph Mapper linear Post-it Panel
Graph Mapper Square
Root
C:/Tutorials/Exporting
48
http://g.shaper3d.cn
Data/Stream_Contents.csv
Text Files (.txt), Comma Separated Values (.csv), Data Files (.dat)
Excel CSV
CSV CSV
row
(Get
External Data from Text)
49
http://g.shaper3d.cn
CSV
50
http://g.shaper3d.cn
Excel Excel
//
A1 101
A Grasshopper Post-It Panal Grasshopper
GRASSHOPPER CSV
GRASSHOPPER Graph Mapper
Sine
Post-it Panel
51
http://g.shaper3d.cn
Microsoft Excel
(Refresh All)
CSV Excel A
(Insert)
Graph Mapper
Grasshopper
Excel
(Refresh
All)
Excel
52
http://g.shaper3d.cn
Vector Basics()
A B
B A A B
Rhino XYZ
Rhino
53
http://g.shaper3d.cn
54
http://g.shaper3d.cn
Grasshopper Point/Vector
Vector/Point/Distance
A B
Vector/Point/Decompose
XYZ
Vector/Vector/Angle
Vector/Vector/Length
Vector/Vector/Decompose
XYZ
Vector/Vector/Summation
1 A
2 B
Vector/Vector/Vector2pt
Vector/Vector/Reverse
Vector/Vector/Unit Vector
Vector/Vector/Multiply
55
http://g.shaper3d.cn
56
http://g.shaper3d.cn
Params/Special/Numeric Slider
Params/Geometry/Point Point
implicit
xyz
Rhino
Rhino Point
xy
attractor point
Grasshopper
Point Set One Point
Rhino attractor point
attractor point
attractor point .
Vector/Point/Distance Distance
attractor point Distance A
rectangular Grid Point G Distance B
57
http://g.shaper3d.cn
Distance
D attractor point
58
Scalar/Operators/Division Division
Distance D Division A
Params/Special/Numeric Slider numeric slider
o
Name: Pt1 Influence
o
Slider Type: Floating Point
o
Lower Limit: 0.0
o
Upper Limit: 100.0
o
Value: 25.0
Pt1 Influence Division B
Circle
Scalar/Utility/Minimum Minimum
Division R Minimum A
Params/Special/Numeric Slider Numeric Slider
o
Name: Falloff
o
Slider Type: Floating Point
o
Lower Limit: 0.0
o
Upper Limit: 30.0
o
Value: 5.0
Falloff Minimum B
Curve/Primitive/Circle CNR Circle CNR (Center, Normal, and
Radius)
http://g.shaper3d.cn
attractor point
attractor point
point attractor
Rhino
Rhino "Point"
Rhino
XY
duplicated Point "Set One Point"
, Rhino attractor point
2 rectangular Point Grid
2 Minimum
Addition
Scalar/Operators/Addition Addition
Minimum R Addition A
59
http://g.shaper3d.cn
Minimum R Addition B
Addition R Circle R (:
)
60
http://g.shaper3d.cn
Vector/Scalar Mathematics
Grasshopper shader
61
http://g.shaper3d.cn
slider
o Slider Type: Integers
o Lower Limit: 0.0
o Upper Limit: 10.0
o Value: 3.0
slider
o
Slider Type: Integers
o
Lower Limit: 0.0
o
Upper Limit: 25.0
o
Value: 25.0
Logic/Sets/Series 1 Series
slider Series N
slider Series C
z
xy 3
7
7 z
series count
Series C Expression Tab
Expression editor (C*2)+1
Series C 1
3 Series count 7.
Vector/Constants/Unit Z Unit Z vector
Series S Unit Z F
Unit Z vector 7 z
25 slider
62
X Form/Euclidean/Move
http://g.shaper3d.cn
Params/Geometry/Point Point
Point Attractor Pt
Rhino
Rhino Point
Grasshopper Attractor Pt Set One Point
Rhino
X Attractor Pt
Grasshopper
Vector/Point/Distance Distance
Attractor Pt Distance A
Move G Distance B
Distance D
Attractor Pt
.
Scalar/Operators/Division Division
Distance D Division A
Params/Special/Numeric Slider Numeric Slider
o
Name: Scale Factor
o
Slider Type: Integers
o
Lower Limit: 0.0
o
Upper Limit: 25.0
o
Value: 25.0
Division B
63
http://g.shaper3d.cn
X Form/Affine/Scale Scale
Center Box B Scale G
Division R Scale F
Center Box Preview
box
64
http://g.shaper3d.cn
i-1
List Item E
attractor .
Params/Special/Gradient Gradient
List Item E () the Gradient
L0
List Item E () the Gradient
L1
Division R the Gradient T
TL0
box attractor L1
Gradient T
box
Kd: Shader
0-255
Ks: RGB
Ke: Shader emmissivity Shader
T: Shader
S: Shader 0 100
Gradient Shader
Gradient Box
Gradient
Gradient Gradient
spectrum
65
http://g.shaper3d.cn
rhino attractor
box
66
http://g.shaper3d.cn
10
Curve Types
Grasshopper Primitive Curve
Source Files
Curve Types.3dm 6
x-y
Grasshopper
67
http://g.shaper3d.cn
Grasshopper
Source Files Curve
Types.ghx
RhinoSet
Grasshopper
Point
Point Set
MultiplePoints.
Grasshopper 6 x
Grasshopper Point .
A) NURBS Curves
(Curve/Spline/Curve)
B
NURBS Rhino
NURBS
Degree Knot Weight
NURBS
http://en.wikipedia.org/wiki/NURBS.
URBS Curve V
Rhino
NURBS Curve D
1-11
David Rutten Rhinoscript 101 nurbs
68
http://g.shaper3d.cn
2 NURBS
2 NURBS
Rhino 4 NURBS
5 3
7 9 Rhino 11
curve D
NURBS Curve-P Inputt
. False NURBS ,True
69
http://g.shaper3d.cn
NURBS NURBS C
L D
0 X
.
NURBS Curve
.
P-input
C, L D outputs
D) Polyline Curves
(Curve/Spline/Polyline)
Rhino Polyline curve
Polyline curve
1
NURBS Polyline
curve Polyline
curve
1 NURBS
Interpolated Curve
70
http://g.shaper3d.cn
Polyline curve
V
C
Grasshopper
E) Poly Arc
(Curve/Spline/Poly
Arc)
Poly-arc
Polyline curve
71
http://g.shaper3d.cn
Component
72
Location
Description
Example
Curve/Analysis/Center
Curve/Analysis/Closed
Curve/Analysis/Closest
Point
Curve/Analysis/End Points
Curve/Analysis/Explode
Curve/Utility/Join Curves
Curve/Analysis/Length
Curve/Division/Divide
Curve
Curve/Division/Divide
Distance
http://g.shaper3d.cn
Curve/Division/Divide
Length
Curve/Utility/Flip
Curve/Utility/Offset
Curve/Utility/Fillet
Curve/Utility/Project
Brep (Brep
Rhino polysurface)
Intersect/Region/Split with
Brep(s)
Brep
Intersect/Region/Trim
with Brep(s)
Breps Ci(
) Co()
Intersect/Region/Trim
with Region(s)
Region
Ci() Co ()
Intersect/Boolean/Region
Union
Intersect/Boolean/Region
Intersection
Intersect/Boolean/Region
Difference
73
http://g.shaper3d.cn
11
Surface Types*
Rhino
NURBS NURBS
Rhino
s
NURBS NURBS
s
s
NURBS U V
NURBS
74
http://g.shaper3d.cn
Grasshopper NURBS
NURBS
Grasshopper
McNeel
Rhino Brep
Brep Rhino NURBS
NURBS
Brep NURBS
Grasshopper
Brep Brep
Numbers Integers, Colors Vectors, Arcs Circles
Curve
Number ( Curve )
Curve
Interval ( Curve )
Surface
Interval2D ( Surface uv )
String
Number ( string ,)
Interval2D Number ( interval area )
75
http://g.shaper3d.cn
:, Grasshopper SurfaceConnect.ghx
Source Files
76
http://g.shaper3d.cn
section curve
.
Surface/Freeform/Offset - Surface Offset
Sweep2Rail S Offset S
Params/Special/Slider - Numeric Slider
slider
o
Name: Surface Offset
o
Slider Type: Floating Point
o
Lower Limit: 0.0
o
Upper Limit: 10.0
o
Value: 10.0
slider Surface Offset D
10
77
http://g.shaper3d.cn
Sweep2Rail
Divide Surface UV 10 Divide Surface
10 ,
ISO
Surface Offset S Divide Surface S
Curve/Primitive/Line - Line
Divide Surface P Line A
Divide Surface P Line B
78
Surface/Freeform/Pipe - Pipe
Line L Pipe C
Params/Special/Slider - Numeric Slider
slider
o Name: Pipe Radius
o Slider Type: Floating Point
o Lower Limit: 0.0
o Upper Limit: 2.0
o Value: 0.75
Pipe Radius Pipe R
http://g.shaper3d.cn
Grasshoppper , GH
Paneling Tool.ghx, Source Files
79
http://g.shaper3d.cn
GH Rhino
Panel Tool_base.3dm ,,
,
Params/Geometry/Curve Curve
Rhino
Grasshopper Rhino
Surface/Freeform/Loft Loft
Curve Loft L
Loft O Rhino
: GH
,
Flip
Flip
Surface/Utility/Flip Flip
Loft L Flip S
Params/Geometry/Surface Surface
Flip S Surface
Surface Reparameterize
Reparameterize
80
http://g.shaper3d.cn
U-End 1.0
U-End 1.0
Params/Special/Slider - slider
slider
o
Name: U Interval
o
Slider Type: Integers
o
Lower Limit: 5.0
o
Upper Limit: 30.0
o
Value: 10.0
slider
o
Name: V Interval
o
Slider Type: Integers
o
Lower Limit: 5.0
o
Upper Limit: 30.0
o
Value: 10.0
U Interval slider Divide Interval U
V Interval slider Divide Interval V
81
http://g.shaper3d.cn
U V
10*10
100
U V slider
Params/Geometry/Geometry - Geometry
Geometry "Set Multiple Geometries"
Rhino spandrel panelmullion glazing panel
Surface Box
Bounding Box BoxMorph Brep
BoxMorph
82
http://g.shaper3d.cn
Morph Box
Windows
Bounding Box 100
U V
83
http://g.shaper3d.cn
Params/Geometry/Curve Curve
Rhino
Surface/Freeform/Loft Loft
Params/Geometry/Surface Surface
Loft L Surface
U V
84
http://g.shaper3d.cn
Isotrim S Brep B
o
85
http://g.shaper3d.cn
Curve/Primitive/Line - Line
List Item E Line A
List Item E Line B
List Item E Line A
List Item E Line B
Surface/Freeform/Pipe - Pipe
Line-L Pipe-C
Shift Line-L Pipe-C
slider pipe
Params/Special/Number Slider slider
slider
o
Name: Pipe Radius
o
Slider Type: Floating Point
o
Lower Limit: 0.0
o
Upper Limit: 1.0
o
Value: 0.05
Pipe Radius slider Pipe-R
86
http://g.shaper3d.cn
87
http://g.shaper3d.cn
Graph Mapper
88
http://g.shaper3d.cn
Isotrim
UV U Graph Mapper
Isotrim
89
http://g.shaper3d.cn
bezier
90
http://g.shaper3d.cn
12 An Introduction to Scripting
VB DotNETC#
Grasshopper
DotNET CLR
Rhino
Grasshopper Rhino DotNET SDK
Rhino Grasshopper DotNET
Rhino SDK
Grasshopper
Grasshopper VB DotNET
VB
DotNET Rhino DotNET SDK
91
http://g.shaper3d.cn
13
13.1
VB DotNet Logic Visual
Basic C#
X:
Y:
Out:
A:
13.2
x y
92
Parameter Name(
):
Run Time Message(
):
http://g.shaper3d.cn
Flatten (
):
List(
):
Type Hint(
):
On NURBS
93
http://g.shaper3d.cn
13.3
94
http://g.shaper3d.cn
13.4
out
95
http://g.shaper3d.cn
13.5
Edit Source
A:
B: Grasshopper_Custom_Script
C: VB.NET
D:
A:
dll DotNET
Rhino dll RMA.openNURBS RMA.Rhino rhino
Grasshopper
96
http://g.shaper3d.cn
B: Grasshopper_Custom_Script
Grasshopper_Custom_Script
97
http://g.shaper3d.cn
1. Members(
):
rhino app
doc Rhino
RhnioUtil
2. RunScript(
):
(doc )
RhUtil Rhino
1 2
98
http://g.shaper3d.cn
14
14.1
VB.NET
14.2 (comment)
VB.NET,
Grasshopper
This is a comment ,i I can write anything i like!
Realy anything
14.3 (Variables)
int32 32
x Int32 10.
20 x VB DotNET
Dim x as Int32 = 10
x 10
x = 20
x 20
Grasshopper
x:
y:
A:
99
http://g.shaper3d.cn
14.4
Array and lists
VB.NET
100
http://g.shaper3d.cn
VB.NET 9
101
http://g.shaper3d.cn
14.5
VB.NET
Type
Operator
Description
Mod
^=
*=
/=
\=
+=
-=
&=
<
<=
>
>=
<>
&
And
Not
Or
Xor
102
http://g.shaper3d.cn
14.6
IF<
>
>
if
Then <
End IF
If x < y Then x = x + y
End If
If x < y Then
x=x+y
End If
Else If Then
Else
If x < y Then
x = x + y End If
Else If x > y Then
x = x y End If
Else
x = 2*x
End If
End If
index
14.7
For Next
[/]
103
http://g.shaper3d.cn
[ Exit For ]
[ ]
[ Continue For ]
[ ]
for ( Next)
Next : for
Next
Next
[ For ]
Dim i As Integer
Dim place As String
Dim count As Integer = places_list.Count()
ForNext
[ ]
104
http://g.shaper3d.cn
[ Exit While ]
[ ]
[ Continue While ]
[ ]
While
End While
End While
[ While ]
while
Dim places_list As New List( of String )
places_list.Add( Paris )
places_list.Add( NY )
places_list.Add( Beijing )
Dim i As Integer
Dim place As String
Dim count As Integer = places_list.Count()
i=0
While i < count
(i<count)
place = places_list(i)
Print( place )
i=i+1
End While
14.8
105
http://g.shaper3d.cn
Grasshopper
106
http://g.shaper3d.cn
14.9
Grasshopper
ByRef
ByVal
:
As
RunScript
Sub
)
Function(
rc
Sub AddSub( ByVal x As Double, ByVal y As Double, ByRef rc As Double )
rc = x + y
End Sub
107
http://g.shaper3d.cn
rc = AddFunction( x, y ) rc
AddSub( x, y, rc )
rc
108
http://g.shaper3d.cn
14.10 Recursion
Grasshopper
(C).
(A). Slider
(L)
109
http://g.shaper3d.cn
DivideAndRotate
110
AllLines ()
http://g.shaper3d.cn
while
111
http://g.shaper3d.cn
112
http://g.shaper3d.cn
14.11 Grasshopper
Grasshopper
1.
2.
10
RunScript 10
DoubleList (of
Double)
RunScript
113
http://g.shaper3d.cn
14.12 Grasshopper
11a
A: Flatten()List()
B: List() List(
)
114
http://g.shaper3d.cn
C: 33
Flatten()
VB inside
115
http://g.shaper3d.cn
x y z
VB
116
http://g.shaper3d.cn
117
http://g.shaper3d.cn
15
15.1
Rhino .NET SDK OpenNURBS . .NET SDK
. :
http://en.wiki.mcneel.com/default.aspx/McNeel/Rhino4DotNetPlugIns.html
, Rhino SDK .
Grasshopper VB .
15.2 NURBS
Rhino Non-Uniform Rational Basis Spline B NURBS)
NURBS . NURBS
.
(http://en.wikipedia.org/wiki/NURBS)
NURBS . NURBS SDK
.
NURBS . Degree, control points, knots
evaluation rules:
Degree
123 5 . Rhino 1-11 .
:
1 NURBS
Order()= 2 ( = + 1)
2 NURBS .
.
Order() = 3.
Free form 3
NURBS .
Order ()= 4
5
118
http://g.shaper3d.cn
Control points
NURBS (+1).
.
Weight .
.
( 1), .
Grasshopper .
= 3
= 7
= (0,0,0,1,1,1,4,4,4)
:
.
119
http://g.shaper3d.cn
Evaluation rule
. .
,SDK .
. :(m_t(0))
(m_t(0)) .
NURBS
NURBS NURBS . NURBS
U V . Rhino
NURBS . NURBS
.
. NURBS
.
. .
NURBS .
120
http://g.shaper3d.cn
Polysurfaces
(). UV
. boundary representation ( BRep).
. ,
,, . BReps
.
OnBrep OpenNURBS , Rhino SDK
BReps.
- OnGeometry ( OnObject)
o OnPoint
OnBrepVertex
OnAnnotationTxtDot
o OnPointGrid
o OnPointCloud
o OnCurve (abstaract class)
OnLineCurve
OnPolylineCurve
OnArcCurve
OnNurbsCurve
OnCurveOnSurface
OnCurveProxy
OnBrepTrim
OnBrepEdge
o OnSurface (abstract classt)
121
http://g.shaper3d.cn
o
o
o
-
OnPlaneSurface
OnRevSurface
OnSumSurface
OnNurbsSurface
OnProxySurface
OnBrepFace
OnOffsetSurface
OnBrep
OnMesh
OnAnnotation
122
Miscellaneous
o OnBoundingBox (For objects bounding box calculation)
o OnInterval (Used for curve and surface domains)
o OnXform (for transforming geometry objects: move, rotate, scale, etc.)
o OnMassProperties (to calculate volume, area, centroid, etc)
http://g.shaper3d.cn
Constructor :
.
Public member variables :
. OpenNURBS
m_.
Public member functions :
.
Private members :
.
, auto-complete
. ,.
, auto-complete .
. On3dPoint :
. ,
On3dPoint . :
Use the constructor when you instantiate an instance of the point class
Dim new_pt as New On3dPoint( input_pt )
Use the = operator if the class provides one
Dim new_pt as New On3dPoint
new_pt = input_pt
You can use the New function if available
Dim new_pt as New On3dPoint
123
http://g.shaper3d.cn
new_pt.New( input_pt )
There is also a Set function sometimes
Dim new_pt as New On3dPoint
new_pt.Set( input_pt )
Copy member variables one by one.
Dim new_pt as New On3dPoint
new_pt.x = input_pt.x
new_pt.y = input_pt.y
new_pt.z = input_pt.z
OpenNURBS geometry classes provide Duplicate function that is very efficient to use
Dim new_crv as New OnNurbsCurve
new_crv = input_crv.DuplicateCurve()
Member variables
Notes
On2dPoint
x as Double
y as Double
.
d .
f.
On3dPoint
x as Double
y as Double
On4dPoint
x as Double
y as Double
z as Double
w as Double
Vector Addition:
Dim add_v As New On3dVector = v0 + v1
Vector Subtraction:
Dim subtract_vector As New On3dVector = v0 v1
124
http://g.shaper3d.cn
Vector dot product (if result is positive number then vectors are in the same direction):
Dim dot_product As Double = v0 * v1
Scale a vector:
Dim scaled_v As New On3dVector = factor * v0
125
http://g.shaper3d.cn
15.7 OnNurbsCurve
nurbs
Dimension 3
Order +1
Control Point
Knot Vector
Curve Type ().
126
http://g.shaper3d.cn
NURBS
7 4+ 4
127
http://g.shaper3d.cn
CV
weights
nurbs 1 nurbs
Gh
128
http://g.shaper3d.cn
NURBS
129
http://g.shaper3d.cn
15.8 OnCurve
NURBS
NURBS
OnCurve NURBS
Curves Types
OnLine
OnLineCurve
OnPolyline
OnPolylineCurve
OnCircle
OnArc
OnEllipse
130
http://g.shaper3d.cn
OnBezierCurve
OnEllipse OnPolyline
131
http://g.shaper3d.cn
15.9 OnNurbsSurface
OnNurbsCurve OnNurbsSurface
3
u v +1
u v
().
132
http://g.shaper3d.cn
1
0-1
u v
133
http://g.shaper3d.cn
OnSurface
Gh xy
134
http://g.shaper3d.cn
135
http://g.shaper3d.cn
136
http://g.shaper3d.cn
15
10 OnSurface
OpenNURBS OnSurface
OnSurface OnSurface
Basic Surface Types
OnPlane
OnPlaneSurface or
OnNurbsSurface (use OnPlane.GetNurbsForm() function)
OnShpere
OnRevSurface or
OnNurbsSurface (use OnShpere.GetNurbsForm() function)
OnCylinder
OnRevSurface or
OnNurbsSurface (use OnCylinder.GetNurbsForm() function)
OnCone
OnRevSurface or
OnNurbsSurface (use OnCone.GetNurbsForm() function)
OnBezierSurface
137
http://g.shaper3d.cn
15
11 OnBrep
(B-Rep) OnBrep
nurbs
nurbs
nurbs
brep brep
bounding a hole
OnBrep
OnBrep brep
138
http://g.shaper3d.cn
brep
OnBrepVertexArray m_V
OnBrepEdgeArray m_E
OnBrepTrimArray m_T
OnBrepFaceArray m_F
OnBrepLoopArray m_L
OnCurveArray m_C2
CnCurveArray m_C3
ONSurfaceArray m_S
Array of surfaces
139
http://g.shaper3d.cn
OnBrep
brep
brep
140
http://g.shaper3d.cn
OnBrep brep
OnBrep
OnBrep
brep
brep
OnSurface
o
SumSurface
o
RevSurface
o
PlanarSurface
o
OnSurface
o
OnUtil such as ON_BrepBox, ON_BrepCone, etc.
o
RhUtil such as RhinoCreatEdgeurface or RhinoSweep1
among others.
brep
141
http://g.shaper3d.cn
OnBrep
brep
brep
142
http://g.shaper3d.cn
OnBreps
OnGeometry
Trabsform OnXform 4
4 OnXform
OnBrep
OnBrep breps
breps
McNeels wiki DotNET brep
OnBrep
OnBrep brep
bounding box center
143
http://g.shaper3d.cn
OnBrep
OnBrep OnBrep
OnBrep,BoundingBox()OpenNURBSl
OnBoundingBox brep bounding box
144
http://g.shaper3d.cn
OnMassProperties
Istrue false
brep brep
OnBrep.IsSolid() brep
OnBrep
145
http://g.shaper3d.cn
brep
146
http://g.shaper3d.cn
15.12
OnXform
OnXform
147
http://g.shaper3d.cn
OnUtil
OnUtil
148
http://g.shaper3d.cn
OnUtil
OnUtil intersections
OnUtil
ON_Intersect 11
IOnLineI
Intersected geometry
output
Line parameters (t0 & t1) and Arc points (p0 & p1)
(t0 & t1)(p0 & p1)
Line parameters (t0 & t1) and circle points (p0 & p1)
(t0 & t1)(p0 & p1)
OnCircle
2 points (On3dPoint)
2 points (On3dPoint)
OnCircle
On3dPoint
OnLine
Parameter t (Double)
149
http://g.shaper3d.cn
RhUtil(Rhino )
Rhino
150
http://g.shaper3d.cn
151
http://g.shaper3d.cn
RhUtil.RhinoDivideCurve
RhinoDivideCurve:
Curve:
Num:
Len:
False: TRUE FALSE
True: TRUE FALSE
crv_p:
crv_t:
152
http://g.shaper3d.cn
RhUtil
RhinoInterpCurve:
3:
pt_array:
Nothing:
Nothng:
0:
On3dPoints nurbs
153
http://g.shaper3d.cn
154
http://g.shaper3d.cn
16 Help
http://en.wiki.mcneel.com/default.aspx/McNeel/Rhino4DotNetPlugIns.html
http://www.rhino3d.com/developer.htm
Rhino3d Grasshopper Rhino Grasshopper
Shaper3d http://bbs.shaper3d.cn
Grasshopper http://g.shaper3d.cn
Grasshopper
155
http://g.shaper3d.cn
Shaper3d
http://bbs.shaper3d.cn
Grasshopper
http://g.shaper3d.cn
/Jessesn
156