Extend beam in dynamo to stop when hit object



I’ve made an excel-program which creates a text file which I use in Dynamo. This autodraws a lot of beams with a given length (from excel). I want dynamo to extend all the beams until it hits another object and then stop.

This is basically what happens if you use the “Trim/Extend Multiple Elements”-function, press the object it should stop against and then press all the beams. I want Dynamo to choose all elements as objects it should stop against and the pick all the beams (which I already have) to execute this operation.

Is this possible?


Sure it’s possible. You’d have to extend the beams enough to be sure they intersect another element. Then get the intersection point of the two elements. (It’s quite possible your beam will intersect multiple objects. You’ll have to pick the intersection point closest to the beam.) Finally, extend your beams to the closest point of intersection you found.


You could cast a ray in the axis of the beam to find out the next element it hits


How can I find the intersection point between two structural framings? I guess they really are just lines with a “graphic” on them, which means that the “graphic” intersects, but never the actual lines.

What I want to do is shown in the picture below.
All the pipes start out as the ones in the bottom of the picture.
I have extended the first pipe until it hit the beam.
I am about to extend the second pipe until it hits the beam.


If all the pipes are going to be extended to the same beams why can’t you use the Trim/Extend Multiple Elements command? Select the face of the beam (or create a reference plane) then select all your pipes to extend to your selection.


Make those lines a plane and they will intersect


Like manually?

I could do that, the problem is that every time I change something (e.g. beam-size) I have to rerun the script, which means I have to do the manual job every time (and there is hundreds of pipes and beams). Therefore it would be easier if I can add a few boxes to the dynamo script that does this automatically.


Can you make the line behind the structural frames to planes? If so, will the structural frame still look the same?

I was looking more for a way to extend the line until it hit something (anything, doesn’t need to specify it) and then stop. But it doesn’t seem like there is an easy way to do it.

Btw. thanks for all the suggestions!


Then I would create reference planes and align them to the face of your beams. In Dynamo, create a selection for each set of pipes and the reference planes that will be controlling their extents. From there you just need to get the projection point of your pipe centerline onto the reference planes and use those points to set the extents of your pipes.

If you’re looking to extend your pipes until they hit anything you’ll have to use a ray bounce or geometry intersect.


If you select the structural framing with select model element you can then use StructuralFraming.Location to gete the curve.
Using the curves tou can create the intersection


Sorry i gotta run… its the weekend here but hrere’s start