# Dividing polyline into single lines between points

Hey, I am pretty new to Grasshopper. I am modelling a tensile structure which I converted to polylines and I have the point cloud. The ‘mesh’ is quadrangular and I would need to separate each polyline segment into single lines (from point to point). Basically intersect the point cloud with the polyline collection in one direction and the other and extract individual line segments. I have tried with Explode, but I am missing some intersections (check fig.). I also cannot find the Curve | Curve command anymore.

How could I solve the intersections and generate the individual lines collection? I guess I could use the Shatter command, but I cannot guess how to put the dividing parameter.

Thank you

1 Like

A Mesh (BTW: I hate meshes) is kinda a mini Database containing 3 Classes of objects (Vertices, Edges, Faces) AND Connectivity info (what is connected [say: adjacent] to what) AND some other things (for instance Normals). Vertices are … er … hmm … vertices on a per Face basis and vertices on a per Mesh basis (these are called Topology Vertices). That’s a bit confusing for a novice.

Meaning that you can do anything imaginable “directly” so to speak given any Valid AND Manifold Mesh (and Karma - better safe than sorry). Fo instance: Edges per Face, Vertices per Face, Face neighbors, Edge/Vertex relations, Valence queries, Naked this Clothed that … etc etc.

So: extracting ANY similar info from a Mesh (or a List) is the easiest of things. I could provide tons of examples on that matter (for any imaginable thing in fact) … but the bad news is that I don’t use components (C# is my game) and thus … Houston we may have a problem.

2 Likes

pls post the gh file if you want help.

Sorry, I didn’t mean a mesh per se. I had a mesh but I converted it to a point cloud with the intersections from the surfaces. Now only I have is the point cloud and the polylines I manually inputted. (in each direction, blue and orange).

The task is basically subdividing these long polylines into simple lines between points. This should be done to export the structural model.

Why? I mean what is the purpose of this kind or reverse Engineering? (since you can have easily whatever you want working “directly” on any Mesh). Unless … well … the OEM Mesh is no longer available … meaning that there’s only a Graph on hand. Of course you can extract anything from a valid Graph but is kinda going from DC to NY via LA.

Other than that if, say, the Mesh is the “base” Topology for some sort of AEC structure (like a W Truss etc etc) rejecting (or not using anyway) the Connectivity Methods available in RC … well makes no sense at all. That said any AEC solution without Connectivity is a nothing thing.

All that assuming that you know what Connectivity is (for Meshes/Breps: 9 possible trees of Type int relating Vertices, Edges and Faces).

For Meshes these are the Trees:

And for Breps:

1 Like

I believe I wasn’t completely clear. I want to import this model of a tensile structure into a structural analysis programm (such as SAP2000), thus the only entities recognised will be nodes (concrete points) and cables (lines between points). I cannot import to SAP a model where the cables are represented by surfaces (such as a mesh I had created). Only interested in the force lines, the cables basically. The problem I was exposing is that I have to divide the cables that have been modeled as long polylines (from extreme to extreme) into smaller segments from point to point (cables from node to node). As you can see in the image, Explode is not useful for me because I am missing some intersections I believe.

To be done;

1. Intersect both collection of polylines (red) with the perpendicular ones (blue). Curve curve intersec.
2. Use the intersected points to cut the existing polylines in both directions into smaller segments. Point curve intersec. Each intersection gets a cut.

Sorry I don’t get it at all:

1. You state that there’s some Tensile Membrane around. Say “like” this:

1. Since you post in the GH Forum I assume that you have used K2 to have a “draft” of the desired result. This is a Mesh (or many) and cables (steady [fixed] of variable [solved by K2]) connecting mostly membrane anchor plates to some fixed points [NOT the Mesh Vertices] - i.e. the actual anchors. Mesh may be quad or tri and may (or may not) represent the fabric (if exists).

Of course you may have just a Graph (nodes/cables) : K2 can obviously relax that one as well (no Meshes around of any kind). Say a situation like this:

1. Anyway … after K2 does what it does you have the so called “relaxed” Mesh/Graph (meaning Vertices [nodes] AND Edges - typically separated in Clothed and Naked as we do in real-life [we apply different Forces for more than obvious reasons]) and the rest of the secondary stuff.
2. What have to do long Polylines with all that? Or by that you mean the sum of Naked Edges? (There’s an RC Method that does that). Or is it something else? Or you want to subdivide the relaxed Mesh? Or you want to subdivide selected Mesh faces (collections of them) prox to anchor plates? And why you need a huge Mesh for all that?

Other than that doing Ccx between red/green Polys (or Curves in general) - as in your Pic - is very easy via C# (provide some data in R5 format or internalized in some params). But … wait a minute: if the polys are defined via the nodes … what exactly is the problem? Or you want VE/EV/VV Connectivity? (also very easy).

(forget about the mesh thing I said, it’s already a model entirely based on points and lines) See how the polylines are going through multiple points. I do not want that, instead having independent line entities between each 2 points. That is the whole task about. Nothing of a surface ‘fabric’. I thought about using Grasshopper it could optimise the process.

Ok, that’s very easy: Given one (or 2) collections of crvs do the Ccx (meaning : get Vertices and Pieces (as Edges)) do classic Connectivity (VV, VE, EV) job done > adios amigos.

BTW: Connectivity is a Tree (if type int) where branches are indices from one List of things and items are indices from another (or the same) List of things. For instance VV Conn is relating Vertices to adjacent Vertices (thus there’s one List) while EV is retating Edges to Vertices (thus there’s two Lists).

I’ll post soon a C# that does that. Say something (minus sensitive/internal stuff like primary closed cirquit detection and the likes) like this:

Thank you,

could you be more specific about the Connectivity part? I cannot manage to understand the outputs from the Ccx function properly (the two params. specially)

What if I wanted to use the point cloud for the intersection instead of generating an intersection between curves again? So using a points-curves intersection directly to delimit the segments instead of a curve-curve>points>points-curves>segments

Well … I’ve changed the whole approach/solution for that:

1, The Rev Eng thing is not the way to go (plus is quite naive).
2. Membranes (or cables if you prefer) ARE not solved that way.
3. Most of my Crv/Crv multi ccx C#'s are written with closed cirquit detection Methods … and these are strictly internal. Besides cirquits is not the requirement here.
4. Since we are talking in this Forum … well … we must do some proper Parametric solution.

So expect a totally different take on that. Output would be a Mesh (for K2) and all the Mesh related stuff (plus obviously Connectivity).

I do hope that you have some basic knowledge related with DataTrees. These are “kinda” a Dictionary of Lists (add some “” more).

More after the Sepang MotoGP (Forza Ducati - but I don’t like Martin).

Well … get an indicative demo related with some membrane the K2 way: it’s not the real-thing (obviously). In fact is one of my Interview cases (with some faults included) used when I hire someone who claims that he knows a thing or two about coding (hope dies last).

317_UAE_ThematicPark4A_V1.gh (139.3 KB)

It’s 100% code thus the only realistic usage for you is to obseve what it does and try to “mimic” it. In any case doing any real-life membrane without code is out of question (for a zillion of reasons) … UNLESS you do some sketch and you outsource the case to someone the likes of BirdAir etc etc (they work like MERO TSK - give’m a hint [and dollars] and they make it happen).

1. The 1st C# … well … it does a flat Mesh from a collection of closed planar Curves. In most of real-life cases that’s the norm: i.e. we define a flat thing and various ways that allow K2 to do the job.
2. The 2nd C# is using a Cos/Sin Anchor definition policy. This means that defines variable cables (that srink during the K2 “relaxation”) that pull the Mesh naked Vertices towards the Anchors. The ends of the red Lines are the Anchors. Obviously there’s zillion ways to obtain some sort of an Anchor collection for a membrane (for instance Anchors related with some truss nodes and/or a forest of cables/masts etc etc). A far more elaborated way to deal with inner holes is part of the Interview.
3. The 3rd C# is the K2 thing. It works for any case of yours as far you have a valid Mesh + Variable cables + Anchors. Var cables MUST end at Anchors (not the other way around). The red cables (2) become tiny (or not depending on the Force value) green ones: i.e. the final ones. This is the standard way to define any real-life membrane (or collection of Edges like the 2nd Stadium image posted above).
4. The 4th C# does 3 classic Connectivity Trees. It accepts Lists thus - obviously - the Trees have 2 dim Paths (1st dim is the index of the Mesh in mList). In this case these 3 relate items found in V (Vertices) and E (Edges). As I said a Conn Tree tells you what Item (by index) from List A is related with what (by index) from List A - like the VV Tree (or List B - like the EV, VE Tree). If you are an Engineer (in AEC market sector) you should master Connectivity ASAP: Geometry without that is nothing. A faaaaaar better way to do the VE Tree is part of the Interview.

Obviously if you don’t know what a DataTree (or some standard nested collection outside the GH eco-system) is … all that are 100% Chinese.

And this … well … can (?) help (?) you to understand (?) the SinCos thing:

SinCos_Vals_V1.gh (124.2 KB)

BTW: If all the above sound Chinese to you (meaning: life sucks) see the attached that does Crvs (i.e. the general case) Ccx and Connectivity and this (not to mention that).

Curve_CCX_Multiple_Public_V1.gh (186.4 KB)

Notify if you want s C# that does the Conn visual part (show me some parent (by index) + his children (by indices) etc etc).

thanks,

will take a long look to the files, this is still very new to me…
Alternatively was trying to sort it out using ‘Explode’ function but then I get the segment list as an output that I don’t now how to convert to actual lines. Or else using the ‘Shatter’ where I inputted my curve collection but I don’t know how to define the ‘shattering’ parameter.

Well … if you have a collection of Polylines and you get the Segments as a List … you can input that List to the 2nd C# and the rest (E, V + ConnTrees) are easy. BUT the 2nd C# just receives pieces without checking anything … meaning that if you input bananas … bananas is what you’ll get.

Say that have Polys and their Segments:

But the right to do is to use the 1st C#:

But … if all you want is Edges (no matter how they are connected) and Vertices (unique Pts obviously) … why we are talking? You tell me.

BTW: Out of curiosity: by what means you (or someone else) did the “membrane”? (i.e. the cables of it). Was at some phase a Mesh? Was “relaxed”? Is some EFTE in the pipeline - or what else? Is this a real-life Project? And why the Champ finished a miserable 3rd in the Sepang MotoGP?