Libraries for txt_to_dxf (Day 1 Week 2)

From now on, I will also write something in the topic with the day and week. It’s kind of lame to just write date and week part. Okay let’s come to my today’s work.

So, first thing first, the github link of this project has been transferred from my private repository to GreatDevelopers organization. Here’s the link:

I solved the issue of wrong placement of description of the circles and arcs. Actually at first the program was calculating the center of centers of each figure. But now I have changed the code to find the center from the given extreme ends of each figure. Here’s the link to the issue:

My next task was to convert the current dxf format into Drawing Exchange DXF 2007 format. So, I changed the header and footer data according to the format but it generated another problems like line was not visible, the output was still not supported by other cad softwares like QCAD, DraftSight etc.. There were many parameters in the header data which were changing whenever some changes were made in the figure in LibreCad. I was not able to figure out anything. That’s when Harinder came to my help. He suggested some new libraries like ezdxf 0.6.2 and dxfwrite 1.2.1. These are really good libraries as they support every basic elements like line, circle, arc, 2Dshapes, polyline etc., Dxfwrite generates the dxf file in R12 format which is a very old format but ezdxf generates in R2010 format which very much new. So, I will be moving on with ezdxf one. Let’s see how this one will help.


Day 5 Week 1

Today, I added the Arc feature to the project. Now, the users will be able to draw arcs by specifying some parameters like center coordinates, radius, start and end angles.

How to use:

The input format for drawing an arc is given below.


type, description, show_figure, layer

Here, (x,y) is the coordinate of the circle of which arc is part of, r is the radius of that circle, s is the start angle and e is the end angle.

For using the arc feature, you have to specify ‘type’ as ‘A’. You can also draw more than one arc under single description as shown in the above example.

How it works:

– Drawing Arc

The program uses the draw_arc function to draw the arc.

draw_arc(object_id, point, radius, st_angle, end_angle, layer, w_file)

Here, object_id is the unique id for every figure, point is the list containing x and y coordinate like [0,2] and w_file is the output file. This function will generate a dxf block which will specify to draw arc with the provided properties.

– Drawing Text

The text should appear right at the bottom-center of the figure or the group of figures. The general approach to finding this one is

description_position = ((maximum X + minimum X)/2 , minimum Y)

where X and Y are the lists of every extreme end x and y coordinates respectively.

For finding these extreme ends, I tried many methods but none of them worked. Ultimately, I had to take the decision for specifying end points for every cases.

There is a total of 20 conditions where some equations repeat, some doesn’t but there is no relation between them. I know this not a good approach but if you could find a new approach, feel free to contact me or comment below.

Thank You!!

Day 4 Week 1

Today I solved the problem of position of circle description. So, what it does is just find the lowest point of every circle with same description and then find the mean of their x-coordinate. The coordinates obtained are passed to the drawText function which draws the text under the figure.

I have uploaded the software to the Github server. Here’s the link to the repository: .

Further new tasks have been given by H.S Rai sir:

  • Add the function to draw arc
  • Change the header and footer according to the DXF 2007 standard
  • Add the function to draw hatch

Day 3 Week 1

I finally developed the code to add the option for selecting circle or line inside the CAD scripts. Understanding the code took major part of the my day. But still the code has some major drawbacks:

  • Output dxf file is not supported by QCAD. Actually it’s the problem of original code. I think may be header or footer will be the problem.
  • Figure description of circle needs to be resolved.
  • I need to add some more if-else for avoiding input mistakes by users.

Day 2 Week 1

I finally got the link for CAD Scripts from H.S. Rai Sir. Here it is . I downloaded and explored the software. So, here’s what I did:

  • Understood the structure and working of the project.
  • Tried some provided samples.
  • Checked the outputs on LibreCAD.
  • Understood the format for writing input file and tested some samples of my own.

and here’s what I know now:

  • This software draws path from the provided coordinates in the order provided in the input file using lines.
  • It also provides the options for choosing layer, hiding the figure and giving description of the figure.

Now, H.S. Rai Sir has given me the task to provide two options in the input file format such that user could choose between path and circle. Let’s see what I am up to!

Day 1 Week 1

Today was my first day at training and I have been asked to work upon CAD Scripts. I searched for this software but I wasn’t able to download it from anywhere. But still I looked upon some old discussion related to it and here’s what I know until now.

CAD, or computer-aided design and drafting (CADD), is the use of computer technology for design and design documentation. CAD softwares are mainly used to draw 2D and 3D shapes and structures which will be representing some designs or plans. Now, it is a graphical software. So, we use the tools provided in the software package to draw different elements like line, rectangle, circle etc. These drawn figures can be saved in many formats like .dwg, .dxf, .prj, .pgn, dgn etc., but .dxf is the most famous one. DXF file format was developed by AutoCAD for enabling data interoperability between AutoCAD and other programs.

Now, for most of the time we don’t want to specify each line graphically. Instead passing some coordinates to a program and directly converting it into .dxf would be a better option (this is what I feel should be the reason!). Here, CAD Scripts comes into play. It is a software which convert .csv or .txt file into .dxf file and thus makes the process of making a figure with known coordinates easy.

As soon as I get the link to the program, I will start working on it. Until then, bye!

Further Progress in JSXC

It’s been really a long time since I wrote my last blog. Now let’s see what has been done in these last 7 days.

So, when JSXC was finalized, I and Ranvir started figuring out what should be done and how it should be done. So, the first thing we come up with is to solve this issue : . According to this issue, the chat application doesn’t save the history in the server but saves it as a cache in the browser and thus causes loss of the chat history on trying to access the application from different system or different browser.

Now, to solve this problem, we actually have to add XEP-313 feature to our app. And the great thing is that we don’t need to do it from scratch as there is already an implementation of this feature present in the strophe.js library. Strophe.js is an XMPP library for JavaScript. More information about it can found in here -> . The feature can be added to project using the strophe.mam.js file which can be found in here -> . Now, the only thing to do is to add this feature using the functions provided by this library.

But here comes the real problems, the project in whole is a collection of complex and big files and adding this feature will affect the core of this chat application. So, we started to converse with the real developer of JSXC and he guided us to make a new pull request by making some changes in the files which would make the project ready for using the mam plugin and new policy for it will be discussed in there. Here is the link to pull request -> . Currently, we are discussing on how it should be used in the app and when we have to use it.

We have also changed our default remote directory for SunehaG web client. Here is the link -> . All the work regarding the SunehaG web client will be done in the sunehaG branch and work regarding the mam feature will be done in the feature-mam branch.