Tuesday, 19 May 2015

The SolidWorks User Group Korea is born!


Last Saturday, May 16th 2015, the new SolidWorks User Group was born in the world. I have attended the opening meeting of SWUGN KOREA and I want to share my experience with rest of SolidWorks fans.  

Last year was definitely poor year for me on events related to SolidWorks community. Working at Samsung Ukraine R&D Institute with already-manufactured devices, I have no need to touch the CAD stuff. But the old passion keeps holding me, and I was nostalgically viewing the SolidWorks User Group Network official website (www.swugn.org), searching for a miracle... And noticed the announcement of First (Opening) Meeting of SolidWorks User Group Korea in Seoul in the fancy book center Booktique on Nonhyeon-dong.


Luckily I am in Seoul these days. Even more, I stay at the hotel few dongs away from the meeting place! I felt I just can't stop. So I called my good friend  Se-Young (Shawn) Yun from SolidWorks Korea and asked him to pick me on the event. 

We arrived something around 1.30pm and I saw a small yet convenient library-like room with around 50 people inside. Most of them don't speak English very well, but I was introduced very quickly and we got our places to listen to opening speech.
 

Every attendee received a gift of What's New in SolidWorks 2015 book in Korean. I also got mine :)

Waiting for official session to start, I was introduced to Donghyeon (Daniel) Won, the Group leader, Certified SolidWorks Expert from 2012 and the founder of Korea's most active and productive online community - PlaySOLIDWORKS  (http://cafe.naver.com/playsw and https://www.facebook.com/PlaySOLIDWORKS). Daniel told me he founded the community in 2010 in Naver, Korea's largest and most well-known web search and entertainment portal. Now PlaySOLIDWORKS community counts 19.000 active members and is the center of all SolidWorks-related events in Republic of Korea. This year he decided to transform the community into an official User Group.


I have got my SWUGN KOREA membership card, and the session has been started.


After the short story of PlaySOLIDWORKS community and the declaration of goals of a newly-created User Group, the technical sessions started. What's New in SolidWorks 2015, how to use PropertyManager Editor, Productivity in Assemblies - everything was prepared with passion and joy.



Community members traditionally asked questions, and even a lovely child of one of the colleagues present at the meeting looked interested :)


After the meeting in a coffee break I got acquainted with mostly everyone present and felt I am finally back to place and time I love.

SolidWorks User Group Korea has the amazing future. Its potential of a new-born child is in good hands! The next meeting is not scheduled yet, but I am already waiting for the show going on.  And now I am seriously thinking about some sort special event we organize for Korean SolidWorks fans this year.

Last but not least, I would like to say thanks to Se-Young Yun for taking me to the event, escorting and translating key things, Daniel Won for amazing meeting, the group itself and some photos I used for this post and to everyone I met there.

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!

Friday, 12 July 2013

Lazarus FreePascal IDE: How to compile 32-bit and 64-bit applications on one machine

I love Pascal. Pascal is a great programming language, since it has a simplicity of a lang-for-study and flexibility of C when it comes to pointers and memory operations. I beloved Delphi 7 many years but the lack of 64-bit support finally forced me to migrate to Lazarus. Lazarus is an open-source IDE for open-source FreePascal compiler capable of making binaries for Windows, Linux, Mac, Android and WinCE. It is free as a free speech and has a strong community of active developers and bug-hunters. You can find more info about it here.

Today I re-installed the latest build once more and found a problem - I cannot switch processor modes to create several configurations for simulataneous builds on Windows 32 bit and 64 bit. I started googling for a handy howto but got no luck. Finally I managed to get it working and here is how.

Let's assume you have a Windows 7 64-bit host machine.

1. Go to Lazarus downloads and grab a Windows64-bit version. for instance, http://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Lazarus%201.0.10/lazarus-1.0.10-fpc-2.6.2-win64.exe/download. Please note on FreePascal compiler version - it is 2.6.2 in my example. You will need the corresponding Win32 compiler bundle in the next steps so remember this at once.

2. Install Lazarus to the folder of you choice (for example C:\Lazarus)

3. Go to FreePascal SourceForge download page, then select Win32 and the compiler version you just remember (2.6.2). It is crucial to have win32 and win64 compilers of the same version. Download the Win32 installer, like http://sourceforge.net/projects/freepascal/files/Win32/2.6.2/fpc-2.6.2.i386-win32.exe/download.

4. Start installing your new compiler, select Custom install, and point the installation folder to "lazarus-installtion-folder"\fpc\"lazarus-version", like C:\lazarus\fpc\2.6.2.



then answer Yes on a prompt.

5. Select Custom install and select the following checkmarks only:



then press Next button to let FPC install itself.

6. Now you have a working dual-architecture setup and it is time to configure Lazarus. Open Lazarus and go to Tools-Options. Select the path to FPC compiler (fpc.exe) as follows

$(LazarusDir)fpc\$(FPCVer)\bin\$(TargetCPU)-$(TargetOS)\fpc.exe



7. Finally, go to your Project settings, open Code generation tab and select your processor arch (i386 or x86_64) and target version (win32 or win64) then apply changes. You will be able to build Win32 and Win64 binaries at your choice.

You can even adjust the build profiles and activate them when necessary.

Enjoy!

PS: To use architecture-specific code and constants, one can use the following snippet:

{$IFNDEF WIN64} // x32 code {$ELSE} // x64 code {ENDIF}

and declare -dWIN64 in Project options - Miscellaneous - Special switches under appropriate build profile (e.g Win64):

-dWIN64

That will trigger platform-specific defines like in C++.