25 September, 2013

Tutorial 1: How to View Step-files in BRL-CAD

If you have BRL-CAD installed on your system, there will be a 'step-g' command, which will allow you to convert STEPfiles i.e. those in .step and .stp file-formats to .g i.e. database of BRL-CAD.

Usage: step-g -o outfile.g infile.stp 

In this tutorial, we will visualize a sample .stp file.

Consider this .stp file. You can copy the data from this file to your working directory and name it bull.stp. We have the output how it should look as below.

After you have bull.stp and BRL-CAD, just type the following command on terminal.
" step-g -o bull.g bull.stp " 

If it was successful, a file named bull.g will be created and you can view it in mged/archer.

" archer bull.g "
" mged bull.g "

For archer, just right click on 'None'0.r under Tree on left pane and select Wireframe.

For mged, type the command mged> " draw 'None'0.r "  on the command window of mged.

You will see the outline for model bull.g created which would look as follows :-

And to see the model, just raytrace it.

For mged, go to File -> Raytrace. This will open a dialog box named Raytrace Control Panel . Click on 'Raytrace' button.

For archer, in the top pane after menu bar, there will be a camera looking button which will read 'Raytrace the current view'. Click on that.

To remove the wireframe, in mged in the Raytrace Control Panel, there is menu called Framebuffer,  select overlay from it.

In archer, in the same pane as Raytrace current view, there will a option called, 'Change Framebuffer Mode' just besides raytrace. Click on that.

Final View is -

which is similar to that we saw before-

I hope you enjoyed this. If you get any error and/or queries and/or suggestions and/or feedback, comment below. :)

22 September, 2013

Short Summary of GSoC project

This is the first year in which I was eligible for GSoC program and was selected by the highly esteemed open source community BRL-CAD. Before joining the project, I had just the glimpse of how large code bases are maintained, but had never got hands on experience with them. I used git version control, but that just limited to handling my college project.

I would like to rewind and fast-forward the 4 beautiful months of my life, the best in terms of experience and knowledge gaining and learning summer quickly below-

Initially, before the project submission deadline, I submitted few small and pretty code refactoring patches to BRL-CAD to get myself famaliar with svn version control system and other basics for working with gsoc project.

Upto the student selection date, I worked on an issue of github to get famaliar with github version control system, on which STEPcode is managed. In this period, I got to know abt diff tools, working with git version control in a better way, gdb debugger, doxygen and how to write comments and observed some good tactics related to coding followed in industry, like taking minute care from declaring variable names to introducing magic numbers and to see that in future there will be no false positives and bugs introduced that would create problem in long run.

In between the selection period and the actual program period, it was the community bonding period as well as time for release process of BRL-CAD 7.24.0. I helped in formatting the release notes for this major release and got some experience with release procedure.

After the actual beginning of the program I worked with open issues of github and got it merged on the mainstream. One was removing all cppcheck warnings from stepcode. There were mainly 6 types of warnings reported in STEPcode by cppcheck which included unused variables, preference for preincrement/decrement, sscanf() to prevent overflow, strncpy not '\0' terminated, C style pointer casting and reducing the scope. After clearing those,  I ran cppcheck on brlcad trunk and uploaded the output to refactoring page of brlcad. Also, I made a patch for preference for preincrement/decrement from that output and cleared those warnings from cppcheck on BRL-CAD sources.

The next issue I worked on was installing the headers from the central files used in the minimal example. This included installing headers from 10 directories of stepcode. Now, anyone can just do sudo make install and start using the API's like any other library.

After that, I worked on checking the step-g importer on brlcad and wrote regression tests checking the step-g importer with 3 small and simple step models. I also read and knew about how to use anything from net with a copyright and use the license. I had never dealt with those kind of scenes before.This test will confirm the working of step-g importer and check for the geometry by checking volume > 0. I also looked upon the todo task on brlcad wiki and deleted those which were already done and added a prototype and Todo comments in the trunk to make it easily visible and more organized. These patches are still awaiting review by mentors. 

I forgot to mention about my experience with STEPbot, my experiment with a bot for channel #stepcode on IRC. And one fine evening, when I logged on to IRC, I was surprised to see an infobot similar to that on #brlcad already implemented  and hence the logs of that channel could be archived very easily.

A huge thanks to Mark, my mentor who has been the best mentor I could ever have. He had been by my side at every 'step' of my project guiding me and providing quick response and feedback of my work and effective guidelines throughout the project. Thank you Sean. You are the best project manager I ever saw. Along-with the help in technical aspects, I loved how you used to motivate and inspire me. Also, I liked your way of getting answers from me instead of giving solution directly,no matter if it took an hour for a simple thing. :) Thanks Cliff, Erik and all other GSoC students, my friends and family who had been as a support anytime in the last 4 months. I could not imagine my project being complete without you guys. Awesome, cool community, i must say. :) Thanks all once again.

Future plans - In past a week or so, I observed that a lot of people were posting queries related to STEPcode. They were asking for good tutorials or easy-to-understand links. So, I think, I would first make tutorial for beginners on STEPcode. And next, after that I am willing to get my hands on step exporter. My plans till next summer is to work and get familiar with the step-exporter and dedicate my next summer to it.   

You just walked with me on my journey of past 4 months. I know, this has been too long and thanks for your precious time reading this. Hope you enjoyed the walk. These are my daily logs and reports
Any comments and suggestions are welcomed. :)

Three Cheers for this awesome summer !