Skip to main content
Hi FME Community,

 

 

I am quite new to this forum, and FME in general. Can any nice pro in here help me with this one?

 

 

I am trying to work on an electric network map, which is of very bad quality. It´s in dxf-format only, everything in one layer, no linetypes, low geometric consistency and the only thing separating different lines are their colors.

 

 

Underground cables are supposed to centerline-dashed lines but the dxf only gives them to me as a great number (~500k) of lines of  ABOUT 1 and 5 meters length following each other at ABOUT the same azimuth.

 

So, what I would like to do is somehow replace these multitudes of lines with fewer lines, which I then could assign centerline as linetype.

 

 

 

 

The different colors represent different voltages.

 

The short lines length are ranging from 0.9992-1.0007 and the longer ones from 4.9992-5.0007.

 

What makes this one tough for me to figure out is that he azimuths/angles of the seemingly parallel lines are not equal. For example in the picture above:

 

Long upper red lines: autocad_angle = 9.7053

 

Short upper red lines: autocad_angle = 9.6791

 

Long lower red lines: autocad_angle = 9.7072

 

Short lower red lines: autocad_angle = 9.7357

 

 

I was thinking of sorting out the lines of ca 1 and ca 5 in length by using Tester (BETWEEN) and separating the different voltage lines through AttributeFilter. Then somehow using Snapper, LineJoiner and AzimuthCalculator to simplify, but it beats me how to make the red lines connect to become two (almost) parallel lines and not "cross-snap" to each other.

 

Of course the network contains lines of all ranges of angles...

 

 

If anyone has any ideas, thanks a lot!
Hi,

 

 

U can extract the color from the autocad file by exposing the relevant attribute attribute (you can check this in the inspector feature information window).

 

De alternating_dashes wich as u you said have an angular difference between long and short, can be grouped by this difference. So it is actualy a perk.

 

The dashes would have samish length, and distance between them would be constant.

 

This too can serve as a means to select them.

 

 

Use  by groups: color, lenght and angle.

 

 

Etract beginning and end of lines to acquire the distance between them. You can do this with a coordinate extractor and setting 0 and -1. Distance is calculated between these point by normal pythagorian calc. Put thesein a list and sort incremental. Listindexer on first element shoul yield distance between the dashes (only betwwen long or between small)

 

 

Rather then snapping long and short dashes, you now snap only either long-ones or short-ones.

 

Snapping distance minimal the length you calcuated previously.

 

 

everything must be done while maintaining the grouping (color, lenght and angle).
Thanks Gio!

 

I´m not yet familiar with using lists, but I guess I´ll try to look into it so I can try your solution.

 

 

As nothing i this source file is constant (except colors) the spaces between the dashes also varies a few tenths of millimeters, ranging from 1.9995-2.0007.

 

 

One thought that ocurred to me was if there was a way to control the snapping to only snap to endpoints within just that partycular distance span (1.9995-2.0007). The span is so small that there would be no risk of "diagonal" snaps between parallel lines.

 

Would that perhaps be an easier way of solving this, without extractning coordinates and creating lists?

 

 


Yes,

 

 

If the span-distance is always smaller then the distance between parallel lines, setting it to just the right amount should prevent "cross-snapping"

 

 

Also i do assume that, as the dashed lines are Autocad created, there is a certain constancy within a single dashed (poly)line.
Hi,

 

 

Another thought. This may be seemingly strange approach.

 

 

Step 1

 

Extend every line with the Extender (Fig.1).

 

Extract coordinates of extended lines (end point for Beginning line; start point for End line).

 

Create buffered area of the extended lines grouping by autocad color (Fig. 2).

 

Specify List Name when buffering. e.g. _coord.

 

 

 

Fig. 1 Original lines are grayed.

 

 

Fig. 2

 

 

 

Step 2

 

Check the number of the list element.

 

If the number is equal to 2, create a line segment filling the missing part with 2 VertexCreators (Fig. 3).

 

 

 

Fig. 3

 

 

Then, connect original lines and created lines with the LineJoiner (grouping by color).

 

Appropriate length for extending and buffer amount would be decided through trial and error.

 

Hope this helps.

 

 

Takashi
You could always dropbox a piece of the .dwg.

 

 

So i can try if it is doable, should you wish to.
Gio:

 

No, I mean that the span between 1.9995-2.0007 is so small that IF you could set the snapping to only search for nodes to snap to within that span, then the risk of snapping to wrong points would be minimal. Sorry for not being clearer...

 

The DXF-file is an export from another software with very limited exporting options so the lines are not AutoCAD-created, thus the bad consistency with different angles and distances between the dashes that should be considered as one line.

 

 

Takashi:

 

That is definitely an interesting approach. It could work I think.

 

 

Here is a link to a part of the file I´m working with:

 

https://db.tt/Or17ykUb

 

 

I have managed to sort out and fix most objects, but the dashed lines proved too tough for me to manage. 🙂
Hi guys!

 

I tried Takashi´s way and it worked fine, I managed to reduce the number of lines dramatically and that was my goal. The buffer-part of the operation took a lot of time to process though. Maybe Gio´s way would be faster but I had easier understanding Takashi´s way.

 

 

When I get more time for it I will have to try and figure out how to connect the lines where the rows of lines change direction and differ in length.

 

 

Thanks a lot to both of you, appreciate it!

Reply