Solved

Create middle line from multiple line

  • 22 September 2021
  • 5 replies
  • 21 views

Hi, I'm currently trying to create a line between my lines. As you see in the image, I would like to create a line in the middle of the lines that respect the angle of that group. I've tried to select the longer line of the group and move it to the center point of the group with the offsetter, but it only "offset" the line and not move to the specify coordinate.

 

Thank you in advance

icon

Best answer by nielsgerrits 22 September 2021, 16:06

View original

5 replies

Userlevel 6
Badge +32

Do the lines already have a group id?

If so, I would try this:

  • Aggregator (group by id) to create a collection of lines with the same group id.
  • BoundingBoxReplacer (Replace with 2D Oriented Bounding Box) to create a rotated box.
  • CenterLineReplacer to get the centerline of the boundingbox.
  • LineExtender to stretch the centerline to the edges of the box.
  • Clipper (group by id) to trim the line to the edge of the box.

Sample attached.

Do the lines already have a group id?

If so, I would try this:

  • Aggregator (group by id) to create a collection of lines with the same group id.
  • BoundingBoxReplacer (Replace with 2D Oriented Bounding Box) to create a rotated box.
  • CenterLineReplacer to get the centerline of the boundingbox.
  • LineExtender to stretch the centerline to the edges of the box.
  • Clipper (group by id) to trim the line to the edge of the box.

Sample attached.

Hi nielsgerrits,

Yes, they have a group ID. The thing with this method is that the center line does not have the same angle as the other line, as you can see in this image.

Userlevel 6
Badge +32

Hi nielsgerrits,

Yes, they have a group ID. The thing with this method is that the center line does not have the same angle as the other line, as you can see in this image.

It should have, if you set the boundingboxreplacer to oriented bounding box? This will not work when the distance between the lines is bigger then the lines are long, because then the centerline will be rotated 90 degrees.

Hi nielsgerrits,

Yes, they have a group ID. The thing with this method is that the center line does not have the same angle as the other line, as you can see in this image.

Sorry, i forgot to set it to oriented bounding box. Thank you very much!

Userlevel 6
Badge +32

Hi nielsgerrits,

Yes, they have a group ID. The thing with this method is that the center line does not have the same angle as the other line, as you can see in this image.

Great, happy that it works for you :)

Even if the distance between the lines is bigger than the length of the lines, you can test this (set attributenames for length long and short sides), then you can get the centerpoint of the line and rotate it 90 degrees around it.

Reply