I don’t understand this:
try 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:
http://cu.t-ads.org/tips-script-context-in-gh-python/
Thanks @aitorleceta,
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
- OK
- 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)
Hi IVELIN:
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.
Best,
Lei
Thanks @fraguada,
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.
Thanks @Lei_Yang1,
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:
Mod Clipping Plane.3dm (35.9 KB)
Mod Clipping Plane.gh (3.8 KB)
The gh is the same as before, just without the clipping plane creation.