I don’t understand this:
I don’t understand this:
import rhinoscriptsyntax as rs import scriptcontext as sc import Rhino sc.doc = Rhino.RhinoDoc.ActiveDoc rs.AddClippingPlane(rs.WorldXYPlane(),5,3)
this post is also interesting on this topic:
Quick try I noticed something interesting. every change of the input values of the ghpython component creates new clipping plane instead of changing it.
I’ll take a look at that thread you posted.
this is how it works rhinoscript, your are adding each time a new object to your Rhino document.
If you want to have the appearence of having an updatable element, then, you could get rid of the previously added geometry (for example saving into sticky its guid).
Thanks, it worked. Although a little blinky when changing the values to move the clipping plane it deletes the old one and you can see the object not clipped for a split second, but important is it worked and I learnt something new.
after I restarted Rhino, it messed up my script
I have to create it from scratch following the same step-by-step scenario.
- creating the clipping plane with ghpython
- add sticky with value clipping plane guid
- a = sticky (to create the clipping plane from the sticky)
- add in front of all a line to delete the clipping plane with guid that is equal to the sticky.
Once you create the clipping plane for the first time, you could keep the guid, reference the object, modify it, commit the changes, and redraw (in cases where you need to manage redrawing). Here is an example in GH with a few c# scripts (sorry, I don’t Python).
Create and Mod Clipping Plane.gh (12.0 KB)
11.gh (7.5 KB)
check this. the script will each frame delete the old one and create a new clipping plane.
BUT, since I use rs.commands to select and delete the old ones, there will be a blinking everytime we change.
So, I hope anyone could improve it like, no blinking.
This is not what I expected. Creating the clipping plane with a button after modification then accessing the guid(object) from rhino. After restart this will be different guid. I expected the definition to be entirely inside GH. And modification to be as if the gumball is moving the plane.
Perhaps ClippingPlane must be a GH_ClippingPlane in GH in order for the clipping plane to behave properly. WIth the option to bake it into Rhino clipping plane.
Interesting approach to create the plane using rhino commands instead of rhinoscriptsyntax, that fixes my problem that when I restart rhino my script breaks.
Still though, this blinking is bad solution.
The clipping plane creation script was just to have a clipping plane. If you have an existing clipping plane in a Rhino Document, just reference that plane into gh via its guid. See this example:
The gh is the same as before, just without the clipping plane creation.