-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFilletCorners.rvb
More file actions
64 lines (45 loc) · 1.57 KB
/
FilletCorners.rvb
File metadata and controls
64 lines (45 loc) · 1.57 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' FilletCorners.rvb -- July 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
Function DoFilletCorners(curves, radius)
' Declare local variables
Dim saved
' Set default return value
DoFilletCorners = Null
' For speed, turn of screen redrawing
Call Rhino.EnableRedraw(False)
' Save any selected objects
saved = Rhino.SelectedObjects
' Unselect all objects
Rhino.UnSelectAllObjects
' Select the object to fillet
Call Rhino.SelectObjects(curves)
' Script the command
Call Rhino.Command("_-FilletCorners " & CStr(radius) )
' Get the object created by the command
DoFilletCorners = Rhino.LastCreatedObjects
' Unselect all objects
Rhino.UnSelectAllObjects
' If any objects were selected before calling
' this function, re-select them
If IsArray(saved) Then Rhino.SelectObjects(saved)
' Don't forget to turn redrawing back on
Call Rhino.EnableRedraw(True)
End Function
Sub TestFilletCorner
Dim curves, radius, results, i
curves = Rhino.GetObjects("Select polycurve(s) to fillet", 4)
If IsNull(curves) Then Exit Sub
radius = Rhino.GetReal("Fillet radius", 1.0, 0.1)
If IsNull(radius) Then Exit Sub
results = DoFilletCorners(curves, radius)
If IsArray(results) Then
For i = 0 To UBound(results)
Call Rhino.Print(results(i))
Next
End If
End Sub