Monday, February 28, 2011
Combine Spline Tool. Angle Between Lines Tool
A tool to chose the angle between lines (this tool is a bit unpolished, so may change a little in future).
A preview is shown below:
Updater - Part IV
The updater now does a file compression. This means that NaroCAD downloads the compressed files, makes an uncompressing and continues with its job. By downloading compressed files, the download is 3-4 times smaller. One other advantage is that NaroCAD can detect if the file was downloaded correctly by trying to uncompress. If it works, the download was successful. If not, the uncompressing will fail. This way, it’s much easier to determine if a file was downloaded correctly or not. While this change is definitely good for the user, it also benefits us, because it doesn’t take so much time to upload NaroCAD and makes testing the updater a bit faster.
Sunday, February 27, 2011
Spline Tools Improvements
Interpolated Spline and Control Point spline have two small improvements:
- pressing shift for a point on a spline will delete it. This is useful if you made a point that was defined on a wrong coordinate and you don't want to remake it
- if you start dragging a point, you can insert the coordinate from command line, so you may can work right away and fix it later.
The editing component of spline is not yet finished, but expect more goodies in this area.
See a small demo here:
Spline Undo/Redo Fixes
Also I've did the skeleton work for Split Spline tool but this will be described (most likely) in the next blog post.
Friday, February 25, 2011
Block Plane Enhancement
Hinter is also shown live how it works as it can be seen here:
Thursday, February 24, 2011
TreeView Assert Fix and Solver Quick Enablement
Solver options are exposed from the main interface to be one click away. One other change is that (excluding this screenshot that was a development photo) is changed to be named Hinter. In this way I will not use erroneously interchangeably those two words.
Updater - Part III
Wednesday, February 23, 2011
Cubic Spline Improvments
So you will have three spline types under NaroCAD and they will work a bit better than in the past.
Some fixes may be still needed but at large Spline related tools are nice to work with and you may enjoy using them (in next releases). OpenCascade 2D layers do not work concomitantly (or I've misunderstood how they work) but I've rewrite to make possible to write multiple texts so when you will use Spline you will see coordinates)
Note: cause of internal changes, if you was using in the past Spline Path tool, I do recommend you to work with nighties, because this functionality is rewritten in a non compatible way. Also the old code was making to add features on it (like a proper editing code) very hard, so will be unlikely to get fixes will be in that area.
So take a look:
Mistake: cubic splines are defined by 4 points.
Arc gizmos
Updater - Part II
Yesterday I told you that NaroCAD will only download the files that were changed during the new release. Although I encountered problem with checking the file length, the hash code was a bit tricky. The main problem is that the hash code had different values depending on the time the file was created, and other parameters.
The main problem was that every build changed the hash code of the project files. The only solution to this problem would be to study how the date information is stored in files, study the encryption and decide whether the new file has useful information or not. Still, we mustn’t forget that the size of these files is small (very small if compressed). Even if I were to study these changes, I would still have to download the file in order to do the analysis. Even more, the analysis would be time consuming. The best way is to download all the generated files and check if changes were made to all the other files. This is a bit easier because these files don’t suffer from small changes, usually no changes at all. Given that the files without such problems are more than 70% of all NaroCAD files, the updater will prove much faster than actually downloading and installing NaroCAD.
To tell the truth, even the other files have different hash code when created by the installer. The advantage is that building the projects will not change these files. This means that the developers will not store different hash code for these files when generating the information of the versioning files. If these files are changed, the information from the versioning files will also change. Knowing this helps me to implement a faster updater. The only trick is that the newer hash code of these files (for example OpenCascade libraries, icons, etc) will be compared with the hash code from the current versioning files. This way, the contents of these files will not be red. What does this mean? If someone changes a character of such a file on purpose (so that the length remains the same) the updater will not be able to tell the difference.
So, to make it brief: the files generated by the NaroCAD projects will always be replaced in the new versions, and all other files will be downloaded only if needed.
Tuesday, February 22, 2011
NaroCAD Startup Time And Lazy Loading
As of today the startup time is splitted like this: library startup (.Net, DirectX subset used by WPF, OpenCascade startup, browser control that is used both on Tips window and on Help view), JIT (still, but at a smaller margin), layouting (Ribbon control will layout all buttons to fit right, all menu items and so on), NaroCAD framework logic and some Boo evaluation code.
So as for now on my machine (which is an i5M CPU class laptop) is around 3 seconds and I will explain what was changed in mostly the last 2 months, from when SCSF was removed and how JIT time was also greatly removed.
When we register things in NaroCAD (like actions, buttons) we always hit constructors. And this constructors are compiled with everything is in them. So, the logic that was in the past, regarding them was moved to an external method, that can be overriden named OnRegister. This will be called lazily as needed, so you will likely you will not see that an action will need a list of inputs to be setup. Another thing is that most actions will inherit mostly two classes (ModifierContainer or DrawingLiveShape) making precompiling to happen just once.
Another small issue was that layouting of all tabs take around 0.7 seconds, so tabs are also layouted from first time when you activate them. This will add just 0.2 seconds on average (for first time) when you will switch tab, but is much better if you will start often NaroCAD (hopefully not for crashing reasons).
Another section that was seen in profiling, and was made in 1.5.7 timeframe (so you get this even without nightly builds) is that Boo expression evaluator will be used in any instance using an interpreter. This will mean that your expresions if are like loops, they will likely execute slower (yet, external methods are executed through a compiler). To run as an interpreter, makes the logic of the code much simpler from Boo parsing and executing side and will likely speedup 3x in most cases.
At the end, regular poly tool was compiled at NaroCAD startup, but today is compiled just first time when is used.
Why I wrote this post? Mostly to know that we do keep an eye on how NaroCAD works both outside (we get on average fewer errors than in previous releases as bug reports even as download count goes up) and from inside.
Also, I wanted to you to know how and why "NaroCAD is slow": WPF is like starting a small DirectX game, and similarly when we start OpenCascade libraries (that load OpenGL libraries), Internet Explorer control, Ribbon to do layouting, and so on, at the end you will get this startup time.
Do you have a specific case when NaroCAD works slow for you? May you share it with us? Use NaroCAD and with your feedback we will make it better.
As an update: sometimes Polar Coordinate setup may lose its values from options and all around bugs were fixed. We use cubic spline "magic number", so if you will draw splines that are placed in corned of a square, the 4 leg spline will approximate a circle as described here. The next nightly may show it to you.
Updater - Part I
I’ve started to implement an updater. Since it’s a lot to explain and since my work is not done yet, I will do it step by step. The user will be able to use 2 check boxes that allow NaroCAD to search for nightly builds, stable builds or nothing at all. I will use a button with different colors in order to tell the user if new updates are available, if files are being downloaded, or if the latest download is finished. One of my purposes is to download as less as possible in order to update NaroCAD. This is why I will use a versioning file that contains the current version (nightly or stable) and information about critical files in NaroCAD. As expected, newer versions will have a different version number and some of the files will disappear, new ones might probably appear or some of them might change because new features were implemented. In order to investigate if one of these files was changed, I decided to check the length of the file and its hash code. With this strategy, just a few files will be downloaded for each new NaroCAD version. I will end for today with the explanation of the 2 check boxes: the first one is called “Check for updates”; if this check box is unchecked, NaroCAD will not search for any new updates. When checking it, a new check box will appear “Experimental builds (nightly)”; if the user doesn’t check it, only the stable builds will be downloaded. If both of them are checked, NaroCAD will search for every Nightly Build. Note that the nightly builds contain the stable builds, so don’t worry, no features will be lost.
Monday, February 21, 2011
Polar Coordinate Match
Look how it works in this small video. If you want to test it, pick the nightly build from right:
Note, if you will want to test the new spline code, this code is fairly broken.
Saturday, February 19, 2011
Non Common Cases Crash Fixes. Reviewed To Improve Spline
So the solution is for now to not update any time tree view, and when is needed, will restore everything in a stable state (to be certain that those crashes will not happen).
Splines in major design tools are of three types:
- one of as many points as possible, being the equation that is defined by all points of it. Was our original spline tool implementation
- another two are based on 4 point spline "legs", one is made by using control points and other one for simplicity uses the same control points but will interpolate the values for user, because it reduces the click count by a third
So logically the "Control Point" and "Interpolated" spline are both implemented in the same time, anyway, as both shapes have some exceptions from other shapes, some problems in implementation were obvious (like is one shape that transformation is handled separately). Editing in 1.5.7 works just for first leg of Spline, and so on.
I was evaluated problems of it and I've looked to other how they do it, and I found and I'm on the right track to solve all class of problems: Spline (interpolate and control point) will be consolidated in a single shape), also the actions that expose it will share a good bunch of code (excluding the interpolate "automatical generation of points" that will be different between those two tools). In this time I've also evaluated and solve some small issues I've found around the way: NaroCAD had no dashed fixed distance (not infinite) line that I wanted to use it for previewing the control lines. Also a small bug, but for certain annyoing was that the code for setup the color was not working for "interactives", and the root cause was that we setup style for shapes (a great thing for rectangles).
So in short hopefully soon you will see a spline that will work fairly right in most design ways and will be a useful and friendly tool.
Note: Did you know that you can insert coordinates for Spline from command line? In case you wanted a precise tunning?
Friday, February 18, 2011
Magic points with Gizmos
A video sample of using it:
Horizontal and Vertical lines intersection points
Thursday, February 17, 2011
Fixed and improved Fillet and Chamfer tools
Simplified the usage of all these tools. Now the usage flow is the following: click on the tool icon, the tool when starts automatically changes selection mode to edge (where needed), the user clicks on the edge/wire to fillet/chamfer, a dialog appears on which the user can enter the fillet/chamfer radius (the modifications on the dialog are previewed live on scene).
Because fillet/chamfer were the last tools that needed the selection change tool, disabled for the moment the change selection tool.
Wednesday, February 16, 2011
NaroCAD 1.5.7 Released
- Added Ortho tool: Blocks drawing on horizontal vertical direction:
- Added Trim tool: so you can make proper designs combining 2D shapes
- Block plane tool: The user can block drawing on a specific plane: you can work without annoyances in any free form plane so you can make your designs to really work
- Measurement tool: so you can see distances without actually creating geometry
- Enhanced line tool: The line length can be inserted on command line.
- Added spline path tool: is an enhanced spline, with fewer of "multi-point" spline. It is more precise and you will get more changes later.
- Copy paste tool: combines copy paste with precision translate: so will make repetitive shape creation even nicer
- Modify solver precision with scene zoom level: so the solver will feel both precise and useful
- The solver returns the closest point, not the first solution found: making an "non-calibrated" solver to give relevant point that you may search
We also ported (mostly, some bugs stop to make it even as a future prospect, but who knows, we welcome reviewing code) SketchSolve, and in case it will be finished, a full 2D solver, C# based may be a part of NaroCAD.
Saturday, February 12, 2011
Bug Fixing and Zoom
Line as it was rewritten to handle command line differently, a bug was that you could possibly create a zero length line. Right now the "double clicks" are ignored.
Thursday, February 10, 2011
Line Improvements
- Line will not compute parallel line solver checks with points from previous line
- command line was fixed to handle custom "Unknown" type (previously command line was used to work with specifed types only) to make
In the last days I've converted line to line to C# SketchSolve. Anyway, there are some problems and that code works a lot with pointers/references and for this reason, the code does not work as it should. There may be little mistakes, but are enough to make this code to break. Most likely I do work on a copy when I should not, or vice-versa. If are any takers that need a full solver in 2D (with constraints) and want to be C# ready, please take a look to this project and try to spot where are the problems. The code include both code-bases in a project under: Lib\Install\Lib\NaroSketchSolve\NaroSketchSolve\. I'll put the code as LGPL, so if you will fix, please contribute back this source code but also you will be able later to put it under your project, even is comercial. If you are pleased with the original C only implementation, you may wrap it using P/Invoke, so you will not have any LGPL restriction, but will be hard to see where are problems and why. (The original code is under BSD) This project is also better written as is OOP, it mostly respect NaroCAD codestyle, (even will keep for now a lot of variables and names from original code), so you may find it easier to navigate than the original code.
NaroCAD shape locations on scene
- when building a line let's say as example the (10, 10, 0) to (20, 20, 0) line we generate internally the (0, 0, 0) to (10, 10, 0) line and hold on some transformation interpreter the transformations applied on the shape, in our case a translation to (10, 10, 0). In this way we can expose to the user on the property grid the shape transformations and allow user to change them. A simulated shape in Draw Test Harness is like the following:
vertex v1 0 0 0
vertex v2 10 10 0
edge e1 v1 v2
ttranslate e1 10 10 0
dump e1
The dump result is:
Dump of 1 Curves
-------
1 : Line
Origin :0, 0, 0
Axis :0.707106781186547, 0.707106781186547, 0
Dump of 1 Locations
-------
1 :
Elementary location
( 1 0 0 10 )
( 0 1 0 10 )
( 0 0 1 0 )
The shape geometry is generated on (0, 0, 0) and holds the shape transformation on Location.
- When applying Opencascade algorithms like Trim or Mirror on our geometry like the one described above the result is a shape with Geometry generated in (10, 10, 0) and Location to (0, 0, 0). This creates us a lot of problems because we don't know where geometry is located, we don't have access to transformations, we have problems when a shape generated like this is passed to an algorithm together with a shape generated like in the case below. A Draw Test Harness sample of this type of shape:
vertex v1 10 10 0
vertex v1 20 20 0
edge e1 v1 v2
dump e1
The dump result:
Dump of 1 Curves
-------
1 : Line
Origin :20, 20, 0
Axis :-0.707106781186547, -0.707106781186547, 0
-------
Dump of 0 Locations
-------
The solution:
We decided to use everywhere only shapes located on (0, 0, 0) and hold transformations on our internal interpreter. That assumes an extra step on our side to prepare geometry before using OCC API: we have to save current transformations, translate all shapes involved towards origin, apply the API, translate the result at the saved transformations by applying the transformations on the interpreter.
Modified the Pipe and Trim tool to work like this and it seems to work well even on shapes that have rotations applied on them. If testing passes successfully we'll start modifying tools like mirror, extrude, cut to use this approach.
Wednesday, February 9, 2011
Trimming tool
A circle and 2 lines trimmed with another line:
Sunday, February 6, 2011
Copy/Paste Fix
So make sure that you select something before you try using Ctrl+C to copy an object to not crash on Paste.
Wednesday, February 2, 2011
Lines' Length and Orthogonal Axis Lock
You can also lock drawing to make it that you can move mouse just parallel with main axis. This works internally as a Solver mechanism, so in some cases that disable solver all-together may seem to not work, but in general with every shape drawn you will have this possibility.
To use it, you may check the nightly build.
Tuesday, February 1, 2011
New Spline Code
A handy tool is the measure tool: you will click between points and you will get the distance between them. It may be used to define distances between shapes without defining extra geometry in scene.
Trimming tool
The output of Trim is for the moment a wire in space. In order to make the tool much more powerful the plan for the final Trim tool is to generate geometry that we "know" in Naro. Ex: a trimmed Circle will create an Arc Node in Tree View editable in Property Grid, a trimmed Line will generate a Line Node.
Smart Copy Tool
Copy works like this:
- The user presses the "Copy" button
- The user selects the shape to be copied
- The user selects the desired base point
- The user selects a location where the copy is to be made. The base point of the copy will become the selected location
- The user selects other locations where other copies are to be made
Be careful that this command does not end. Any given point will generate a copy of the desired object. The user can create as many copies as necessary. The base point is required, because NaroCAD needs it in order to calculate the translation vector (move the object from the base point to the given location). Without giving the base point, NaroCAD would have to use the pivot or the gravity center as default. I prefer not to use values that cannot be changed when making a new feature. This way, the user has enough control over the shapes that are to be copied. After selecting the base shape and the base point, the user just has to select the desired locations where the copy is to be made. At every mouse click, a new copy will be generated. In order to try out this tool, you can download the last nightly build from www.narocad.com, under the downloads section.