Join and trim curves

Hi all.

I am working on a script for months now and I have come to a point where I am out of ideas to research. I would appreciate some help if someone has any ideas, please.

I have a collection of perimeter walls. I have obtained their location lines so that I can take them to a drafting view, but the segments don’t close perfectly. So, after checking several alternatives, I settled on LineLoop.Merge.

This works well, but in testing the script, I produced a bump out on one of the facades. Those lines don’t close correctly, they either fail to close or they are trimmed in wrong pairs. Below you can see a side by side comparison between the Revit model and the drafting view:


in the unit to the right, the node works as intended, while on the left, it is merging the wrong segments:

It’s not like there is a lot to share about the script, but here is the part that involves the node:

I have tried everything I can think of:

A: Geometry.Trim (previously referencing the centroid of all walls as a group
B: List Reverse
C: Sort By function, curve length
D: Group Curves

So, if I don’t sort or do anything to the original list of curves:


the outcome is this:

it works well with no “bump outs”, but fails to trim the rest of cases.

Now, if I increase the margin in the LoopMerge node beyond the maximum distance between walls in a unit, in this case 38.42 feet, this is what happens:

Also, it doesn’t make any difference if I use the “ordered” list output instead
I don’t know, I am stranded. Thanks for your help

Hey,

This sort of thing is always tricky, as the geometry can vary unpredictably at least you have quite regular rooms :slight_smile:

I’m not sure if the wall the other side of the corridor is wanted to be part of the loop or not?

If you know you are always getting the centre line of a wall, and you know its thickness, could you extend all lines in both directions by the thickness? then (check &) trim to intersection? That would tidy up the main building…

Hope that helps,

Mark

1 Like

Hi Mark. Thank you for your response. Everything helps.
Unfortunately I can only share some details, but I will try to illustrate the situation.

The lines you see are not wall location lines. They are location lines offset half the thickness of the core layer, in other words, I am aiming at the outside face of studs in order to provide a diagrammatic Drafting View that is easy to dimension. I work at a modular construction company, so what you see there are actual modules, which is why geometry comes grouped and the list structure is the one it is, I need to keep that structure in order to tell what “box” things are related to.

I don’t know what exact wall you are referring to, but all walls needed are already fetched since the selection responds to a filter by type mark.

In answer to your suggestion, extending lines by thickness, I don’t think that would work, since it would always depend on how walls are joined in Revit, which I can’t depend on.

I have seen this node work perfectly in similar situations:
Curve Trim/Extend Problem - Revit - Dynamo (dynamobim.com)

I just don’t know why it wouldn’t do the magic here, so I am sure the node is working well, it’s something related to the order of curves on the sublist, just don’t know how to sort them, that’s my guess.

I will try to post a simplified version of the problem and a simplified version of the dyn.

Thanks again

@leonHKFTG have you seen this thread? Organizing/Ordering Points for Polygon

Suggestion would be to take your curves, then extend the start and end of them by half the thickness of the core layer + a tolerance value, then use one of these algorithms to join them :slight_smile:

1 Like

Thanks Solamour, I appreciate, I will read through it, I’ll have to wait a bit (at work now) but will take a look.

1 Like

Hi Solamour. Apologies for the delay, I was caught at work, I am only looking back into this now.
I have checked the post you shared, I appreciate. I think the answer is there, but it is resisting. I downloaded the dyn that Vikram shared:

, but I am getting some warnings to do with multiple definitions for "List’ I believe it is related to the fact that I have Orchid installed.

Anyway, I have created a simplified version of both the dyn I am working on as well as the Revit file, I will keep working on this, and I will post them here in case someone has time to experiment too.
WALL CURVE TRIM.dyn (112.1 KB)
M_03_reduced.rvt (904 KB)
The thing is that once i created the simplified version of the Revit file, I don’t get the output that I believed caused your proposal to extend the start and end by half the thickness of the core layer, I only get the walls not being joined (depending on the margin parameter used) or I get them trimmed and joined in the wrong order at the bump out:

case 1: (margin 1)

case 2: (margin 7)

and those are the outputs, it seems like now, even if the margin is 100 it does not make any difference, as it did before:

The dyn I have uploaded does not contain Vikram’s code, I am now going to try to add it.

Thank you

It’s taken me a whole day to understand. You want me to extend because you are after generating the intersection points, without which none of those algorithms would work. And I guess you asked about the corridor walls because they are too far away and the amount we would use to extend the other walls (half the thickness of the core) wouldn’t do for them and vice versa, and you are right, if I extend them, say for the sake of simplification, a foot, the corridor walls don’t make it:


But if I extend 7 feet then we get more intersections than we want:

however, no matter what I seem to not be getting the resulting polygon I am after:

I will keep trying with the rest of solutions there, including yours.
Thanks

OK, my two neurons were tired enough as to save time by working.
I tried the script you provided on that thread


It works, trying to fix the corridor problem is just not necessary for me, I can model differently and extend those walls, then I would either include an opening or just edit the wall profile to open it, it’s fine.

I think c.poupin’s code didn’t work for me since it is more model line or model element based.

I appreciate your help and Mark’s, I will consider this closed, I believe anything needed on this topic was covered on the thread you took me to, I apologize if I made a mistake creating this one, I honestly hadn’t seen it.

Thanks again

If you’re looking for the face of the core, why not just query that directly?

2 Likes

Try this Python code.

But you have to divide points into 2 separated blocks first. (Manually, GroupByDistance or other)

2 Likes

Knowledge is freedom. I didn’t know we could query wall layer edges, I will for sure take a look but I am not proficient at all with the API. I appreciate your response

I will investigate this approach too, thank you very much

Depending on yourRevit version there may be a “Room.Boundaries” node which returns this data for you via an extra input, circumventing the need for the API call.

That would also be a good approach, thank you. it’s a long story but due to the fact that we do modular, I actually need to avoid rooms as much as I can. I don’t have anything against the feature, it’s just that we group geometry and our production team sometimes includes rooms as group members and this causes problems and unnecessary file size increase.

Your advice on the API is simply better than what I can follow, one day I hope to get there.
I have tested solamour’s method and it works for me, my only issue is that I need to feed the node Geometry.Intersect with sublists as opposed to flattened lists since I will work with groups. I would have to make all items in a sublist work as if they were a single list, intersecting each other cross product.


so I tried all lacing and levels possible on the Geometry.Intersect node but can’t make it happen, so used “node to code” and I am trying to figure out how to make that work:

Thank you again for your help

Hi,

I have a collection of perimeter walls. I have obtained their location lines so that I can take them to a drafting view, but the segments don’t close perfectly.

Mine close perfectly… How are you retrieving the lines?

Cheers,

Mark

Please use the sample files provided by thread 6/15 (April 27th)
You are using a node that captures layer’s location lines, so those will be in the middle of the layer, and you seem to be using generic walls, likely with fewer layers. I am offsetting those lines you are working with, half the width of the core layer, in the direction of their wall orientation vector. That’s why they didn’t close for me, but that was several threads ago, now they do since I have extended their starting and ending points as per solamour’s advice.

My only issue now is how to make the code block converted from Geometry.Intersects work on sub-lists.
thank you

Hey,

Here’s my play around, which you might find interesting?

It creates a closed curve which includes the corridor, and I think it does the geometry intersect part as you’re thinking…

The clockwork node gets the location lines so they close, that let’s me identify the end points, I find their distance from the only other curve in the group and extend them that distance, then close the polycurve with a line.

I presume your diagramme isn’t so worried about getting the exact offset with the varying wall thicknesses…

Cheers,

Mark


WALL CURVE TRIM-MA.dyn (78.8 KB)

1 Like

Thank you Mark, I apologize for late response, I will take a look asap. But yes, I do care about the exact offset since that is what yields the exact box stud to stud overall dimensions, I need to make sure that the curves that you are showing in your image correspond to the outside face of studs for each box, thank you.

2 Likes

Oh well, never mind, hopefully you might find the intersect part interesting.

1 Like

Thank you Mark, it is interesting, I just need to find some time to try to adapt that part to my workflow, I will definitely give all options expressed a try. I appreciate your help and the time you put into it!

Best regards

1 Like