compute.rhino3d icon indicating copy to clipboard operation
compute.rhino3d copied to clipboard

Overridable `GrasshopperDefinition`

Open talebia opened this issue 3 years ago • 5 comments

I wanted to know if there's any reason as to why the GrasshopperDefinition cannot be overridden (private ctor)?

talebia avatar Jun 28 '21 04:06 talebia

Why do you feel you would need to override the constructor?

sbaer avatar Jun 29 '21 00:06 sbaer

@sbaer I dont need to override the ctor, I would need to override the Solve behaviour so it expires all the cache before creating new solution for a specific script: Definition.NewSolution(true, GH_SolutionMode.CommandLine);

So either update the Solve method to accept a boolean arg (not following Open-Close principle) or have the entire GrasshopperDefinition class overridable so the Solve can be overridden?

talebia avatar Jun 29 '21 00:06 talebia

I'm sorry, but I really don't understand the goal here. Could you provide either a pull request or some code here to help me better understand?

sbaer avatar Jun 29 '21 04:06 sbaer

sure created a PR: https://github.com/mcneel/compute.rhino3d/pull/393

talebia avatar Jun 29 '21 05:06 talebia

Thanks, I think I understand now. We would need to add a bool to the input sent to compute to tell it to expire all objects.

sbaer avatar Jun 30 '21 17:06 sbaer