Monday, August 31, 2009
Hopefully you will like at least how it looks and you will create scripts to create more complex shapes.
Friday, August 28, 2009
Better than previous scripting is that you can identify the shapes using their ids, and of course you have the entire power of Lua around, by this I mean that you can do loops in scripting so it will make easy to you to write your code using an easy to learn scripting.
If you don't know how to use Lua, I recommend this tutorial.
Thursday, August 27, 2009
Last days I've did mostly work on polish and fix what I've did let broken by Node Builder change (which generally broke Naro from place to place). Today in the free time I've did manage to integrate the line code in Lua. The code is not complete for other shapes, but when I will manage it, I will say how Lua works around. It is great that Lua will generate comparable power with IronPython implementation yet with a simpler scripting language. To be honest, IronPython will work for hard-core scripters and Lua will map only high level shapes.
I will keep you updated tomorrow on how works Lua in Naro after I will complete most (if not all) shapes.
Wednesday, August 26, 2009
Tuesday, August 25, 2009
Today added code that allows the user to draw an Arc specifying the first and start point and the radius after that. This together with magic points enables the users to connect 2d shapes/wires through an arc.
Naro currently contains a Fillet tool that applies Fillet on a solid. Will work at improving this to allow applying the fillet only on a selected edge of a solid.
Found two possibilities to connect simple wires through fillet or apply a fillet by operating at the 2d level:
- the first one would be using Geom2dGcc_Circ2d2TanRad to generate a tangent circle at the two wires and build a wire with all these - a problem here would be that this package is not wrapped yet, on this situation all the generated shapes would be separate shapes in the data tree (the result of filleting two lines would be two shorter lines and an arc as separate shapes in the data tree),
- another possibility would be to use BRepFilletAPI_MakeFillet2d to fillet vertexes of a planar face but this possibility assumes a different way of working: filleting two lines would assume grouping them on a face and then apply fillet on the common vertex, the result would be in the data tree a wire generated by the algorithm, the two initial lines would be hidden. Not sure if this algorithm works on a wire that is not closed, will have to test it.
Will analyze which of these methods would be more useful for the users and implement it.
Sunday, August 23, 2009
There are two dialogs: the tag editor dialog (on the right) and the shape tag editor. To enable/disable a tag is just simply to select in the tag editor list box. Going out of this dialog it will update automatically the view. The dialogs were made to reduce the click count, so this is why we remove the "Apply, OK, Cancel" buttons as they will only increase the click count (excluding you don't press OK all the time).
Just in case you've added an extra tag by mistake, simply do an Undo and you will get back to work. You've added tags but you want to see whole scene? Go to Tag Editor and unselect all fields. By doing this, all shapes are shown, regardless of tag(s).
Saturday, August 22, 2009
Why is a need to tag shapes first of all? Designers want to split complex designs in simple components. Like a sketch design, or only solid components, etc. Naro did it using a concept named "layers". A layer was an identifier that you were able to attach to any shape and you could hide, show them. The problem is that most users do not know about this feature from one side, and from other side, is hard to attach a meaningless number to a shape. So the solution is to add labels to a shape that have a meaning. Not a number, but a name.
Right now the ongoing implementation was done to replace the layer identifiers to names, but it will continue to simplify the user interface. By this it will be created a new action to set specific tags/names to any shape you create. Also, it will be an easy to use UI to create a new tag.
How it works: you want to define a shape in a sketch:
- you define the tag named "Sketch" and you set as active tag. Any created shapes from now on will be created with this new tag. This is possible to be done because of our previous refactor that not only make possible with no extra code for actual shapes, but also reduce the lines to do so. Because all other tags are inactive, the scene goes blank, so you will not be distracted by other geometry
- after you finish to draw with the sketch, you can define another tag, SketchTools and you will be able to create a feature like extrude
- if you will want to see the end result, you will disable filtering of all tags, so at the end you will see the geometry of all tags
The tag system for now works with OR convention, meaning that you will see a shape containing at least one tag of the filtered ones.
After the UI is cleaned a bit you will see a screenshot.
Friday, August 21, 2009
NaroCAD uses a good architecture regarding giving hints to user like close geometry around or that it is on a specific plane or a line is paralel with another one. We name this component Solver. The solver component of Naro sometimes is not useful, sometimes is even worse, it stops you to work. For example working with a precise geometry shape, you will see that your points jump over and over again without wanting this. The reason is that the solver finds some points around or parralelism that you don't asked for. Also, if your geometry will go too complex, the solver may get slow, so you may want to disable at least parts of it.
Update: Solver points may slow down your application if you draw a lot of lines because they are checked at every mouse move. An improvement in this area is that in case of shared points, the solver to generate the points only once. By this we increase the generation solver points time from O(n) to O(shP*n), where shP = shared points, but we decrease the real time complexity to O(shP). So right now if your machine was slower, and you picked to disable the point hinter because of this, right now the normal increase is like this: for every box or extrude, you should expect an increase of 2-3x of speed. The small slowdown is when your solver points are generated.
Thursday, August 20, 2009
All work is done using Lua interface project. The solution is most probably to map the shape creation to Lua using functions. I did not found a easy factory like solution but I still thinking.
Tuesday, August 18, 2009
Do you know his famous 12 steps to write better software? The step that was done wrong in this refactor was step 5: Do you fix bugs before writing new code? The best answer should be yes. But instead doing this, I've target to have "the basic infrastructure" done and after this doing bug fixing. By taking this approach I've face bugs in a lot of areas back and forth being low rewarding task. The good part is that the infrastructure is there. I mean by this that command line goes to an ambitious command line that at least have a lot of ideas started.
Why fixing later bugs will go so big delays? My reason is: it breaks your focus and make your experience of programming the features grumpy. I've shown a screenshot in the last command line update that shows buttons corresponding to parameters. This is great but firstly the coloring was wrong, the Point3D type was hardcoded. Clicking on any button lead to crash. Resetting the Command Line action after pressing any letter. Because of this the browser refresh all the times, etc. This makes in short that almost anything you clicked on can lead to a crash. So fixes were here and there but still the code is unstable.
I will try tomorrow to take this piece of code and bug fix it. If I found all bugs and fix them, I build on top of it. If I will not be able to go on command line in detail, I will try to fix as much bugs as possible at the end of iteration. I think that users will care much less of a such powerful command line that can make Naro to crash at any moment than a fewer commands that when you call them, they work.
Monday, August 17, 2009
In fact a lot of code was reduced, but the biggest advantage is that it setups some defaults also: the new node created will be auto-numbered (like: Line-1, Line-2) and it will be setup as visible by default.
So the typical code changes from:
var node = _document.Root.AddNewChild();
node.Update<StringInterpreter>().Value = AutoNumbering.GetNextIndex(FunctionNames.Rectangle);
var function = node.Update<FunctionInterpreter>();
function.Name = FunctionNames.Rectangle;
function.Dependency.Child(0).Point3D = v1;
function.Dependency.Child(1).Point3D = v2;
function.Dependency.Child(2).Point3D = v3;
node.Update<IntegerInterpreter>().Value = (int)OcafObjectVisibility.ToBeDisplayed;
var builder = new NodeBuilder(_document.Root, FunctionNames.Rectangle);
builder.Dependency.Child(0).Point3D = v1;
builder.Dependency.Child(1).Point3D = v2;
builder.Dependency.Child(2).Point3D = v3;
Both code are really equivalent, the single difference is that NodeBuilder will do all the code internally for you like setting up visibility or the attached description string.
So enjoy using the new code
Saturday, August 15, 2009
Even doing a refreshView twice is not a big deal, but the refactor tries not to stop here, it tries to give a possibility for user to pick shapes for real, to have variable number of arguments and better hints. For now doing this, the application will need to enter in the "Command Line mode" which means that when you will start writing commands, is similar like you draw a shape.
Also, it was impossible to map x, y, z to a point picker component in a consistent way. So after refacit the commands like: line 0 0 0 100 100 100, they are declared as:
line point1:Point3D point2:Point3D from parser standpoint. This when it will be finish will make a more coherent and possible to offer code completion on user.
For persons who follow the commits, most of code of command line was integrated in the Infrastructure.Interface assembly which was the "referenced by all" assembly. But in practice the command line code was used (almost) only by the Command Line dialog. The command line code was got out of.
Also, the parser will offer live controls for giving to user hints as he writes the command. For valid arguments, you will have green colored buttons, for the command you write will be colored in yellow till is complete, for future arguments (which may be undefined, erroneous) are underlined with red.
I will want also to not let Execute button to be enable when your command have invalid arguments as is both useless for user and executing it, and user may lose his written command.
A special note, a good idea that was concluded after today's NaroCAD Feedback Sessions by our user Van and most probably will be implemented in the next iteration: users will be able to filter shapes' visualization by tagging. They will work as an extended concept on NaroCAD's Layers. This will compensate the unclear separation between 2D and 3D mode in NaroCAD. The tagging will be done automatically for new shapes and it will be explained when it will be done how everything works. The good thing about tagging is that you will be able to assign tags like: Sketch 1 (so all shapes that you draw in a separate sketch), Liquid, etc. Tagging will be done initially only for visualization, but most probably the search in the objects tree dialog may be changed to take in account node tagging so you can filter from tree also all shapes that will correspond to a tag. So stay tuned!
Friday, August 14, 2009
Thursday, August 13, 2009
This post can be useful to you if you want to build NaroCAD on your own and also can be used by you to track Naro's problems.
What you need?
Firstly this are components that need to run Naro:
- Windows XP SP2 or greater (Vista, Windows 7 Beta 2 or newer)
- .NET 3.5 runtime (SP1 recommended). For Vista and Windows 7 users, simply go up-to-date via Windows Update and you will get it
- Visual Studio 2008 SP1 C++ Runtime. This is used to make OpenCascade wrappers to work. If Naro will start with an error like: cannot find get__Context method, means that the C++ Runtime on your machine was not detected. The erros can be found in NaroCAD folder under log\log.txt file
- OpenCascade distribution
What you need to develop Naro:
- SVN client. With this you will be able to get Naro's sources. One of the easiest to use interfaces is: TurtoiseSVN client.
- a C# IDE. In this categories mostly enters two alternatives: Visual C# Professional or Express 2008. Or if you like a bit rough but more featured than express, you may try the opensource SharpDevelop. I like more SharpDevelop as integrates with SVN, unit testing, but is much harder to debug with it comparing with Visual Studio counterpart
Steps to build NaroCAD:
- install all previous programs
- take sources. If you use a command line svn alternative, you should write in command line in any folder you want to get the sources this: svn co https://narocad.svn.sourceforge.net/svnroot/narocad/trunk narocad. If you use TurtosiseSVN, you will need to right click on any folder you want to get sources, choose SVN Checkout and in the address text box write: https://narocad.svn.sourceforge.net/svnroot/narocad/trunk
- double click on narocad\narocad.sln that should make start your installed IDE
- do Run
Later if you want to be up-to-date as you see a blog item about a new feature and you want to test it, go to that folder where the sources are and execute: svn update by command line or if you use Turtoise, right click and pick the option: SVN Update and rebuild and run NaroCAD again.
The real problem is that we did not get in most of cases how to reproduce in detail your cases.
In many cases we found that may crash fairly random on other machines but for sure Naro in our development machines do not crash all of the sudden. Just in my case I have three machines I test Naro extensively, a low-end workstation (AMD Phenom X4 9960 CPU, 8G of RAM, Ati 4850 1G Video and a Vista 64 OS English), a common laptop (Intel C2D 2GHz, 4G RAM, NVidia 103 GPU 512M video dedicated, with Windows 7 64 bits English) and an Atom laptop (Samsung NC10, default configuration, but upgraded from 1 to 2G of RAM, WinXP SP3 Home in Spannish, Intel video card).
If you have a configuration that Naro crash by only visiting looking shapes all of the sudden, please update your video drivers and make an up-to-date of your OS. This may be good not only for Naro but for others applications as well.
If you think that is a NaroCAD problem, and Naro crash, it is much more valuable both for you and for us to try to do this:
- find if Naro crash consistently in the same way. Let's say it crash when you create a 2 points line with length zero. Or you combine a spline with another spline in grouping operations, etc. etc.
- try to reduce the steps to bare minimum. The most easy way even you have a complex configuration of shapes that makes to crash, is to save the file content just before it crash, and try to get that file too. By doing this you will simply need to make 2 steps to reproduce this bug: open the file and do an operation that crash Naro.
- fill those steps when the crash reporter appears. Pasting the NaroXML file in bug report and the step will mean for us developers a very easy way to debug and fix the problem.
- just in case that you want to know when is fixed, write your email to an account to be contacted after a bug fix is done. In this way will be much easier to be sure that the bug fix really solves your problem as we will contact you to validate the fix if is done correctly. If you are afraid that your email may be used in a wrong way, go to NaroCAD's SourceForge page to report the bug here: http://sourceforge.net/tracker/?group_id=198020&atid=963798 and choose to be notified on changes on bug life cycle.
By doing this it will save a lot of our work and it will reduce the time to fix the problems to you too.
NaroCAD is mostly tested (by me at least) using English/Spanish Windows OSes which may mean that internationalization problems are really hard to be tracked by me. If you think that may be an internationalization problem, is fairly easy to track it down: change your language setting to English first when running Naro and at the end redo the operations using your language.
If you can track an internationalization problems on your machine, please notice us, we will be able to track those problems too by getting real life feedback from you.
So, resuming all blog post, when you see that Naro crash, please rerun NaroCAD and find the smallest case that you can get the problem and write the steps down in the crash report. If you are really interested on that bug to be fixed and you know that you can test if is fixed or not on your machine, let on the last line of the bug report your email and we will ask you for validating the fix.
Tuesday, August 11, 2009
One of them was the fact that any command that succeeds goes to history. So if you were an user you will see see commands like refresh command in log which increase without use the verbosity.
Other one is that the code completion was Unix's bash like and the completion key was space. In the attached image you may see the old way compared with the new one.
Other limitation is that when you define a shape you cannot use another shape, and is critical when will be made the boolean operation command line. The scanner have other small touch too, meaning that it will be aware if a space is at the end of the command line, so it will be able to highlight correctly the hinted word.
There are some regressions for the moment, so there is a need to wait one day more.
Monday, August 10, 2009
IronPython was integrated for some time to NaroCAD. But in fact it has two problems:
- it was not able to access NaroCAD shapes or anything from NaroCAD so it was not powerful enough to do something useful, excluding you did want to make a processing task using python
- IronPython implementation (and python in itself) do not work with Generics. So even you had access to Naro's document model, the Naro's extensible model was not accessible to IronPython script programmers.
This is why it was used lazy loading of IronPython as it does useless slowdown on startup of NaroCAD.
Right now both are addressed, exposing to you a document reference that you can create from it using a PyNodeUtil class a shape node. This is fairly important achievement as it can make easier without recompile NaroCAD to migrate your shapes if you can expose to IronPython a non generic class with your shapes.
Here is the proof of concept:
- import the assembly that you expose your shapes or whatever you want to expose like this:
- import the namespace of your class that define the assembly (which is equivalent with C#'s using):
from MyShapeCS.FileImporter import *
- create one instance of your class in IPy that is able to import your shapes. Import if needed that classes
stepImporter = StepFileImporter("MyStepFile.step")
- decide by your IronPython code which shape need to be created, etc.
... python code ...
- create one instance of the shape as PyNodeUtil and use it (I will create one extrude, with first child the shape with it's id 2, at height 32.5 and normal extrude)
shapeNode = PyNodeUtil(document, "Extrude");
result = shapeNode.FunctionExecute()
document.Commit("Extrude added by scripting")
The result variable will have the bool value that will say if operation succeeds or not.
To see the results you have the Refresh button of scripting window that will update the tree of data and the view of Naro, and if you want low level debugging without updating the OCC view, in the View Menu there is an tool named "Debug Data Tree".
So, if you dislike C# and you like dynamic languages like Python you may do bridges between your application and Naro. Also may make to you to export Naro's object to your external tool without touching Naro's sourcecode.
The functionality planned to be implemented in the current iteration (1.0.4):
- Improve the command line: have commands for all functions, add help,
- Scripting improvement,
- Implement revolve and sweep,
- Implement Arc, Axis, Infinite line,
- Improve geometric solver and magic points,
- Linear and circular feature pattern, repeating a shape using a function,
- Bug fixing.
Functionality implemented in the previous iteration (1.0.3):
- Added Cut to depth,
- Added more commands to the command line,
- Fixed the synchronicity between transformations and shape center/location,
- Implemented constraints (fixed size constraint, range size constrained, location constraint),
- Added Group/Ungroup, functionality that makes a face from wires by grouping them,
- Implemented AutoGroup, automatically closed wires are detected and generated a
face from them (with three lines a rectangle face can be generated),
- Implemented interactive help,
- Toolbar improvements, similar shapes grouped,
- Undo/Redo with history list,
- Improved and optimized the shape delete code,
- File header cleanup.
Thursday, August 6, 2009
Finally finished integrating, fixing and testing the transformations into Naro. Modified the NamedShapeInterpreter that after the shape is generated the transformations are applied on it and after that the interactive object generated.
Any shape from the application using the property grid can be now translated at a certain position, rotated around the x, y, z axes having the possibility to rotate around a pivot point, the object can be also scaled.
Made also a screenshot with a circle copy pasted several times and rotated 45 degrees around a pivot point located at (0, 0, 0). The model is finalized applying also some extrudes and transparency.
Will continue with improving the geometric solver and magic points.
Wednesday, August 5, 2009
Right now are added Open/Save buttons to toolbar. The selection toolbar is more logical. There is added a fullscreen mode.
Hopefully you will enjoy new additions.
Tuesday, August 4, 2009
Reviewed the descriptor code that synchronizes the property grid with the model. This needs improvements.
Improved the NamedShapeInterpreter so that it applies properly transformations when the shape is regenerated.
Will continue with fixing the transformation property grid synchronization end reactivating the translation with mouse.
Monday, August 3, 2009
- startup time was shortened with around 20-25% by not executing IronPython initial code. It will be executed anyway when you really want to write IronPython scripting Also the AppDomain code is not used in NaroCAD so was disabled from SCSF. There was an attempt to run in a multi-threaded manner but makes Naro to crash randomly as modules may not have been loaded in correct order.
- undo/redo exposes the list of events that are done and are disabled when no other item is in their side list
- if you close the active Help view, a crash may occur
- if you go to same help page you get a browser refresh. This in special was mostly annoying if you have a sound setup for refresh browser you will get the same sound over and over again. Right now only if page changes the page is loaded.
- constraint do not get transformation options. As constraints are not visual, the transformations changes are useless
- filtering in Objects' treeview. was broken when constraint code were added, so if you used a previous version SVN version of TreeView and you filter after a key, after first item was matching, all subsequent items were considered as matching. This is fixed too.
- save event do not work as Save As, but there is enabled the Save As action. Save will preserve the file name for the next saves. So you will not get the Save dialog over and over again
- autogrouping is done automatically after every line is drawn
With this fixes and improvements you will probably have the usage experience more pleasant.
Don't forget about Feedback sessions to make NaroCAD and your experience using it even better.
Also as any opensource project both we and users benefit as both gets what it needs. So if the NaroCAD does not fit you, or have a bug that annoys you or you simply need one feature, or you want to add it and you don't know how, the best way to do it is to say it. The easiest way is to write two lines in the comment area of any blog post. If you want a more elaborated answer, or simply you need to not put the question publicly, you can email to bxtrx ( mihaizzz(at)yahoo (dot)com ) or to me (ciprian(dot)mustiata(at)gmail (dot) com).
We want to announce right now the NaroCAD Feedback Sessions which will be done twice in a weekly manner, every Wednesday at 17.00 CET (11 AM EDT - New York) and the same meeting will be done the next day Saturday at the same hour: 17.00 CET (11 AM EDT - New York)
How to attend to meetings? You should download Skype as meeting software. At startup you will create one new user (if you don't have one). At the end, you should send a message to user ciprian.mustiata or mihaizn to add you to the conference named very imaginative as NaroCAD.
There for one hour we can hear all suggestions and we are really thankful to get any kind of feedback. The feedback will make NaroCAD to really met your needs and we will listen very cautiously everything you say.
Saturday, August 1, 2009
Also I had fixed longer standing bug like delete worked only as a hider operation. Right now it really removes the unreferenced geometry.
A small tweak is that Top, Bottom, Axo, etc. views are compacted in one button popup. By compacting this 7 views makes that in a 1280 screen the toolbars can fit in one row.
There are still some bugs in filtering I tried to address but not yet found a solution.