Watched Week 2 Videos

Well, it’s been a long time since I last wrote my daily diary. All these days I have been trying to learn finite element methods. These methods are basically used in engineering problems like heat transfer, elasticity, current flow, computer simulations etc,.

I am following a course on coursera for this topic and it’s going pretty rough, as a lot of mathematical terms have been used like finite dimensional pde, boundary condition, Hilbert Spaces etc. I am already feeling like studying in 12th standard again.

Today, I watched 6 videos of week 2 and it gave a pretty clear understanding of what we are doing. I want to share some general points which are important:

  • More interest in finding approximate solution than exact one (harder to find).
  • Approximate solution can be found by limiting the solution spaces where Hilbert Space comes into play.
  • Hilbert Space only constitutes those functions whose solution is square integeral of itself.
  • Divide the whole input domain into smaller intervals, find approximate solution at each one, and then integrate everything to find final answer.

Learning Django

Today, first of all I helped Abhinav Handa in setting up VNC for his raspberry pie as he wants to control it from any part of the world. After that I learned Django by making a polling app using this post.

I have got some new tasks from Mr. HS Rai:

1. Make an option to include beam related data in dxf.

2. Make a webapp in Django to convert txt into dxf file or any other compatible format like jpg, png, pdf etc,.

I have to finish it by Friday.

Added Hatch feature

Today, I worked on my code and solved all the problems related to hatch feature. Here’s the commit. So, the hatch at this time is only working on polyline and has limited features like you can only choose the colour of the hatch through datafile. Gradient and pattern fill is still to be worked upon.

Here’s the format for adding hatch:


where ‘H’ tells the program that you want to use hatch.

Polyline feature available

Today, I solved all my errors of yesterday and implemented the polyline entity through my code successfully. Here‘s the commit.

But, I still have to work upon the text part of it. As deciding the lowest point in a polyline figure is somewhat hard but I know I will find it somehow. Moreover, I also have to mention about polyline in the readme file.

Errors non-stop

How does it feel when you try to implement some changes in the code and you end up getting lots and lots of error? And that’s where the problem solving session starts. You solve one error, 3 new error arises. You solve the 2 errors successfully but when you solve that last one, a hell lot of another errors take birth. This is how my whole day spent.

I was trying to add polyline function to the code but it required a lot of changes to the original code. So, I changed the data structure from 2d lists to 3d lists with inner most one to be a tuple and changed all the entities according to it. Furthermore, I also changed the regex to get right details from wrong format. But, all of these changes gave birth to lot of errors and I spent more than two hours in this problem solving until it was time to leave TCC hall. I will complete my code tomorrow.

Splitting Strings

Today, I woke up at 4:00 AM and completed most of my algorithm subject’s topics. I also did some of my preparations at TCC up to 11 AM as I was very much involved in Knapsack topic and wanted to complete it today.

Then, I started working on my project and the first problem that I faced was splitting a string like “(1,2,3,4,5), (4,2,6,2,5), (5,2,5,62,3)” into a list of tuples containing integers like [(1,2,3,4,5), (4,2,6,2,5), (5,2,5,62,3)]. So, I started looking for split function, but it didn’t help as it could only split with one delimiter. Then, I found “re” library which could split with a regex defined as a delimiter. So, I made the regex that served my purpose. Here is it: \((.*?)\). It split the line into a list of strings which were points.

So, the next thing was to convert each string into a tuple and each number into an integer type. So, I searched a lot over the internet, used my mind and after a lot of trials, I got this answer:

line = "(1,2,4,6),(2,5,2,5),(6,3,6,2)"

#extract each point
point_in_string = re.findall("\((.*?)\)", line)

result = []
#makes every point a tuple in a list and convert string into int
for x in point_in_string:
temp = tuple(int(y) for y in x.split(","),)

But, I have got a lot of other problems too. For including this type of line, I have to change the logic of the code and I will do it tomorrow.

Polyline all day

Today, first of all I tried to answer all the mails that were in my starred folder. I helped Ranvir in solving his vnc related problem where he mistakenly wrote an incorrect command in his blog. I also learned about Xen project to answer Mr. HS Rai‘s problem.

Then I started working on my task to implement polyline in my code. I learned about polyline and what parameters it needs for its working. ezdxf library has the polyline function but they recommend using LWpolyline (light weight polyline) for 2D work. LWpolyline takes less ram and time for its execution than old polyline. I decided to use LWpolyline as my code doesn’t provide 3D drawings.

The format that I am going to use is described below:

P, description, show_code, layer_name
(x1,y1,start_width1,end_width1,bulge1), (x2,y2,start_width2,end_width2,bulge2),..