As shown in my “Start Condition” image, I have several hundred polygons comprised from curves/lines. Within each of these polygons are a number of short lines I’m calling “Notches.” These are shown within the circles. The polygons and notches are on different layers.
I need to locate each of the notches and extend them towards the outside of the polygon by a short distance, say 1/10". This is shown in the “End Condition” image.
You could use the Extend Curve (Ext) component.
Since, it’s able to extend lines by distance, your desired extension length of 1/10" should be fairly easy to achieve. However, the component accepts two length parameters, L0 and L1, for an extension distance at the line start and at the line end.
Your input lines might not all have the same direction, which produces irregular results. Some lines would be extended inside and some outside of your polygon.
Now, there are a number of possibilities to achieve your goal.
Either, you want all your curves to have the same direction, to be able to manually chose L0 or L1 as the appropriate extension length parameter, or you could use both parameters - L0 and L1 - by evaluating the curves by direction and automatically dispatching them to the right input.
Furthermore, a combination of both methods would also be possible.
Try this:
Find the intercept point between the notch and the line.
Rotate the notch 180degrees about the intercept point.
Then join the 2 parts of the notch if you need to have them as one line.
First off, many thanks to both P1r4t3b0y and DrewBatchelor for your replies. I
decided that I should start by simply locating the intersections. So, I compared the six notches to the two polygons using the CCX component. This worked fine with any two intersecting elements, but if I selected most or all of them at once, depending on which (clearly) intersecting elements I selected, it would sometimes find the intersections, and sometimes not:
So, I assume I’m misunderstanding the way the CCX component is meant to be used. Should it be limited to comparing two single lines? Can anyone clarify for me?
I also tried the MCX component, but some of the polygons are comprised of separate lines, and the endpoints of those lines were also flagged as intersections.
Also, in P1r4t3b0y’s reply, is there a component that might be used to indicate which line endpoint corresponds to the detected intersection point?
Finally, once an intersection point is found, should it be possible to retrieve the notch’s center point, and set its direction using the center point and the intersection point?
Thanks, HS_Kim for your help!! I’m slowly working my way through your solution, trying to understand how you achieved it. Reading up on the difference in “grafting” and “flattening” trees. Just, basically, trying to reverse-engineer it.
I did find one odd thing—I tried it on a copy of the actual dataset, which contained a couple of hundred “polygons,” as well as about 400 “notches,” and noticed that approximately 15 of the notches were extended towards the interior of their associated polygons. So, I excluded those notches and their associated polygons from my input elements and found that a different group of notches were now extended the incorrect direction.
Thinking I might simply have overlooked those the first time, I also excluded those additional notches from the input set. What I ultimately found was that I was chasing my tail—different combinations of input notches/polygons caused different small groups of notches to extend incorrectly.
I ultimately ran the GH script on the entire selection set, and just fixed the incorrect few manually. But, being the GH novice that I am, I couldn’t understand the script well enough to troubleshoot it.
Thanks, again, for your help. You saved my a ton of time, and gave me a lot of GH info to try and learn from.