Script request, center cplane on export

 From:  Michael Gibson
5461.16 In reply to 5461.13 
Hi Martin,

> That would mean that, when the script makes a thread for example, the profile and helix
> created using just .calculate()) will never appear? Also the cutter object and the cylinder
> would just be .calculated() in the background and just the finished thread pops up after
> some time like magic?

Well by the "fixing it" part I meant that I'll see if I can get loose objects (objects that are only referenced by the script engine itself and not added into MoI's geometry database) to work ok as input objects into async factories.

What I was referring to there would not change the behavior of when things appear on screen or not.

And yes, when you use the .calculate() method the result returned back will not by itself automatically appear on the screen - that's because the returned object is only referenced in that case by the script engine - when MoI redraws the screen the things that are drawn are all the stuff that's in it's geometry database, so if you want to have an object actually displayed you need to add it to the geometry database, just adding it will trigger a screen redraw.


> When using this var = factory.calculate() method for sweep and boolean diff
>
> a) the "Calculating ..." message doesn't apear
> b) the calculation terminates after 90 s. It seems that this certain JavaScript protection also kicks in here.

Yes, the .calculate() method is synchronous, it runs directly on the main thread and does not use the worker process mechanism. So that means no "Calculating..." message and also MoI will appear frozen while it is crunching away. It could very well be triggering the script timeout because of that as well, but with the next v3 beta that script timeout will be removed so hopefully that limit will go away with it.

But also in the next v3 beta you will not be forced to use .calculate(), that other .getCreatedObjects() method will pause the script until the async update is complete so with the next v3 release that method you were using previously will work ok with async factories.

- Michael