txt to Drawing in LibreCAD

Recently, I have been working with DXF library. My aim has been to take a text file as input from the user which has details of different elements of a building. Currently I am focusing on the wall entity. On parsing the input file, it yields a DXF file as output which can be opened up in softwares that support the DXF format.

To achieve this, I have gone through things beyond the use of DXF library itself. The correct use of regular expressions has been providing the expected results so far. Not much going into the implementation for this post, I have an input text file with details of two walls written as follows:

wall(l=100,h=30,cx=10,cy=10)
wall(l=10,h=50,cx=0,cy=0)

l depicts the length of the wall. h is height of the wall while cx and cy are coordinates of bottom left corner of the wall.

Following up the format of writing a DXF file including its header, the entities section followed up by the footer, on opening the DXF file, I achieved the drawing similar to the one below:

Screenshot from 2015-09-02 21:33:42

Leave a Reply

Follow

Get notified with the latest posts

Plugin Supporter WordPress Post Navigation
%d bloggers like this: