-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExtrudeCurveNormal.rvb
More file actions
39 lines (30 loc) · 1.03 KB
/
Copy pathExtrudeCurveNormal.rvb
File metadata and controls
39 lines (30 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' ExtrudeCurveNormal.rvb -- January 2010
' If this code works, it was written by Dale Fugier.
' If not, I don't know who wrote it.
' Works with Rhino 4.0.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Sub ExtrudeCurveNormal
' Local variables
Dim crv, dist
Dim plane, zaxis, delta, target
' Get curve to extrude
crv = Rhino.GetObject("Select curve to extrude", 4, True)
If IsNull(crv) Then Exit Sub
' Get extrusion distance
dist = Rhino.GetReal("Extrusion distance", 1, 0.01)
If IsNull(dist) Then Exit Sub
' Get current view's construction plane
plane = Rhino.ViewCPlane()
' Plane origin
origin = plane(0)
' Plane normal
zaxis = plane(3)
' Scale the normal vector by user's distance
delta = Rhino.VectorScale(zaxis, dist)
' Calculate target point
target = Rhino.PointAdd(origin, delta)
' Do the extrusion
Call Rhino.ExtrudeCurveStraight(crv, origin, target)
End Sub