Skip to main content
Solved

Create middle line from multiple line

  • September 22, 2021
  • 5 replies
  • 206 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

Best answer by nielsgerrits

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • Best Answer
  • September 22, 2021

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.


  • Author
  • 15 replies
  • September 22, 2021

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.


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • September 22, 2021

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.


  • Author
  • 15 replies
  • September 22, 2021

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!


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • September 22, 2021

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.