Replace door with a lline in shp or dxf files?

108 views Asked by At

I need to replace this(all such doors):door image

with a line: line image

I am trying to use python modules for this, but I don't know how to approach the problem.Can I detect arcs using easy dxf? But what do I do after that? Any help, even with regard to the algorithm to follow will be appreciated.

1

There are 1 answers

2
Roland Smith On

DXF files are plain text and not that difficult to parse. My nctools module on Github contains a rudimentary DXF parser for a limited set of entities. There are complete references to the format online.

The drawing of the door can be done in several ways. It could be one ARC with a bunch of LINEs or a bunch of POLYLINEs. And they wouldn't have to be in any particular order to yield the same image. And the doors could be in different orientations. So in general detecting this shape is very difficult.

There are several situation that could make it better, ranked from easy to difficult.

  1. When the door is defined as a BLOCK is it easily handled; you can then just replace the block with another one.
  2. It could be that the door is always the same sequence of entities, just with different coordinates. For example 6 LINEs, followed by an ARC followed by four LINEs. This could also be detected.
  3. When the door entities are all in a separate layer you can at least filter the entities by layer.
  4. If all the doors have the same size you can at least look for the correct sized drawing entities.

Handling anything other than case 1 or 2 will be unpleasant and difficult to say the least.