Skip to content

Instantly share code, notes, and snippets.

@goswinr
Forked from jesterKing/GhFsharpTest.fs
Created June 12, 2019 07:09
Show Gist options
  • Select an option

  • Save goswinr/10f1c5b8e4e78ed7c63b2ad57224a70f to your computer and use it in GitHub Desktop.

Select an option

Save goswinr/10f1c5b8e4e78ed7c63b2ad57224a70f to your computer and use it in GitHub Desktop.

Revisions

  1. @jesterKing jesterKing revised this gist Jul 20, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion GhFsharpTest.fs
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ type Priority() =
    type Info() =
    inherit GH_AssemblyInfo()
    override u.Name = "GhFsharpTest"
    override u.Description = "Quick F# test, NOP component"
    override u.Description = "Quick F# test, NOP component. Sets output to whatever is in the input."
    override u.Id = new System.Guid("43472a26-58ad-44a8-9948-137a7eaf3ada") // DON'T USE THIS PARTICULAR GUID
    override u.AuthorName = "Nathan 'jesterKing' Letwory"
    override u.AuthorContact = "nathan@mcneel.com"
  2. @jesterKing jesterKing revised this gist Jul 20, 2018. 1 changed file with 0 additions and 10 deletions.
    10 changes: 0 additions & 10 deletions GhFsharpTest.fs
    Original file line number Diff line number Diff line change
    @@ -39,14 +39,4 @@ type NopTest() =
    | _ -> ()

    override u.ComponentGuid = new System.Guid("94b16908-64a8-4562-a634-c9227582e99d") // DON'T USE THIS PARTICULAR GUID
    ()

    override u.SolveInstance(DA: IGH_DataAccess) =
    match u.Params.Input.[inpidx].SourceCount > 0 with
    | true ->
    let mutable (qc:IGH_Goo) = null
    let r = DA.GetData(inpidx, &qc)
    if r then
    DA.SetData(outpidx, qc) |> ignore
    | _ -> ()
    ()
  3. @jesterKing jesterKing revised this gist Jul 20, 2018. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions GhFsharpTest.fs
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ type Info() =
    inherit GH_AssemblyInfo()
    override u.Name = "GhFsharpTest"
    override u.Description = "Quick F# test, NOP component"
    override u.Id = new System.Guid("43472a26-58ad-44a8-9948-137a7eaf3ada")
    override u.Id = new System.Guid("43472a26-58ad-44a8-9948-137a7eaf3ada") // DON'T USE THIS PARTICULAR GUID
    override u.AuthorName = "Nathan 'jesterKing' Letwory"
    override u.AuthorContact = "nathan@mcneel.com"

    @@ -38,7 +38,7 @@ type NopTest() =
    ()
    | _ -> ()

    override u.ComponentGuid = new System.Guid("94b16908-64a8-4562-a634-c9227582e99d")
    override u.ComponentGuid = new System.Guid("94b16908-64a8-4562-a634-c9227582e99d") // DON'T USE THIS PARTICULAR GUID
    ()

    override u.SolveInstance(DA: IGH_DataAccess) =
    @@ -49,6 +49,4 @@ type NopTest() =
    if r then
    DA.SetData(outpidx, qc) |> ignore
    | _ -> ()
    ()

    override u.ComponentGuid = new System.Guid("94b16908-64a8-4562-a634-c9227582e99d")
    ()
  4. @jesterKing jesterKing revised this gist Apr 27, 2018. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion GhFsharpTest.fs
    Original file line number Diff line number Diff line change
    @@ -24,10 +24,21 @@ type NopTest() =
    override u.RegisterInputParams(mgr: GH_Component.GH_InputParamManager) =
    inpidx <- mgr.AddGenericParameter("I","I","Generic Input",GH_ParamAccess.item)
    u.Params.Input.[inpidx].Optional <- true
    ()

    override u.RegisterOutputParams(mgr: GH_Component.GH_OutputParamManager) =
    outpidx <- mgr.AddGenericParameter("O", "O", "Generic Output", GH_ParamAccess.item)

    override u.SolveInstance(DA: IGH_DataAccess) =
    match u.Params.Input.[inpidx].SourceCount > 0 with
    | true ->
    let mutable (qc:IGH_Goo) = null
    let r = DA.GetData(inpidx, &qc)
    if r then
    DA.SetData(outpidx, qc) |> ignore
    ()
    | _ -> ()

    override u.ComponentGuid = new System.Guid("94b16908-64a8-4562-a634-c9227582e99d")
    ()

    override u.SolveInstance(DA: IGH_DataAccess) =
  5. @jesterKing jesterKing revised this gist Apr 27, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion GhFsharpTest.fs
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ type NopTest() =
    override u.SolveInstance(DA: IGH_DataAccess) =
    match u.Params.Input.[inpidx].SourceCount > 0 with
    | true ->
    let mutable (qc:IGH_QuickCast) = null
    let mutable (qc:IGH_Goo) = null
    let r = DA.GetData(inpidx, &qc)
    if r then
    DA.SetData(outpidx, qc) |> ignore
  6. @jesterKing jesterKing created this gist Apr 27, 2018.
    43 changes: 43 additions & 0 deletions GhFsharpTest.fs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    namespace GhFsharpTest

    open Grasshopper.Kernel
    open Grasshopper.Kernel.Types

    type Priority() =
    inherit GH_AssemblyPriority()
    override u.PriorityLoad() =
    GH_LoadingInstruction.Proceed

    type Info() =
    inherit GH_AssemblyInfo()
    override u.Name = "GhFsharpTest"
    override u.Description = "Quick F# test, NOP component"
    override u.Id = new System.Guid("43472a26-58ad-44a8-9948-137a7eaf3ada")
    override u.AuthorName = "Nathan 'jesterKing' Letwory"
    override u.AuthorContact = "nathan@mcneel.com"

    type NopTest() =
    inherit GH_Component("F#Ex", "F#Ex", "Example Component in F#", "Test", "F#")
    let mutable inpidx = 0
    let mutable outpidx = 0

    override u.RegisterInputParams(mgr: GH_Component.GH_InputParamManager) =
    inpidx <- mgr.AddGenericParameter("I","I","Generic Input",GH_ParamAccess.item)
    u.Params.Input.[inpidx].Optional <- true
    ()

    override u.RegisterOutputParams(mgr: GH_Component.GH_OutputParamManager) =
    outpidx <- mgr.AddGenericParameter("O", "O", "Generic Output", GH_ParamAccess.item)
    ()

    override u.SolveInstance(DA: IGH_DataAccess) =
    match u.Params.Input.[inpidx].SourceCount > 0 with
    | true ->
    let mutable (qc:IGH_QuickCast) = null
    let r = DA.GetData(inpidx, &qc)
    if r then
    DA.SetData(outpidx, qc) |> ignore
    | _ -> ()
    ()

    override u.ComponentGuid = new System.Guid("94b16908-64a8-4562-a634-c9227582e99d")