Saturday, July 31, 2010

WPF Controls and Solver Caching

The WPF code porting had some good achievements like an unified theme but also some small problems. One of the biggest is that the code was not optimized in many ways. There was a lot of back work to update the WPF controls and that is expensive in CPU times.
This nightly build will use *EXPERIMENTAL* caching scheme for TreeView and sections on property grid. This should improve greatly cases with multiple created shapes and you edit/add one shape. In older builds you may encounter UI freezing. The freezes may be still there, but they will be felt at much larger shape count.
The WPF Color picker was changed in Property grid to be one more complete. This will also improve the display speed of the property grid, as is separated from the property grid itself.
This caching scheme can be reset (at the code level) and sometimes it does need so, but it need extra testing to detect those cases when cache gets out of sync.
The Property grid also cache the Transformations and Shape controls (color, name and transparency) which also get some speedup.
The solver component will be able to cache geometry. This code is done in the idea that every time a shape is not changed, the solver information is not computed. Also caching will work for now just for extrude, because we don't want if the caching code is broken to make all NaroCAD to be broken. This will have some overhead (much smaller anyway) at propagation step, when caching will happen in cascade.
Based on profiling sessions, with those changes you may expect a realistic 2x speedup in those cases that you had a bigger scene and you edit or add just one shape.

Tuesday, July 27, 2010

NaroCAD 1.5.0 Released

Today made the 1.5.0 release version.

The target of this release version was to enhance NaroCAD's usability.

The main feature added in 1.5.0 is the floating toolbar that allows users to easily access most important tools that can be applied to current selected shape without making long mouse moves. Another improvement is that we started adding mouse cursors for tools to make the user know the active tool at any moment.
Modified and rebuilt the OpenCascade wrappers that NaroCAD uses. Used this opportunity to add finalizer code at around 20 wrapper packages, with this enhancement reduced memory leaking made by wrappers.
The Options dialog is reorganized and has a better look. Improved the GUI and added in Options the possibility to change default background and object drawing colors. Also antialiasing can be turned on or off.
Made property grid fixes and enhancements.

The 1.5.0 NaroCAD version can be downloaded from here.
Next iterations we'll stabilize the 1.5.0 version and further improve usability by adding shape handling gizmos.

Lua generated shape on which applied cuts and extrudes:

Floating toolbar and Option dialog screenshots:

Sunday, July 25, 2010

Graphics Improvement

If you got bored with the old splash, today you have a new and better one. Also some small touches were put in Options dialog again, the floating toolbar is in it's final state (like the old Copy/Paste bug that makes that the Paste area to remain standing, just the button to disappear, was also fixed). If you have a very critic eye, you will remark that by default you will have antialiasing enabled in OpenCASCADE view.
So hopefully you will enjoy those new changes and you can use them right away from the nightly build.

Saturday, July 24, 2010

Improved Options Dialog

Options dialog was compacted (so you will not have too many pages with just one check box to enable for example Tips Window), and the options that were unlikely to be used were removed (picking the X and Y delta for floating toolbar). There is added the capability to change the background of the OpenCascade view and the default color that the (future) shapes will be drawn. This anyway will not override the existing shapes color, which can be changed by using property grid. In this way you will likely have a better color theme to use with your drawing.

Friday, July 23, 2010

Getting Toolbar Close to Finish

The floating toolbar is getting better and to an end. There are really some small issues remaining, but they will be addressed. One of them is that Paste button, when is not available will let a blank area around it.
Right now the toolbar will extrude the face your clicked on (or you can cut it).
Also a small improvement is that the Options dialog looks refreshed, this is done via a better graphics and better usability: instead adding an Undo/Redo button pair, there is a Defaults button, which for a specific page will setup the NaroCAD's defaults. This will make NaroCAD to have a stable profile in case that you feel that your setup is broken, is a good way to fix it.
The front icons were almost finished too, so you may enjoy a better out of the box look (at least for the default modeling tab).

Thursday, July 22, 2010

Improvements In Infrastructure and Code Quality

As wrappers did got just better, the code quality was also improved. Also we go to trigger down bug by bug in the floating toolbar code. Today the fixes appear if you draw your custom sketch shape and you just don't click on a face. This code makes Naro to crash but is fixed now.

If you know what Resharper is, we constantly use it to improve code quality and this mostly mean that you will get at least better formated code and that it is consistent over all codebase. In fact we got to under 1/6th issues from the original code, that was around 3 months ago. So if you will want a good to start codebase, you may give to NaroCAD a try, may worth it.

I will try to finish to add dimension tool to supported shapes and to improve the editing tools infrastructure to make easier to be added extra tools to model your shape from mouse.

Improved wrappers

Rebuilt wrappers used by Naro to add new functionality as shape bounding box, shape property modules.
Used this opportunity to add finalizers at around 20 packages most used in Naro. Now the memory leaks are greatly reduced.

Developers that are using the new wrappers to avoid crashes must configure their OCC to protect against multithreading memory alloc/dealloc crashes (MMGT_OPT=1, MMGT_REENTRANT=1). The problem we encountered was that the .Net GC kicks in as another thread so Naro and GC threads are using the same OCC memory management mechanism. This issue was solved by making MMGT_REENTRANT=1.
Improved also the wrappers generation template to include finalizers.

Wednesday, July 21, 2010

Sketch Skeleton Code Done

NaroCAD is compartmentalized in more parts to make things replaceable and extensible. One of the components that you use for drawing custom shapes is named FacePicker, that will detect the plane you are on. So if you draw your circle, it is always drawn on the last plane you're mouse was on.
So if you will click on a shape that is one face (like rectangle, circle, ellipse, or a generated face), the floating toolbar will show sketch shapes, and those shapes will be locked to the plane your face is pointing. This need more changes, and I've tried to make them to not be invasive. The single change that is needed in a meta-action to be "plane-locked" is to write Dependency.LockPlaneIfRequested = true; and to be added in the sketch tools.
For locking a plane, you have to write something like Inputs[InputNames.RestrictedPlane].Notify(NotificationNames.SetPlane,
Those changes are visible in the nightly build.

Tuesday, July 20, 2010

Floating Toolbar

I've worked on changing the floating window implementation and changed the existing styles for this floating window. There where made also some fixes.

Monday, July 19, 2010

Short video about how to run lua scripts

This video shows you how to execute lua scripts. To save some time, I've opened some already created file and executed the script. You can find some sample scripts if you install one of our releases.(they can be found under the "Samples" folder)

How to create a simple shape with NaroCAD

This is a tutorial which teach you how to draw a simple shape in NaroCAD using both tool bar tools and command line.

Saturday, July 17, 2010

Floating Toolbar Preview

I've made a movie about how will look&feel the live toolbar. You may test it using the nightly builds for now or waiting for the next stable release.

Thursday, July 15, 2010

Refactorings and Code Separation

Big software can develop features in two ways: vertically and horizontally. The vertical way means that it improve it's feature base to cover more fields (or usages), when horizontal way means that the existing features are improved in usage, usability, sub-options, etc.
You may find another way to show the growing of a product, the organic way. This organic way of developing a software is to grow horizontally, then vertically, then horizontally, and so on, to be balanced way. As the releases of 1.4.x was mostly an horizontal development (it mostly improve the look&feel and fixes more conceptual design flaws as transformations), this release will try to be more "advanced" in the way user will interact with shapes.
Today I've moved projects of NaroCAD around, to make them more logical and to make separation better. The reason is that the feature I try to work on, a floating contextual logical toolbar, I want to add (almost) everything in it. It may be just simple as copy/paste, but as complex as to put property grid in it. But the property grid code was self-contained, so I've did not have access to the PG's code. Also PG have some features that have no sense in the floating toolbar context (like filtering fields you want to skip from visualization) or to add more information that may not be necessary: mainly the color or transformation code that will make the control too busy.
Probably if in future iteration the layer support will be added, I want to make sure that the control will be capable to embed it. So I've made this toolbar to be WPF-based and I've added support to add for now Ribbon group buttons, but not only.
So wait very soon to get a fairly powerful and most important, an useful live toolbar that will enable when you click click on a shape or anything on a scene. This nightly it does position only an empty ribbon button group, but very soon you will see more and more complete.

Wednesday, July 14, 2010

Changing Mouse Cursors and a Sneak Peak

Mouse cursor code was a bit cleaned up and with future work of Cristian, you may likely see some really nice touches on the mouse feeling.
Another nice contribution is the icons part. They make more sense (for now they are defined only on the sketch point of view) and are more distinctive. So thanks again for the contributor of them. Those two photos compare the sketching icons side by side.
On my side I start studying ways to make a floating toolbar that makes sense. This will work somehow like the "Contextual" tab, but will be live and much smarter. Based on the shape you clicked on, you can do selection, you will be able to change some properties on the fly, and so on. Also I try to make it not only useful, but to be usable, trying to be always close to the last mouse click. As for code I am in between two solutions, I'm very tempted to use a Windows.Forms solution, but this is nice on short term, but it will be really tricky on a long term, as there will be a lot of code duplication. A WPF solution may be probably too complex for just a floating toolbar, but will make easier to add many things to that toolbar. Also the automatic layout of WPF is a nice choice, so may be a good choice at the end.

Monday, July 12, 2010

Added Possibility to Change Mouse Cursor

The unit tests were having problems using default dummy constructor and they were fixed at least to not throw some exceptions that make the build system (mostly in nightly build) to advance without user intervention. The single part that is not working now (because of big 1.4 changes in the transformation code) are that the unit tests are not updated to the new code but this will likely fixed.
Also today I've review the editing code in the idea that it will be soon extended (to target the 1.5 release) but I've did not start as coding because there are more design issues to be taken.
In the mean time I've added an input to change the mouse cursor (for some actions). For now works from external files and is enabled just for circle in the nightly build. More tools will be updated in the next days.

NaroCAD 1.4.7 Released

The 1.4.7 release precedes the 1.5.x line of releases that will improve how visualizing/editing will behave (and not only). This release is a mostly a polishing WPF and fixing (older) issues release.

As a short list of what was added in this release are:
  • Improved command line auto complete, fixed command line bugs, to make to type less keys to write long commands
  • Added tips window to show to you some things things that you may not know from NaroCAD
  • Ported Options dialog to WPF and fixed bugs related to it, meaning a consistent theme and look and feel to NaroCAD whole application
  • Improved solver on helper lines, so they are not selectable but they still work as guidelines
  • Added plugin support, to extend your command line, lua commands or new user interface, options or new tools from external assembly
  • Improve WPF property grid internals to show which fields are constrained, but can be used to
  • Fixed mirror and pattern tools as they were affected by the new transformation code (that is more powerful but behaves differently)
  • Fixed selection from tree
  • Other fixes (like importing from Step and Brep files works again)
  • If you set NaroCAD (NaroStarter.exe) to open naroxml files it will likely work (there may be some environment options that may make it fail to your machine, but if likely you open a file from NaroCAD folder, it should work).
You can download it from SourceForge page. The team hopes that you will enjoy it.

Sunday, July 11, 2010

Some Extra Touches (Part II)

As very soon a new release will be done, some code is just cleaned up and some unused code is removed. Also some small touches were finished.
Bogdan Mustiata contributed some icons to NaroCAD. Also you may setup as NaroStarter to open your naroxml files. All tools so far that can be constrained, they will show to you the "lock" that will make it things better to identify "why" the value cannot be changed.
Import/Export to step are working again. They were not working for some time but they seem to right now as the extension of the files were not setup in the right way.
Also the quick start dialog is removed.

Friday, July 9, 2010

Some Extra Touches

NaroCAD is developed in a fast iterative model (3 weeks iteration) including likely two weeks of developing and the third of testing. This makes many things to get better without breaking all things. This iteration seem to be faster than others and it brings many things to the table. As much as the most estimated work that will be done in this time was completed out of schedule.
WPF Options was ported to the smallest details like adding Undo/Redo buttons.
So in this remaining days (will be two days) some small touches may be achieved inside NaroCAD.
One of them is the following: The constrained values in Property Grid will appear with a lock. The nightly build have only line's length checked. But all others will be ported. This change was fairly big in internals as the shape order exposure was not thought in this way. Also, this small redesign permits that one specific shape to have custom property grid items. Supposedly it can be considered that a line will have some extra arguments, that are created with a different property grid items than the default one.
What will mean to you? That it will likely be the most user-friendly release so far. But for now just stay still and try to constraint more shapes in the following release and try to see if you get the lock on the corresponding fields.

Usability improvements

In the last days insisted on fixing and improving the usability of Naro.
Among the fixes that the team made there are:
- relative coordinates form command line are useful at drawing. Fixed the negative coordinates problems,
- fixed selection of shapes from tree,
- fixed options dialog and ported to WPF,
- fixed mirror and pattern tools transformation bugs.

Planning to add helper line into the solver so that helper lines can be used as drawing guides, enable solver to generate parallel with axis magic points, fix spline, distance to edge constraint tool.

Thursday, July 8, 2010

Tips Window

Naro has now a new Tips window which probably will be available for you on the next release. For now it has only a few tips, but we hope to add more tips in the future. It can be shown or not at startup from Options dialog.

We consider it will be useful to you. I hope you consider it useful too.

Wednesday, July 7, 2010

Making Smart Completion Smarter...

When the Command Line completion was done, I finally was really happy that things were better. But sadly some internals were not right. Just trying to create a point, and writing just after the coordinate, will make that the point to be created that many times. In fact the coordinate of the point was sent as many times as character were written previously. The yesterday (quick and dirty) solution was to make sure that any time a character is written, some message passing (named events and delegates in .NET world) were cleaned up. Today, also being "motivated" that writing a negative coordinate can make NaroCAD to crash, I've review the code and I done the fix in both ways, in the idea that the command line will try to not make "completion" when a '-' (minus) is written, but also I've made sure that no extra logic is executed anyway. So in this way, even I will remove the extra checks that were done in the last two days (which are good anyway, just as they validate the input), no extra message passing is happening.
Also the Options dialogs were ported to WPF and they likely seem to work. This will reduce the Windows Forms code in NaroCAD to just custom dialogs that are still present in some tools (some that are really hard to port, like rendering's preview one) and will likely make the experience more consistent. Also the code is defined in MVC paradigm, so you may be able to change at least in some instances the interface without changing a line of code from the options code.

Monday, July 5, 2010

Updater Threading Issues and Smart Command Line Completion

The updater code worked fairly right but had some threading issues (the issue is that the download was done in background, so you will not be interrupted as long as you work, but at the final step there is needed to execute the interface in the main thread as .NET/Windows applications cannot have at least in standard Windows Forms applications updates from other threads than the main thread. Theoretically the solution is to call it via Control.Invoke method that will use locking code and will block anything to the main thread.
So as I've did not found a proper solution as the component framework (SCSF) does not provide an easy access to the main loop, to make a Producer/Consumer pattern, I found a simpler solution: I simply do not access the UI and launch the installer directly. May not be that elegant, but seems a proper solution. So if you picked to activate your updates (please take the nightly build as this is the first version that has a fix for this issue), you must close NaroCAD manually after the installer was started. If you have better knowledge or at least a way to avoid threading exceptions, please point it out, I'm eager to find a way to.
Another part is that as a milestone WPF Options do not crash as dialog, also I've fixed most issues from solver part, and when you switch the views. In this way you can work with the new options dialogs. Some features are not yet ported, mostly to apply Undo/Redo on options (it works great if you make try and error values) but I hope that very soon will be fixed.
Eventually, and the most interesting update is the Command Line updated way to work.
Previously you did not know which are the commands and even you were able to guess them, sometimes you may fail to write a letter. Let's imagine that you wanted to write: rectangle to start the rectangle command. If you're not a fast typewriter, you will most likely want to setup shortcuts. Let's imagine that you want write: rectangle. When you write: R, four options will be shown to you: r[e]ctangle, r[e]ctangle_height_constraint, r[e]ctangle_width_constraint, r[i]ght. If you will press I, the "right" word will be shown. If you press "e", all words with rectangle will be shown, and already "rectangle" world will be filled in. So if you will want to write: rectangle_width_constraint, you will have to type 4 letters: re_w and the words will fill automatically. At the end, if you have more words, if you will press enter, the first one from the list will be chosen. So if you will want to draw a rectangle, just press r and enter. Because after you press r, the "rectangle" is the first word from the list.
Another good thing is that the pre-calculation is independent of the commands, so may work with as many and as long commands are available, the way it works is made just to reduce the keystrokes you have to press. If you remember the plugin code capabilities to NaroCAD, if you will register your meta-actions, they will automatically auto-complete. If your company will start with words like: xtension_and_a_long name1, xtension_and_a_long name2, etc., typing just x, will expand to xtension_and_a_long name, and all you have to write is 1, 2, and so on.

Friday, July 2, 2010

Relative coordinate values bugs

Command line had the capability to make relative coordinates to work combined. Anyway, this could work badly on some cases. The cause is that not all components notify the command line parser to update the coordinate is relative to.

I work on WPF Options to continue porting them from Windows Forms dialog.