Reduced amount of Lines and join the rest of lines

Hello everyone,

me again :)…
I am converting dwg polylines into the Revit lines and I am getting huge amount of the lines. Very small ones.
With the script I am deleting every second line and I want the rest of lines to join into the closed loop.
Then this closed loop I can use for hatch or masking region. It’s detail lines inside detail family…

Just struggling with the joining part, tried many options but nothing…

Thank you in advance for your reply :)…

Damir Cesko




Hi @ceskoMU3VA could you share your dwg/rvt file

Let me get this straight, you want to take adjacent pairs of the remaining lines and “extend to corner”? That won’t work well, you’ll run into issues for certain relative positions of the pairs of lines which you can’t reliably predict. Just get the starting point of each line, drop every 2nd one and join them. That way you’ll also be able to adjust the degree of simplification very easily, say just take every 5th point etc.

1 Like

Hello @sovitek , I explode dwg on traditional way by Revit. Here is the Revit Family with the lines. Thank you…
DET_Ansicht_Person 1_R22_Linien reduzieren.rfa (428 KB)

Hello @vancikv , thank you for your reply. Will try that sugestion…

Hi @ceskoMU3VA not sure if it something here you are after, here i have reduced your lines from 387 to 100…but as you see then its approximately…

4 Likes

Smart, love it, better than my solution. Of course, you’ll have none of the original points exactly but I highly doubt OP cares about that.

1 Like

Curve.SplitByPoints perhaps would hold the original geometry closer. Not sure it works on PolyCurves though…

https://dictionary.dynamobim.com/#/Geometry/Curve/Action/SplitByPoints

1 Like

Hello @sovitek, thank you very much for your solution.

In this case I decided just to take a references from lines from dwg to create a new ones with your script. Founded more practical hen just copied them. I set the number of 150 total to be closer to the shape before. Everything works just perfect. It’s not too much diference in Mb from two Revit Detail Families but maybe overall when we are having too many inside the model makes the diference…

Thank you again both for your replies. Sorry, also to @jacob.small thanks to you…Didn’t see your post…
In atachment is the final script for everyone who wants to use it for their work…

I wish you nice day today :)…

Damir


1 Like