Protected Overrides Sub RegisterOutputParams(ByVal pManager As GH_OutputParamManager)
pManager.Register_IntegerParam("Length", "L", "Number of items in L")
End Sub
Protected Overrides Sub SolveInstance(ByVal DA As IGH_DataAccess)
Dim list As New List(Of IGH_Goo)
If DA.GetDataList(Of IGH_Goo)(0, list) Then
DA.SetData(0, list.Count)
End If
End Sub
' Properties
Public Overrides ReadOnly Property ComponentGuid As Guid
Get
Return New Guid("{1817FD29-20AE-4503-B542-F0FB651E67D7}")
End Get
End Property
Public Overrides ReadOnly Property Exposure As GH_Exposure
Get
Return GH_Exposure.primary
End Get
End Property
Protected Overrides ReadOnly Property HelpDescription As String
Get
Return (Me.Description & " Elements in a list are identified by their index. The first element is stored at index zero, the second element is stored at index one and so on and so forth. The highest possible index in a list equals the length of the list minus one.")
End Get
End Property
Protected Overrides ReadOnly Property Internal_Icon_24x24 As Bitmap
MyBase.New("Series", "Series", "Create a series of numbers.", "Sets", "Sequence")
End Sub
Protected Overrides Sub RegisterInputParams(ByVal pManager As GH_InputParamManager)
pManager.Register_DoubleParam("Start", "S", "First number in the series", CDbl(0))
pManager.Register_DoubleParam("Step", "N", "Step size for each successive number", CDbl(1))
pManager.Register_IntegerParam("Count", "C", "Number of values in the series", 10)
End Sub
Protected Overrides Sub RegisterOutputParams(ByVal pManager As GH_OutputParamManager)
pManager.Register_DoubleParam("Series", "S", "Series of numbers")
End Sub
Public Sub SetInitCode(ByVal code As String) Implements IGH_InitCodeAware.SetInitCode
Me.AssignInitCodeToInputParameter(2, code)
End Sub
Protected Overrides Sub SolveInstance(ByVal DA As IGH_DataAccess)
Dim destination As GH_Integer = Nothing
Dim number As GH_Number = Nothing
Dim number2 As GH_Number = Nothing
If ((((DA.GetData(Of GH_Number)(0, number) AndAlso DA.GetData(Of GH_Number)(1, number2)) AndAlso DA.GetData(Of GH_Integer)(2, destination)) AndAlso number.IsValid) AndAlso number2.IsValid) Then
If (destination.Value < 0) Then
MyBase.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Series with negative count ignored.")
ElseIf (Not destination.Value Is 0) Then
Dim data As New List(Of GH_Number)
Dim num As Double = number.Value
Dim num3 As Integer = destination.Value
Dim i As Integer = 1
Do While (i <= num3)
data.Add(New GH_Number(num))
num = (num + number2.Value)
i += 1
Loop
DA.SetDataList(0, data)
End If
End If
End Sub
' Properties
Public Overrides ReadOnly Property ComponentGuid As Guid
Get
Return New Guid("{E64C5FB1-845C-4ab1-8911-5F338516BA67}")
End Get
End Property
Public Overrides ReadOnly Property Exposure As GH_Exposure
Get
Return GH_Exposure.secondary
End Get
End Property
Protected Overrides ReadOnly Property HelpDescription As String
Get
Return (Me.Description & " The numbers are spaced according to the {Step} value. If you need to distribute numbers inside a fixed numeric range, consider using the [Range] component instead.")
End Get
End Property
Protected Overrides ReadOnly Property Internal_Icon_24x24 As Bitmap
Get
Return Resources.Default_24x24_Series
End Get
End Property
End Class
复制代码
作者: 1235813 时间: 2011-5-24 00:50 DivideInterval
Public Class Component_DivideInterval
Inherits GH_Component
' Methods
Public Sub New()
MyBase.New("Divide Domain", "Div", "Divide an domain into equal segments.", "Math", "Domain")
End Sub
Protected Overrides Sub RegisterInputParams(ByVal pManager As GH_InputParamManager)