No Lines inside the sphere

Hello everyone,

I was trying to populate the a cube with branches of shortest path and 120 angle.I was able to achieve it with kangaroo and python.
However, I am stuck at the next step.

I have, lets say a sphere inside my cube where the points are being populated, some of the points being inside the sphere and some outside.
The python scripting right now is creating branches using nearest points inside the cube.

What if I need the syntax to eliminate the points inside the sphere, even if they are the nearest, and connect to the next nearest set of points outside the sphere but inside the cube.

I tried the brepinc component, But the lines are still getting inside the sphere even if there are no points.
The syntax should ignore point 2,even if it is shortest because it will enter the boundary of the sphere and instead connect to point 3 which is outside.
This will make you understand better-

How will that be possible.

Attaching the file herewith
Thank you for your time in advance

Cube_Steiner_Mesh topology _19-02-19_for (35.7 KB)

in your file i don’t see the problem and the lines inside the sphere are created from middles of the lines

Yes I know that.I think It needs a python coding.
I am not able to apply any other logic
The lines shouldn’t enter the sphere.
It should detect another point for shortest distance outside of the sphere and automatically cancel the one entering it.

you can use shape in brep to separate btween inside/ intersecting/ outside lines

Hi seighierkhaled,

Need it with the kangaroo output and not the python one.It is not pulling the lines and eliminating the ones inside the sphere at the same time.
The problem here is even if the syntax tries to make lines outside the sphere.They are making broken lines and not detecting the nearest point and branching with all points combined.

Cube_Steiner_Mesh topology _19-02-19_for (23.8 KB)

When used with the output of kangaroo(constant tension) it should join all the points in the form of branches.


Can we subtract sphere from the cube and then populate?Will that work?


no you can’t subtract cube and sphere or other shape inside you will always get the same 2 shapes

Er … pardon me … but that thing doesn’t look to me like a Steiner graph.

It would be way more effective to do a graph like that by forgetting the rnd pts and do a recursive creation of lines per node - the line ends that is (using params the likes of new line length fade, generations per node, direction min/max angle blah, blah). Of course for each new generation any filter could been applied (for instance if a Ray3d - due to a given line - yields ccx events against a mesh/brep > don’t get that line). In that type of recursion each new loop is kept in a tree branch whilst the collections for the next loop are just the contents of the previous branch.

Notify if you think that a C# (you can’t translate it automatically to P) example would have any meaning for you.

1 Like

Hi @Arya,

I’ve edited the GHPython component to work with obstacles that need to be solid, watertight meshes (i.e. mesh sphere). You may also input multiple obstacles.


Hope this helps. (16.9 KB)


Would be interesting to see the c# version:)

1 Like

See this as well:

I’ll remove some sensitive stuff (on the Inverse Steiner, that is) and I’ll post it soon. A real (//) Steiner on the other hand is strictly internal.

1 Like

Hello Pb0y,
You certainly are a genius when it comes to Python and coding.
I have not yet opened the definition but by the look of it I must say
its working out just how I wanted it to.
I ll keep you posted.
Thank you