Friday, 31 May 2013

Exams are finished

Yesterday was a momentous occasion. Completing my last exam, I have now finally completed the four years of my degree studying Mechanical Engineering. I guess that's party time for me!

With the unpredictable and quite volatile nature of British weather, there are bound to be a few days that will be pouring with rain, hence an opportunity for further work on getting this drawing module completed.

Over the past week, I have been making a few small refinements, consisting of fixes:

* Preventing a segfault when creating a dimension
* Fix for incorrectly placed dimension - was difficult to locate the bug
* Fixed a rounding error which meant decimals were not being displayed

Dimensions Arrows:

I have also added a support class for displaying dimension arrows, although these are just diagonals at the minute.


Having a separate QGraphicsItem class is more useful as it keeps the source code tidy by having the drawing code separate. Also it gives flexibility to manipulate the arrows, such as scaling, flipping etc more universally.

It would also be nice to get the page template working again, but waiting on some work to be ready!

Projected Dimensions:

I spent of time to work on this. Originally I thought this was going to be a difficult task. I thought that to get projected dimensions, I would have to make measurements of projected geometry, which would have been laborious to do. Instead, a quite simple solution is to use the same measurement code for true lengths, but project the measurement vector (direction and length) onto the view plane. Taking our complex case below, there will be a difference between true and projected dimensions.

Taking the top projection of this object and taking dimensions for the corner of each pad the result is below.

The dimension on the far left is the true length, and the right is the projected length. I have attempted to make all dimensions which reference orthographic views to use projected type. 

The next step is to work on getting edge to edge dimensions and angles working. The angles bit is more complicated because the angle value measured is based on the quadrant chosen. 

Wednesday, 22 May 2013

Quick experiment again with Sectional Views & General Updates

I am midway during exam season (two weeks) long and things seems to be going swimmingly which I'm happy to report.

Over the past two weeks I've just spent some time tidying up the code and trying to fix a pretty nasty crash in QGraphicsview, anytime you updated the view. I really hope this has gone, but if during testing you suddenly experience a crash when the view updates, please inform me. It seems to have disappeared but esentially was a problem with incorrect bounding boxes as the usual case is. Additionally I've just tidyied up the code and improved the performance by having QGraphicsView using a backend cache, so it doesn't have to constantly redraw features when it is unecessary.

Today, I decided to have a day off revision, as to be honest I am fed up with the mundane repetitiveness. Apart from what I mentioned earlier I wanted to take a quick diversion from the orthographic project stuff I've recently been looking at which I've also made a few improvements on.

I wanted to take a look back at sectional views which I had to give up on because I couldn't correctly produce faces by processing each edges in the correct order. I mentioned this in a previous blog entry some time ago.

Eventually I managed to find the problem and unexpectedly half of the result was from the drawing code itself, where although the edges were in the correct order there was a chance these could be reversed.  Eventually I got something working on most faces.

I then updated the work on the sectional view and behold...

This was taken from a simple planar cut through straight through the centre:

To be honest it's only a proof of concept that i've created over the past few hours. I have identified that some changes are needed to improve the structure to something less 'hacky'. The other limitation is there won't be use of 'true' dimensions because references are lost when the boolean cut is applied.

----------- UPDATE ---------

We all like updates. Spent this evening on it again, rather naughtily and tidied up the areas that I weren't happy with. The section plane is now it's own object in the drawing view, so I had to build up some infrastructure around there which I am more happy with. Now we can finally get some sectioning goodness!

I need to fix a bug that's causing a segfault, so hopefully soon I can push this for people to try and experiment with probably more complicated shapes. 

Friday, 10 May 2013

First work on Orthographic Projections

Having had a bit of a day off, I spent some time working on Orthographic projections with the Drawing Module. One of the problems with the older implementation was that only a projection direction was provided. This meant that the GUI / SVG had to deal with applying transformations to obtain the correct projection which isn't really ideal. All this took a while to realise, however, both the projection direction and its orientation (X-Axis) can be set during the Open Cascade Projection Algorithm.

The result is above and it later will allow more convenient production of orthographic projections, by setting the view type below.

The next step is to collect these orthographic projections together and allowing having these align to each other.