Create Clipping Planes in GH

Thanks to @PeterFotiadis 's script in this thread.

Currently I want to create 3 sets of CP based on box’s XYZ and have the inner one flip so that the view depth can be control. I’ve tried couples but still can get it work out … (128.8 KB) (129.0 KB) (129.9 KB)

That’s very easy.

When time permits I’ll add lsome “custom” clip options like the one that you want (plus some - more or less - common in AEC matters) : let’s call them “presets”.

1 Like

@PeterFotiadis Thanks, I’ll wait!

Hi @PeterFotiadis,

Just wondering, before you become available could you give me a hint about the cp flipping in image Try 1 ?
(in term of data structure maybe…?)


Well … tomorrow could the day with a time gap (from Friday on is the Monaco GP > forza Lewis/W13 > adios amigos) .

But what means hint? Are you in the C# bandwagon?

1 Like

haha I’m bad at coding :frowning: just thinking if I sort the data structure correctly before input to C# then the current script can work as I think of …

X(no flip, flip) Y(no flip, flip) Z(no flip, flip) = 6 clipping planes, 3 pairs

Well … you are talking about a way to manage one of the “presets”.

Let’s say that we have the very common case (i.e. 3 planes ortho to each other [plan, elevation, section etc]). Then we need 9 bool vars to cover the possible combos.

Meaning some sort of nested collection (Tree, Array blah, blah).

But … what if we want multiple plans, elevations or sections in some other preset ? (or we need some real-life approach that does “on the fly” one preset? ).

Hope that you understand that this kind of thing could lead us to a non rational approach (only for amateurs) … where we must add a zillion yes/no bool toggles … blah, blah.

The solution to that … is to swap volatile to persistent data (i.e. a Tree of type bool) kept in a parameter (accessed by NickName - no wire) . But that … well … makes things a bit complex and could be a big rabbit hole for you (don’t blame me > is your fault > why you haven’t walk the right walk? > time to reset now for ever? he he).

Moral: life sucks, what else?


This is the part I got confused, why 3*2=“9” bool ? Why not 6?

You’re right…

Enable, Flip, Visible.

But the truth is that there’s various other “options” to play > i.e. > straight into the rabbit hole of volatile <> persistent data stuff (and other ominous things).

Anyway: given some objects we can do the Box thing and based on that (Point3d[ ] p = box.GetCorners() Method >>>> zAxis = p[1]-p[0]; blah, blah) we can define,say, the 3 ortho Planes plus their equivalent “opposite” ones. But that yields 18 vars … so let’s stick to enable and flip on a per pair basis (life sucks) not to mention controls (at some double T [0-1], that is) for their positions (life sucks).

Moral: Power (C#) corrupts, absolute power corrupts absolutely.

Anyway … found a couple of minutes to start the V1D build,

Here’s the preset N1 preview (3 pairs of planes in box x/y/z).An inflate box in x/y/z option would be present for obvious reasons

If T value is < 0 (front) or >1 (back) then these are not active. Delta is used if values of T - per pair - are equal, Values stored - obviously - in a Tree of type object (since contains string, double and bool per Plane). This Tree talks to the main C# as you know it (plus some minor mods).

I hear you : but this is primitive. Where’s the WOW “learning on the fly” thing? Well … that’s a good question: start walking the C# walk and then PM me.

@PeterFotiadis So I think I got it worked.
The only thing left is to have a C# output for CP’s GUID so they can continue referencing for the rest. (127.4 KB)

Hope dies last. Get a WIP preview of the concept. Feel free to suggest changes. If you want the real thing … start walking the C# walk and we’ll see some aspects of it.

DON’T feed the Clip C# with these planes - some mods are required. (131.7 KB)

PS: for any given pair in x/y/x - and for any related var - F is for the Front, B for the Back.

1 Like

In fact the big MIA thing is some strong winds for a proper windsurf (wave) session. (382.6 KB)

@PeterFotiadis Thanks man… I really appreciate your entire help.
I must say sorry for my innocent towards “only thing left” early today, that thing should really be hiding the CPs at the end. I was thinking of using GUID to get CP referenced …

  Print("One Clip active");
  if (id != Guid.Empty){  doc.Views.Redraw(); }
clipPlaneGuidList = guidList;

Not the way to cut that sort of mustard. But … you have a naive approach already:

Anyway: the pro (real-life) CP thingy:

Make a State Tree with 3 dims (first is the State ID) kept in a parameter (persistent data) with a proper NickName (say: CP_state etc). DO NOT connect that parameter with any kind of wire. Using indices access a particular branch, then modify the state of the equivalent CP OR add a new OR delete it etc etc … then store the volatile data (on a per action basis) as persistent to that parameter … continue managing new/old ClipPlanes in new/old presets.

TIP: If you are in the AEC sector lean C# ASAP (time flies).

@PeterFotiadis Can you upload the newly script you made? The Visibly option not there in V1D…

I really wish to do so and want to learn more about scripting… But the fact is that AEC company here doesn’t appreciate the sort of skill… Somehow the trend here believe that scripting skill (or even BIM) is time wasting and profitless(!?)

I was being told one day by an old supervisor “BIM or scripting is nothing, others can spend time in AutoCAD and complete the same job”. Yes, they say time. And yes they hate me when seeing bunches of GH wires and capsules flying on the screen, don’t even mention scripts. For the AEC trend here these should only belong to EE and Google. Sad?

Yes… that was a last minute thing … but I’m far and away from practice right now (Wave windsurfing period started > reopening practice time unknown > adios amigos).

Yikes! AutoCAD for AEC things? That’s kinda riding a Harley Davidson (avoid at any cost) or driving a Toyota (ditto).

Bad news: If they put spaghetto and C# solutions in the same bag … they are rather living in some sort of prehistoric times (Where dinosaur extinction … blah, blah).

Good news: Ignorance is a bliss.

Ugly news: An ignorant is just an idiot.

Hi @PeterFotiadis

I think the “Index” part still got some problems…
When input index which view to clip, it all return the same.

Lucky you: today is a neutral day > no serious wind around > nothing to do > unless you like course slalom stuff OR a pretty girl needs some duck jibe lessons > so maybe I can find some minutes for an after service service.

Again, thanks a lot for your time @PeterFotiadis

At this point i really hope if somewhere there’s a plug-in (or native) which features and intergrates all these view relatived matter (clipping plans, capture, hide, display, preview, viewport - like Human’s “Place on Screen” …etc.).

These dyas I somewhat rewrote a Python Script for capture with rectangle in view (I admit no time to learn C# … )

Then, I went and tried the CP thing myself. Soon the obstacles appeared - enable, flip, viewportID, delete, hide, multiple planes as list or tree…) …