NACA Airfoil script

 From:  Michael Gibson
7265.8 In reply to 7265.6 
Hi Hamish, some great progress!

> I also played with joining a line segment to a curve, before each is committed - it's not
> working yet - I just don't have a grasp on the construct of a GeometryFactory vs a
> GeometryDatabase.
> I got stuck trying to get (convert?) the ObjectList objects from an interpcurve factory into
> a GeomObject object for the join factory. I'm not sure it's even possible, or a correct approach.

One thing you might be running into is if a factory does asynchronous object generation (meaning it actually does its calculation in a separate moi_commandprocessor.exe process, generally used for possibly long running calculations) the inputs you give to it need to be active in the geometry database and not a "loose object" that has just been dynamically created but not added to the geometry database yet. You get a "loose object" if you use factory.calculate() to generate it. These objects currently have to be added in to the geometry database in order for them to be used as inputs to an async factory and Join is one of these types of factories. I'd like to change how this works in the future so as not to have this requirement but it will take some work since some parts of object serialization and deserialization are based off of a unique object id number that is set when objects get added to the geometry database.


> I just don't have a grasp on the construct of a GeometryFactory vs a GeometryDatabase.

A GeometryFactory is something that you use to generate objects, it has inputs that can be set on it, and then for regular commands a call to factory.update() will cause the factory to generate objects and put them in the GeometryDatabase. The GeometryDatabase is not something you create yourself, it's basically the master list of all objects in the model, for example when the screen draws it's every object in the GeometryDatabase that gets drawn.

> [GeometryFactory].getInputObjects() and [GeometryFactory].getCreatedObjects() - are these of any
> use or am I barking up the wrong tree? Where might they be used anyway?

You can call these if you use factory.update() - the call to factory.update() will generate objects and put them into the GeometryDatabase automatically, if you then want to get a hold of an object list of what was actually generated then the .getCreatedObjects() will do that.


Most things in the current scripting environment are heavily oriented towards creating things in the same way as a regular command would, basically by setting some options and then having the objects show up on screen, so usually a regular MoI command just calls factory.update() and does not deal with the generated objects directly itself after that.

- Michael