Check widths/lengths of a surface/path

Hello Friends,

Is it possible to determine the widths or lengths of a surface (non-rectangular), either minimum or maximum values, I am only aware of the bounding box method to get values of regular shapes.g

  1. Get the bounding box.
  2. Get the distance from the min point to the max point of the bounding box.
  3. Get the perimeter curves of the surface.
  4. Get the tangent vector at a parameter (or two - more parameters will make more accuracy but will slow the calculation time) along each curve.
  5. Get the points at matching parameters.
  6. Draw lines at each point using a Line.ByPointDirectionDistance where the points are the points (5), the tangent vectors are your directions (4), and your distance is your bounding box diagonal (2).
  7. Intersect those lines with your surface to trim them at the extents.
  8. Filter the new collections of lines by Geometry.DoesIntersect between the new lines and the original perimeter curve set. This will clean out any ‘split’ curves which intersect across a void.
1 Like


Actually ended up with this, it did not clean out I suppose.

pp

Not sure how well this would work but this is how I would start to tackle the problem:

  1. Get perimeter curves of surface.
  2. Group by parallel directions.
  3. Find distance between all curves within each group.
  4. Offset a point (probably center) on one curve at half the distance towards each other curve within each group. This would be x-lacing.
  5. If the point created in step 4 lies on surface, it is likely that the two lines used to create that point are of same path.
  6. Find distance between those two lines.

A really bad drawing:

How do I group by parallel directions?

When you have the lines, you can get the direction using Line.Direction node and then groupbykey to organize them.

I am not sure how to group by keys… by vectors?
I am quite new here…

I would recommend against the route I suggested then. It is very code heavy and just to get lines grouped together required me to use a custom function to convert curves to lines (Surface.PerimeterCurves gives curves which have no direction vector) and a python script to take those vectors, normalize them, and absolute them.

Maybe someone else can offer a better strategy.

I would like to see it if you are willing to share

I didn’t get any significant progress done, only up to the grouping of lines by similar vectors and only made it work for if they are straight left/right or up/down.


It would be a great if you guys can show me how to trim these lines from the workflow @JacobSmall suggested, that would do the job I guess.

Try to swap the Curve.TangentAtParameter for a Curve.NormalAtParameter. Got myself backwards as I typed up the workflow.

t
Changed it. Not quite sure where it goes.

is this with Curve.NormalAtParameter with the parameter at 0.5?
try it with 0 or 1.
just a hunch

1 Like

Add a vector.Reverse node right after it. That should fix the angle issue.

still not successful

1 Like

Thanks for the help, the green graph would actually work to get the minimum as you said. (I will have to forget the non parallel stuff)
Wondering if the cross product would work on multiple lists to get to multiple minimum values at the very end for respective multiple surfaces. Tried a few ways but couldn’t figure out :frowning: cross

54 results when using cross product is not much if you have 38 inputs