Monday 17 February 2014

The Ideal CAD Viewer for Android: A Diary of eDrawings Modder Part One

It has been a while since eDrawings for Android has been released, and it is quite interesting to look at the Google Play stats on it. Keeping in mind the enormously warm meet of an iOS version of SolidWorks' most-beloved CAD viewer and strong expectations for its Android port, in a half-year after initial release I can state that these expectations are slowly turned into reality. I would say, even, very slowly.

The average rating of eDrawings at Google Play now is about 3.7 - that means that the product - in its basic view - offers expectable functionality for its price, but in-app purchases are somewhat unexpected by Android CAD users. Stating this I will end discussing the price policy of Dassault Systemes SolidWorks and continue my own story about this interesting application.

I purchased a copy of eDrawings for Android next day it became availiable on Google Play. As a native-speaking Ukrainian customer born in ex-USSR, I expected the application to offer at least Russian UI, but.... it was sooo English! That looked strange because desktop eDrawings suite offers the same language set as a 'big' SolidWorks does. Dramatically, SolidWorks was one of the first CAD packages to offer localized UI, help and support, so I expected the eDrawings team to follow the rules, but in a release rush everything went flappy.

There were some minor UI bugs in the aforementioned first release that I reported to Support Intern Brittany Chin of eDrawings team and then to Support Engineer Tim Riley of the same. By that time only three bugs were critical for me as a customer:

1. The inability to display drawings and assembly notes in language other than English - that was really inacceptable, having notes displayed as rows of squares instead of what they intend to be.


2. The bug with file type associations - everyone faced it at least once in a lifetime, when one started downloading a video in web browser and eDrawings took the cover back downloading this and that into /sdcard/eDrawings/ folder on an external card.

3. The lack of folder support in My Files - I have to admit it is really inconvinient to have tons of assemblies consuming time for preview generation every time you load an application.

So I contacted Tim Riley and reported several SPRs to him. Since the most annoying bug for me was the file type associations, I tried to fix it myself and succeeded! After several releases this bug was finally partly-fixed officially, (I hope) following my guides left for eDrawings programmers two months before. So I decided to step ahead and make an ideal viewer to show how good the open-source Android platform can be for a CAD guy.


Step Zero: The File Associations Go Right

The file association bug was the first attempt of mine to overcome the slow-fix policy of SolidWorks Corporation. By that time I had some success in CyanogenMod compiling and porting so I decided to decompile an APK and find out what was wrong.  After some digging and Android log tracing, I found out a stupid bug in the Android manifest file (a file describing permissions ans contents of an Android application package) that I easily fixed with a newly-breeded application package file. I called Tim and sent a detailed instruction on how to fix the bug exacty, but the next three releases up to a mid-December were buggy. That was my first win!

Step One: The i18n Quest

Despite my English is fluent, I also took care about the internationalization of the viewer, because my friends in Ukraine and Russia have also purchased the app and were dissatisfied with its only-English interface. So I decompiled the newcomer package and added a Russian translation in an easy manner. The whole XML file containing string resources fits into several kilobytes of Unicode text and I spent less than an hour or two to make the things fancy. Based on that I dont understand why such a powerful corporation pays no attention to such a simple but such a vital question for non-English customers.

This time I posted the screenshots in LinkedIn but it did not cause an appropriate reaction. Despite of the active SPR about languages, the version 2.0.1 from February the 6th 2014 is still monolingual.

Here how it looks like for version 1.0:


and for version 2.0:


Despite all my friends wanted to test the translated app live, I did not share a translation for legal reasons.

Mission accomplished!

Step Two: In Soviet Russia, drawings watch YOU!

One can imagine my mood when I made a translation and was ready to fight the drawings bug. So I waited for a nearest Sunday, took a bath and a cup of coffee and started my investigation. That took me a while - a whole weekend and a Monday evening and night, but I managed to get the beast running like



instead of poor-looking stock experience:


First of all, I fired up the Android debugger and checked the possibility of incorrect Unicode transform of a model text. Since eDrawings viewer is based on freeware HOOPS Viewer from TechSoft3D, that was easy... and false! Everything was Unicode! So I decided to trace the font load on a desktop eDrawings and a mobile one. I used a font monitor and a GNU debugger for Android to see which fonts are loaded and when. I was naturally shocked when I revealed that someone at eDrawings team has simply turned off FreeType fonting! I re-enabled it in debugger, hit Continue et....voila! A couple of simple tricks can make it running again. In the following example only one font (Arial Narrow Unicode) is loaded, but the root cause is clear. I hope in a next release this branch of code will be optimized and turned back on.

Step Three: Drawers and Folders

The last bug I really want to get rid of for now is the lack of folder support. Since eDrawings already has the hidden directory view functionality, I doubt it is so hard to implement. Just a couple of lines in smali files... but I have not completed it yet so screenshots will be made availiable in a next part of the story. Stay tuned!

Final Thoughts and Disclaimer

The purpose of this post is to show how --should-- a program from a respected company look like. I am not an owner of the code, resources or any part of the program, but in terms of ethical hacking I am ready to collaborate with eDrawings team and share the tricks and instructions freely - if they want me to.

The key difference between desktop and Android is not only the processing power limit for 3D applications - but also the variety of Google-backed community apps, free and paid, with practically similar functionality. For example HOOPS viewer or 3D CAD viewer capable of rendering HSF / IGES / STEP / PARASOLID are free, though they cannot parse eDrawings files yet. Of course, SolidWorks is a brand, and the brand means the support, but the slow-fix policy of SolidWorks Corporation sometimes ruins the adorement - even if support engineers do their best to collect issues.

There are still many possible perfections in the workflow of the app. For example:
  • How about getting rid of the version 1.0's face selection menu aka 'Show / Transparent / Isolate / Show All' and use one drawer for all activities, such as measurement, view manipulation, animation control etc? 
  • How about the augmented reality present in iOS and KitKat's printing API support? 
  • How about part  name scrolling in a drawer so long part names are highlighted Android-style?
Together we could make a record-breaking CAD viewer for mobile devices, and I am proud to start this initiative.

The last question I guess my readers have is - why. Why? Because we can! And we love what we do!

Happy eDrawing!

I want to thank Tim  Riley and Brittany Chin for their brilliant support. Good engineers - good wills!