You can use DynaMEP package to read DXF(not DWG). And here we can get Polylines as Dynamo’s Polycurves (segments are groupped in sublists). But to get them right, polylines must be perfect, no null length segments, bad branching, etc. It can be done with Overkill command and some other tools in Autocad. Or you can filter that bad Polylines and try ti fix them in Dynamo. Feel free to ask any questions!