Curve.Offset not working when points get too small

Hello all,

I’ve been working on creating a script that shows me all unique rooms on a certain level and create a polyline from those roomboundaries. Though I’ve come to hit a brick wall where I try to create an offset from those roomboundaries, but due to some of those rooms having a rather unique shape the offset node won’t work because it probably exceeds a curve point resulting in dynamo not being able to create this new polyline from the offset node. I hope this all makes sense so far.

Here’s what I currently have:

I want the offset also occuring in the current room without the offset but due to I suspect the following image it can’t create said offset:

I would highly appreciate any help regarding this case on how to solve my problem and create an offset polyline by whatever means possible.

Here’s my script:

Hi, @LiamvM!
It seems that you have two ways:

  1. Fix contours in Revit.
  2. Or use some tools in Python in Dynamo, like Clipper library pyclipper · PyPI. It hadles imperfections and allows offsetting like in Autocad.
1 Like

1: Unfortunately I cannot fix the rooms because it is from a 3rd party linked model, so every time we receive a new update from them I’ll be facing the same issue.
2: I don’t have any experience in python so I’m afraid I won’t be able to program the code to make it functional, though I do appreciate the thought. (Perhaps a good starting point to enter some python course so I can write python myself in the near future)

Thanks again for the suggestions but sadly they won’t be able to resolve my problem on the short-term.

What version of Dynamo is in your workflow?

Dynamo Core: 2.12.1.8246
Dynamo Revit: 2.12.1.11123

2.16 (I think) and up should handle that offset.

Open a detached copy of the model in 2023 or 2024, do the offset, encode the resulting curves to a SolidDef format, save that to a text document. Then in your attached real model read in the text document, deserialize the solid def, and progress from there.

1 Like

I’ll see, how i can help you.
But be ready for another bunch of problems. In real life projects contours of rooms may be broken, so you can’t bulid closed polycurves from lines.

@jacob.small
How about Tessalating, and skipping the smallest triangles?

Hi,

1- You can offset the boundary lines of the rooms as x1000 and then offset them again as -x1000 and combine them. In this way you can get a smooth and closed polycurve.
2- You can solve this directly with the “Shapely” package,

Durmus

2 Likes

Interesting, though the 1st thing sounds illogical I will definitely try. Thanks!

Hi,

Here’s a reference for you.

@LiamvM, try ClosedCurve.Offset+ from Springs package.

@Vladimir, node didn’t seem to work on my polycurve. Though it was no problem when just using curves.

@Durmus_Cesur, offsetting it by 1000 didn’t work either, not sure what the problem of that was though. Would probably have to do some further investigating. Still haven’t given shapely a try though.

I currently have done the following. I’ve just offsetted the curves for now without merging it into a polyline. Now I hope with the intersecting lines that I can create new points and make new lines between those points. Also ignoring lines that are shorter than 500mm.

It currently looks like this:

Also wondering how to turn the following line into a single one whilst keeping the same direction.

@LiamvM can you save the lines of this room with Data.Remember node and share DYN file? It seems that we have non-closed or self intersecting polycurve. Also test polycurve with Curve.IsClosed node.

@Vladimir Ah, thanks for suggesting. It does indeed seem that the polycurve isn’t even closed at some of the indexes since it returned the false boolean.

Here’s the file if you’d like to experiment yourself:
Section Views for Interior Room Finish.dyn (148.7 KB)

Place Data.Remember before Offset, please. I need all initial polycurves for revision.

This should do it:
Section Views for Interior Room Finish.dyn (153.8 KB)

If we have not closed curve with one gap, it will work. In other case we have to group curves, analyze gaps and fill them with lines.

Great, will have a look at this tomorrow. Thanks!