I’m wondering if and how I can access the Clipper plugin commands from within a Ghpython script?
I dont think you can without writing a wrapper, Ive done it in the past using C#.
From the page you link to when you expand the description:
basically the same as importing the library and feeding in the arguments like normal.
On the other hand you can use NodeInCode to call Clipper components directly into your python code, the drawback is it would require you to have Clipper also installed on any machine using it. This is what @christopher.ho is showing.
That’s nice, is there a C# equivalent of NodeInCode? I have done this in the past by using reflection I think.
Yea, It is also NodeInCode
Thanks for the help everyone! NodeInCode especially, cheers.
If you want to go further I found better to use the legacy library (Delphi, C++ and C#)
It requires some work to make the interface with Rhino as the library use point2d with Integer.
I was able to to that with it
Maybe a bit late to the party, but feel free to (ab)use clipper to rhino glue:
I was testing a grasshopper script including your offset component with Rhino Compute. The component was somehow not recognised and gave no output. I have both Rhino 6 and 7 installed on my computer and it could be that this has someting to do with the problem. On an other computer with only Rhino 7 installed there were no problems.
Thanks for your feedback. I’ve not tested rhino compute yet. Would you mind helping me with any scripts or ways for me to reproduce this?
Yes I can. I do not know what you need to know, but we made a small python script which can be used for testing. You only have to change the Grasshopperscript_filepath (line 14). For running compute you can look here: Running and Debugging Compute Locally with C#, VB
testbed.gh (10.5 KB)
Testbed_Tester.py (1.7 KB)
Cool, thanks a lot for the information. I will try take to take a look soon, but things are a bit hectic, so it may not be untill this weekend.
There is a problem that in older versions of clipper, clipper would automatically assume the tolerance from the RhinoDoc.ModelAbsoluteTolerance. However: rhino compute does not have a rhino document, so it fails.
There are two solutions:
Manually set a tolerance in the tolerance input. (I generally recommend 1/10th of your smallest feature, but test around to make sure you’re not losing too much detail)
It seems you are using an old version of clipper, and a fix for this problem was submitted by the legendary @andheum Tolerance without active doc by andrewheumann · Pull Request #4 · arendvw/clipper · GitHub, and this was released in clipper 0.3.2 last year. It sets the tolerance to 0.01 if no tolerance is set and no rhino document is available.
Does this solve your problem?
Yes, I think so. The tolerance issue I encountered already on some other components. I forgot that one!
Thanks a lot @arendvw !
One question, I use your codes, but the clipperlib is missing, how to transform the file into DLL as you say.