# Maintain Intersections when any line is moved

I have to make hundreds of iterations of a 3d pipe structure. There are a lot of lines that have multiple intersections or overhangs.

I am trying to make a grasshopper script that maintains all intersections when I move any line in the structure. All maintaining movement should be constrained to move in one dimension.

This seems to me a surprisingly complex problem and I cant seem to get my head wrapped around it. I have included the rhino file.

I messed around for a while in grasshopper but havent even gotten close.

Pipe Structure.3dm (163.4 KB)

Any help would be really appreciated, even if you could just talk me through how to approach the problem!

Thatâ€™s very easy via code (C#). Notify if you want an indicative take. But it would be a black box if you are after solutions via native components (or some sort of add-on - if exists).

BTW: I assume that your rnd tubes (not abstract axis) are connected via some sort of swivel couplers like:

Of course thereâ€™s others with far better aesthetics (and/or SS 316L) etc etc.

Thank you for â€śany helpâ€ť! I will look into c#

Best,
Ben

Assume that thereâ€™s 2 classes of tubes: the main ones and the connectors.

Assume that main tubes have radii R and the connecting ones have radii r. Assume that the coupler requires a distance D. Use some rational â€śseparationâ€ť distance delta as well.

Define rnd pts (with various ways: plain random, using â€śspotsâ€ť, using some container, using attractors etc etc) and then define main tubes in rnd directions (as far as their min dist - VS all the previous sampled - is > 2*R + delta).

Using various options define connector tubes (as far as any connector axis has a min dist VS all main tube axis > R+r+D+delta and VS all previously sampled connectors > 2*r + delta). If you want a rigid Graph/Truss then things become complicated since rigid means tetrahedra on a per main tubes pair basis (i.e. 2 edges are main tubes axis [with valid dir angles] and the rest 4 are connectors axis). Tetrahedra means far more clash checks for the items used.

Then:

1. If you want some realistic couplers - for obvious reasons - youâ€™ll need to use Instance Definitions (2: one for the coupler half part attached to the main tube and the other for the coupler half part attached to the connector tube) placed via classic Plane To Plane Transform.

2. If you want an interactive solution (GH is NOT interactive on a per item basis by any means) then you need to swap persistent/volatile tube axis data (stored in a parameter accesed by name) each time that you pick any tube (by index) and define a translation on a start/end pt.

3. If you relay on fate â€¦ just re-execute the solution and use a parameter also accesed by name (persistent data) to store any variation you like (meaning a history of your previous attempts).

Level in C# required for all the above: mid to expert (for 1 and 2).

Hereâ€™s a simple (and quite naive â€¦ since couplers are far more complicated in real life) coupler demo (t on the white tube axis is steady while t on the blue tube axis grows from 0.2 to 0.8 - connectors are extended acc the extend value [ spot the bools related with reverseDy1/2 direction Vectors]):

BTW: for a minimum rational coupler definition youâ€™ll need these params:

1 Like