-
Notifications
You must be signed in to change notification settings - Fork 3
/
SelSmallCommand.cs
29 lines (25 loc) · 972 Bytes
/
SelSmallCommand.cs
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
using Rhino;
namespace SelCommands
{
[System.Runtime.InteropServices.Guid("eefd1f8d-bf5d-458f-adc5-aa080574e3b6")]
public class SelSmallCommand : Rhino.Commands.SelCommand
{
public override string EnglishName { get { return "SelSmallSurface"; } }
double m_diagonal = 0.1;
protected override Rhino.Commands.Result RunCommand(RhinoDoc doc, Rhino.Commands.RunMode mode)
{
return Rhino.Input.RhinoGet.GetNumber("Bounding Box Diagonal", true, ref m_diagonal, 0.0000001, 1000000);
}
// Classes derived from SelCommand are required to provide a SelFilter override
protected override bool SelFilter(Rhino.DocObjects.RhinoObject rhObj)
{
//Make sure selected object is a surface
if (rhObj.Geometry.ObjectType == Rhino.DocObjects.ObjectType.Brep )
{
var bbox = rhObj.Geometry.GetBoundingBox(false);
return bbox.Diagonal.Length <= m_diagonal;
}
return false;
}
}
}