Hi everybody,

I want to extract the longest and the shortest length of a geomtery, when it’s a rectangle they coincides with the length ansd the width of the geometry, but when it’s like the two others how can i proceed? I try but i want to verify if it’s true or not.

the second point that i strarted but i didn’t finish is how to establish the quotient **L/l** ( L is the longest segment inside the geometry, and l is the shortest one)

# Extract the longest and shortest length of a geometry

**immen.soussi**(Imen Soussi) #1

**BaptisteC**#2

**dsonntag**#3

Not sure what your definition of shortest / longest length is, but for a more irregular geometry I guess you would need something like an oriented bounding box ?!

**immen.soussi**(Imen Soussi) #4

thank you I think it works. I want to extract the Quotient:

- L/l >=3.5
- <L/l<=3.5
- L/l >=2

**qythium**(qythium) #5

There is a “And Gate” component which lets you test if several conditions are all true - is this what you are looking for?

But if the problem you are trying to solve is simply “Detect if this shape is a rectangle”, there may be better ways to do it…

**BaptisteC**#6

Do you want to filter your input shapes according to these 3 criteria ? or create 3 lists of all quotient values for each criteria ? Or maybe something else ?

**immen.soussi**(Imen Soussi) #7

I want to separate the three lists because in every case the 3 D shape ( that I’m doing later) is different .

For example if L/l >=3.5 then the 3d shape is a barrel vault ( I did the the barrel vault, but i need to connect if with the hole programme)

**BaptisteC**#8

Ok, so try this :

You will have to adapt the test criterias to your real need.

I have changed the start of the workflow to handle 3D geometries (using BoundingBox instead of PlaneThroughShape). But the quotient is computed only on x and y dimensions.

It outputs 3 lists of shapes :

- Q >= 3.5
- 2 <= Q < 3.5
- Q < 2

I chose to color them, but you can do whatever you want instead.

Larger and shorter.gh (15 KB)

**immen.soussi**(Imen Soussi) #9

thank you , how can I use the shortest and the longest segment as a cuve not just a number, to use each one later in the construction of the vault.? i tried line SLD but it doesn’t work…

**BaptisteC**#10

Hi,

SLD Component is used to build a line when you have a **S**tart point, a **L**ength and a **D**irection. If you find a way to extract these datas, you’ll have a straight line.

You’re first question was to extract dimensions of you’re shapes. If now you need to extract a subcurve of the shape, the logic must be adapted, because the workflow wasn’t using subcurves but the complete shape itself.

My inputs are polylines :

- Explode Component to extract subcurves
- Length Component to measure curve’s length
- Sort List Component to sort subcurves by their length
- List Item Component to extract first and last item of the sorted list (longest and shortest Subcurves).

Larger and shorter.gh (13.1 KB)

**BaptisteC**#11

I thought you were maybe asking for these curves :

I used SDL Component to give you an example.

Larger and shorter.gh (16.5 KB)

**immen.soussi**(Imen Soussi) #12

Thank you but I know those steps, and they are valid only when the curve is a rectangle.

my purpose is to find the longest and the largest segment of a curve and to mesure the dimension of each one of them.

**BaptisteC**#13

That’s not true. If you look at the definition, it can handle any type of curve.

I think that you could find what you want in the length component. I suggest you take a panel component to see what’s excatly output of each Component. Then, it’s your job to find the better way of using them by composing with every GH tools.

**immen.soussi**(Imen Soussi) #14

I tested it and it works very well, I’m sorry for the previous reply ^^