-
Notifications
You must be signed in to change notification settings - Fork 3
/
SelByLineWeightCommand.cs
30 lines (26 loc) · 1.1 KB
/
SelByLineWeightCommand.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
29
30
using System;
using Rhino;
using Rhino.Commands;
namespace SelCommands
{
[System.Runtime.InteropServices.Guid("418fa004-4f4a-4a4b-9d1e-e3a6a793235d")]
public class SelByLineWeightCommand : SelCommand
{
public override string EnglishName { get { return "SelByPrintWidth"; } }
double m_val;
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
// You don't have to override RunCommand if you don't need any user input. In
// this case we want to get a key from the user. If you return something other
// than Success, the selection is canceled
return Rhino.Input.RhinoGet.GetNumber("width", true, ref m_val, 0, RhinoMath.UnsetValue);
}
protected override bool SelFilter(Rhino.DocObjects.RhinoObject rhObj)
{
double weight = rhObj.Attributes.PlotWeightSource == Rhino.DocObjects.ObjectPlotWeightSource.PlotWeightFromObject ?
rhObj.Attributes.PlotWeight :
rhObj.Document.Layers[rhObj.Attributes.LayerIndex].PlotWeight;
return (Math.Abs(m_val-weight)<RhinoMath.ZeroTolerance);
}
}
}