I would like to get centreline of closed polylines, though its not centre always as it adapts to other centelines linearly. I have attached image for reference and also geometry to test it. Is there any gh component to achieve this? please help!!
It is not far from medial axis. You will find some discussions on this forum
And a question does all your lines are always in 2 directions ?
You don’t ask a simple question and there is not just an answer. I think you could better work with the rectangles from the other discussions and extract their center lines and work with that. But it is not simple.
The best I could do with Medial Axis
Ya seems a tough job. thanks
There is quite better with Sand Dunes
I am there now
Warning : Rhino tolerances are used so some errors could occurs if tolerances are too high or too low !!!
This is very interesting almost linear except at meeting points. Thanks for the definitiion
Hi, if you could convert your geometry to rectangles, applying the solutions from your previous discussion, then it is easy.
Divide surface based on corners.
It is easy to extract the center line of a rectangle.
Tried Laurent definition works good though its not linear even if I seperate to boxes
Separating to boxes would enable you to use another approach that would give you everything linear.
Am not getting it clear what you say. I tried with closed plines rectangle still not linear enough
But after that it is not so easy !!!
What settings should be used for bigger objects like stairs stringers? I’m trying to find a “centerline” which could help for automatic placing cups on a cnc router:
center_lines_frompolylines_rectangles (1).gh (27.4 KB)
I’d like to have a curve like your “C” shape example.
I am not sure I understand your question, what is sure is that my script doesn’t accept more than one curve at once ! I didn’t try to implement the logic for multiples curves. It is doable but takes time.
If it is not that can you draw what you are after ?
Here an updated script, it works with multiple curves, I added some slider for curve simplifications, … Hope the naming are quite explicit. But It isn’t a 100% all what you want script !
center_lines_frompolylines_rectangles_v2.gh (26.4 KB)
Thank you Laurent, you’re a killer, it’s really close to my needs. I’ll try to include this in my homemade postprocessor for my router. It transforms rough dxf geometries into Biesse .cix format, which can include the vacuum cups positions. I will have to array circles or rectangles along those center curves, and find their coordinates, not too difficult.
j’apprécie beaucoup ton travail qui souvent répond de très près à mes problèmatiques géométriques, merci encore!
What I meant is that if you use boxes, then there is no need to use Laurent’s approach as it deals with closed curves of all types, and you only need boxes, which simplifies the task a lot.
Boxes Axes_v01.gh (19.8 KB)
Here is a simple approach. The logic is to first generate longest center line of each rectangle. And then extend those to meet up the other curves, by projecting the end point to the closest curve. Naturally this creates some diagonal lines, which are culled. Then some exterior lines, which are also culled, and finally some pieces of the axes need to be trimmed, so they are also culled depending on their distance to the edge region.
I tested for a couple of possible arrangements, and it seems to work. For now only rectangles, no squares.
This is incredible work!! your neurons are on fire bows down