And the last part. Probably for a regular polygon (and a gear) seems to be described in too many blog posts. Anyway, they do stress development in the idea that NaroCAD will have more external code in its package. Library shapes infrastructure support was the next logical and I will explain it using this shown diagram.
Let's say you will want to draw an OpenCascade shape: you will have to define a function that draws the topological shape, after this an action will use a NodeBuilder to instantiate it, to create it's corresponding shape, to set up extra attributes and at the end will put it in document.
A LibraryShape implementation works in a similar way with a Function (a shape generator) but instead using low level OpenCascade calls, will use Functions and will do it by using directly NodeBuilder and document.
So in this manner actions can take one step further and generate complex shapes on top of already existing shapes in NaroCAD (mostly as shapes are any item you will see on your tree of objects).
As Functions wrap OpenCascade code (so it need to be written just once!), they will need a component to get parameters. This component is the dependency part: this will make notifications automatically. So you will get both shape generation and propagation for free.
A library Shape will have dependencies, or arguments, but they will simply mean a creator framework. So a gear is simply defined as: tooth count, smaller range, bugger range and extrusion value. A regular polygon is defined as two points (center, the second to define its range) and the edges count.
Both will iterate and create the result combining functions (in both cases are lines, auto-face and an extrude).
The last fixes and improvements permit not only to register those LibraryShape globally as a function, but to you to be able to write them both in C# and in Boo (in fact the yesterday's screenshot was rewritten in Boo), and will make possible to change this script dynamically.
In fact the code was made accessible to make possible that from one LibraryShape to access another shape.
So if in future I want to make a gear with a hole in it, where is it's revolution axis, I will instantiate a gear, I will create an cylinder where I want to make extrusion happen, and at the end I will do a boolean substract between two.
So in fact the possibilities are much greater as the level of accessing shapes is at a much higher level than OpenCascade is.
At the end, you will get huge possibilities by customizing Library Shapes and if you don't know how to create a shape, just use the BooExporter plugin to your simple shapes as starting point and add loops and your extra tricks.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment