LibreCAD 3 Development Logs

Development logs of GSoC 2016

No comments

All the features from my project plan are completed. LibreCAD 3 is now usable without writing Lua scripts.
I had time to add features that were not in my project plan, which are:

  • Trimming tool
  • Layer GUI
  • Line pattern GUI
  • Line width selector
  • Color selector
  • Lua plugin system, with two plugins to create gears and fractal trees

My work can still be improved.
The design can be modified, it's currently default Qt style. The toolbar can be improved by making the elements take less place, it currently have a vertical scroll bar which is not good.
The usability can be improved a lot by adding new snaps. It should be easier to make 90/180/270° angles for example.
The performance improvements can be made on mouse move event. I think it uses too much ressources. That can be made by adding a minimum time between two updates.

List of commits by feature
Commit history on GitHub
All the commits for GSoC were made between 16th May and 23rd August. I began one week before as my finals were on the week of the 23rd May.
The conversion of the interface from pure C++ to Lua was made before the coding period as a test.

Selection and drag points:

  • b963920 05-16 - Allow access to current selection and move lines with cursor
  • 73347ed 05-30 - Improve selection of drag points and add points for all entities
  • 7375701 05-31 - Remove entities from selection when reselected
  • 92c1657 05-31 - Unit tests
  • ad4e894 06-10 - Fix drag points not shown on some entities
  • f0d5dc5 07-06 - Fix segfault with selection
  • 3df1e67 06-16 - Improve cursor move performance in large files

GUI elements
Command line:

  • 61be581 06-03 - Command line widget and Qt/Lua connection improvements
  • b10e279 06-07 - Add coordinate and number support in command line, and Lua code reorganisation
  • f596a43 06-08 - Improve Coordinate in Lua
  • aa9fe42 06-08 - Add relative coordinate support
  • b5c1f2e 06-08 - Prevent empty line to go in command line history
  • 3e5f6e0 06-09 - Add command line unit tests

Lua script widget:

  • d92b88b 06-10 - Separation of Lua Script widget


  • 4e5ce51 06-14 - Add toolbar
  • d53e26c 06-15 - Fix toolbar disappearing
  • 43dc089 07-04 - Toolbar unit test + fixes

Layer widget and dialogs:

  • bb8205b 07-15 - Layers GUI
  • bc6369e 07-15 - Make Lua use active layer
  • 14f2d11 07-22 - Layer edition dialog
  • b5c9abb 08-02 - Unit tests for layers and line patterns
  • 6b2f39e 08-11 - Layer edition improvements
  • cc68991 08-12 - New layer dialog unit test

DxfLinePattern selector and dialogs:

  • 3fce229 07-20 - DxfLinePattern ui support
  • 01a6d96 07-25 - Allow creation of new line patterns
  • 0964d93 07-27 - Line pattern manager
  • bf99b25 07-28 - Add line pattern select in toolbar
  • b5c9abb 08-02 - Unit tests for layers and line patterns
  • 8e5edd8 08-03 - LinePatternSelect unit test and missing files from other unit tests
  • 1412e53 08-05 - Toolbar line pattern select fix
  • f60aea1 08-09 - Add manage button in line pattern selector
  • 1c15b2d 08-11 - ByLayer preview

Line width selector:

  • 943242e 08-08 - Line width selection
  • 1c15b2d 08-11 - ByLayer preview
  • d98d9aa 08-12 - Line width select unit tests

Color selector:

Lua operations

  • d37ef6d 06-16 - Preview of line creation
  • b2dc671 06-16 - Create fixed size lines
  • d4340c9 06-16 - Add circle creation
  • 527e009 06-16 - Add arc creation
  • c2fb484 06-17 - Add ellipse and arc ellipse
  • 7396482 06-17 - Add arc ellipse command
  • a63cbc6 06-17 - Add DimAligned creation
  • 13aba67 06-20 - Add text in DimAligned creation
  • 3849bf0 06-20 - DimAngular creation
  • 72ed3de 06-20 - Add DimDiametric creation
  • 6f8ae9c 06-21 - DimAngular fix
  • deaa43e 06-21 - DimLinear creation
  • 4ca23e6 06-21 - Fix DimAligned direction
  • dd459d6 06-21 - Add DimRadial
  • 3028a5c 06-21 - Remove entity if creation is not done
  • 91d7255 06-22 - Spline creation
  • 0e047ba 06-24 - Polyline creation
  • a0b0e74 06-24 - Polyline creation
  • 01d7996 07-06 - Lua UI + creation unit tests
  • 86d58af 07-20 - Allow spline degree change during creation
  • 8d90ff1 07-28 - Lua unit tests fix

Entity modifications


  • 6f77291 07-13 - Lua plugins
  • f4295e2 07-21 - Gear plugin parameters
  • 5393cb7 07-21 - Fractal tree plugin parameters

Cleanup and documentation

  • 36ddfc9 08-04 - Unit tests reorganisation
  • 55fbf24 08-15 - Doxygen generation fix
  • 35a265d 08-17 - Doxygen documentation
  • cf51b29 08-17 - Fix compilation
  • c190aa3 08-17 - Remove external libs from Doxygen
  • 48cdaa2 08-18 - UI code cleanup

Bug fixes and improvements of already existing code

  • b4be384 06-10 - Fix crash when quitting if a sub window was closed
  • 97b2c31 06-16 - Fix crash when opening file
  • ecf6698 06-29 - Fix QuadTree copy
  • dd1d684 07-01 - Builder selectByLayer and unit tests
  • d824af7 07-21 - Use DxfLinePattern of layer
  • 6c86b39 07-22 - DxfLinePattern line width support
  • 6ee1666 07-22 - Note about DxfLinePattern cache
  • f1da956 08-09 - Add GUI file saving

No comments

Today I began to remove the unused code from LibreCAD.

lcUI/operations folder:

  • All files were removed


  • Remove test functions (random lines, circles, arcs, ellipses). These functions are not used and should be written in Lua now.
  • Remove old commented tests
  • Remove the creation of the "0" layer in new document function. This is now managed by the layer list widget.
  • Merge new document and import functions. Import needs to be used after calling new document function, this will remove some duplicated code in Lua side
  • Remove duplicate funcitons view and viewer


  • Merge duplicate functions addButton and addWidget

See commit on GitHub

No comments

Today I finished and sent the documentation to the repo.
I also modified the Doxygen script to exclude the external libs (lua-intf and nano-signal-slot). That makes the documentation cleaner.

I'll now do some code cleanup. When copying the documentation I already saw what needs to be done:

  • C++ operations are still present in the code, they were replaced with Lua operations
  • Toolbar tab has two functions, one to add a widget and one other to add a button, the function to add a widget can be used for buttons too

No comments

Today I continued writing the documentation of my work for Doxygen.
I only have the lcviewernoqt part to document, and I'll push it to the repo tomorrow.

No comments

Today begins the last week of GSoC 2016. Students should now focus on documentation, tests and tidy code.
I finished writing the unit tests last week, all test cases are running file, so today I'm working on documentation.

The first time I tried, I couldn't generate documentation with Doxygen because of errors. I kept notes of my work on paper, and planned to make Doxygen work this week.

The problem was in file, it seems to be old and require removed or moved folders and files. I fixed this file and added all the folders in repository root.
Doxygen doesn't support Lua so those files will not be documented (files have to be open to see the comments).

No comments

Today I improved the line pattern, line width, and color selectors, I added a preview for ByLayer values and for Custom values only in color selector.
The three widgets are connected with the layer widget, and they receive an event each time another layer is selected. The preview are updated. So there is currently no preview until a layer is manually selected.

The function to set the selected item was added to the line width and color selectors. Line pattern selector can use the setCurrentText method.

Tomorrow I'll work on the unit tests for the line width and color selectors.

No comments

Today I added support for custom colors in selector, I also added this selector in the layer creation dialog to replace the R/G/B/A inputs.

The next steps are:

  • Add functions to set the selected color and line width (when editing)
  • Make connection with layers widget and every selector, to show a preview for ByLayer values.
  • Add unit tests for color and line width selectors and update for layer creation dialog (edit will be probably broken)

No comments

I changed the line pattern select to add a new item which show the manager, instead of having an external button.

I also added a color selector in the toolbar for individual entities. For the moment line width and colors are fixed, it needs to have support of custom values like line patterns. I need to check if DXF have support for this

No comments

Today I worked on the selector of line widths. I replaced the QDoubleSpinBox by this selector for layer creation and added it in the toolbar for individual entity selection.
This time I didn't have problems with MetaInfo and using the add function worked.

No comments

I fixed the problem with line pattern selector in toolbar by making the cast to EntityMetaInfo in C++ instead of Lua.

I began the creation of a selector for line width. All the events are added to the document.

The managers will be accessible from the selects, instead of having multiple selects in the toolbar + one button for each manager.