Group lines from DWG, PolyCurves from DWG

Hi Dynamo Community,
I have 9 polylines touching each other as shown, imported from DWG inside dynamo, and I want to group each ployline in a sublist in dynamo, BUT unfortunately dynamo read them as one group of lines
is there anyone can help to put each polyline in a sub-list and still keeping all lines in the same layer?
(I know that if i put them in different layers it will work but for some reasons i have to put all the lines in the same layer)
i tried all the possible nodes to use as shown in the photo but in vain.
Thanks in advance.

Hey,

I think BiMorph has some good nodes for dealing with DWGs…

image

Hope that helps,

Mark

1 Like

Thanks Mark for your concern,
But i already used it but it doesn’t give me what i want . it also give me all the lines in one list not sublist for each polyline.

I really tried to find a solution for that case.

What kind of results are you expecting? Seems like all curves are joined together so 1 sublist is a logical output.

If you want to group the curves by their direction only you should use the node List GroupByKey, using the directions as keys, before using the node from archilab

1 Like

Thanks Daan,
I just need to group the lines according to each polyline in the DWG (without changing the layer of lines in DWG)

Hi @hanywillim …not sure at all, are a little bit confused how you wanna group them…but probably something…

or

1 Like

@hanywillim look into DynaMEP package:

Remember, if you see nulls or errors in exploded polylines, fix and cleanup them in autocad (overkill command etc.), or you’ll lose that polylines. Later you can make polycurves from sublists of exploded polylines.

1 Like

Okay, you should use the layer of each line, instead of the direction I proposed, as keys instead. You will have to group them by layer first otherwise you will never be able to group them by layer & distance.

Thanks Sovitek,
Actually what i am looking is to collect each square (which represented as one polyline in DWG) to be in a square.
In face I am just simplify my question but in fact i have many polylines touching each other and all of them are in the same layer and i want to separate them in sub-lists.

Many Thanks Bro for your help,
It worked perfectly but i faced two problems
1- Only choose the file path (not a linked DWG from Revit file)
2- Only workd for .dxf files not .dwg files?

So, how can i used for the DWG files and get the same results?
Thanks in advance. :heart:

  1. Try to use some tool like Convert DWG to DXF Multiple Files Autocad with one click - YouTube
    We can run it from Pyhon, i’ll help with this code.
  2. Retrive linked DWGs path.
  3. Replace .dwg names with .dxf when reading files with DynaMEP.
1 Like

Use the Camber package if you want to work with dwg’s without opening them manually.

However, please mark this topic as solved and create a new for this since this is deviating quite a bit from the original question.

1 Like

also you can try just get Element.Geometry of dwg import instance, it reads DWG Polylnes as Dynamo Polycurves:

1 Like

Many thanks VIadimir,
I really do appreciate your concern bro, but there is an issue here that it will import all the layer do you have any idea how can i filter the layers before or after using Element.Geometry?
Many thanks again in advance :heart:

To be honest I’d just get your CAD users to isolate the needed lines and copy to a new file versus trying to wrangle them from the overall file. That way you only get what you need. Hopefully theyre putting them on a consistent layer for isolate/copy anyway, doesnt take long.

Vladimir has solved the original problem. If you wish to pursue layer specification and/or getting link geometry please begin a new topic as these are different issues. This helps others find specific solutions to a problem in future when they search.

1 Like

I’t rather do the automate dxf export in Dynamo from current revit file, so we’ll have dxf import and make use of DynaMep layers reading.

P.S. Have some idea, i’ll edit post.

1 Like

Many Thanks @GavinCrump for your response and i am one of your fans on YouTube and Thanks again on all of useful videos, God bless you always :heart:

1 Like