Sunday, 11 March 2012

NaroPAD - a very light version of NaroCAD

As my life was (and still is) busy with other activities, I thought it would make sense to make a small yet useful tool for mere mortals.
OpenCascade 6.5. work would take an eternity for our small team, and I know that it would need a lot of work for making it not only to update, but to make all tools to work as smooth as before, so I started from the things that already work.
So what worked well in NaroCAD: the regular shapes and tools, Step loading/saving, most of Undo/Redo operations. In short, it worked the shape creation and documents operations. What it didn't: complex interactions (with selection code for example), some tools (like Layers) would be made ad-hoc so some changes (like picking layer colors) would not reflect in all cases in code.
What is NaroPAD? Is a NaroCAD distribution that expose just the Boo coding and the OpenCascade view. It is also intended for people to preview fast some shapes in OpenCascade and if needed to extend based on specific needs.

The code to create a yellow box using 4 lines, fill them, extrude them and setting the color is the following:

import System.Drawing

util = Self.Shapes
# draw the lines
line = util .Line(0,0,0,10)
#fill the face based on searching the auto-facing
face = util.TryAutoGroup(line)
#pick a framework function named Extrude
ex = Self.Get(Func.Extrude)
#set custom function parameters
ex[0].ReferenceBuilder = face
ex[2].Real = 8
#set extrude's color as yellow
ex.Color = Color.Yellow

To make your own NaroPAD (or to extend it), you need to take a 1 year old version of NaroCAD (from Mercurial, this revision), and replace the Source folder with the

Execute action have the capability to give the triangle list or to export the shape as Step file. If you dig in NaroCAD's source, you can import fairly easy a step file. So it can be made a fast prototype/preview tool. Also as the text editor is a full Boo language support, there is support for all Boo constructs not limited to classes, control flow (like if/while/for). If you want to learn about Boo, please look here.
If you want just to try it, download it from here.
(License is GPL2 as this code is derived from NaroCAD's GPL2 codebase)

No comments:

Post a Comment