MoI discussion forum
MoI discussion forum

Full Version: Script request, center cplane on export

Show messages: All  1-12  13-19

From: Martin (MARTIN3D)
12 Oct 2012   [#13] In reply to [#10]
Ha, now it works perfectly :-) and your explanations make sense to me. Thanks a lot.

>Tomorrow I'll try to take a look and see what's involved in making "loose" (meaning not actually a part of the geometry database) objects work as input into async factories, maybe I can also get that tuned up to work.

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?
From: Martin (MARTIN3D)
12 Oct 2012   [#14] In reply to [#13]
Two observations:
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.
From: Michael Gibson
12 Oct 2012   [#15] In reply to [#12]
Hi DesuDeus, please try the attached ExportCentered2 command, hopefully it does what you were wanting.

- Michael

Attachments:
ExportCentered2.zip


From: Michael Gibson
12 Oct 2012   [#16] In reply to [#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
From: Martin (MARTIN3D)
12 Oct 2012   [#17] In reply to [#16]
Thanks Michael, I understood that you are just looking. Anyway I went back to my old method. The script is more reliable and - very important - it also works in older MoI versions.
From: Samuel Zeller
19 Oct 2012   [#18] In reply to [#15]
Hi,

Tried ExportCentered2

Two things are not working.

1. Once the export in 3DM is done it doesn't revert the centered model (I need to cmd+Z)

2. It doesn't work if I try to output an OBJ, it doesn't display the meshing settings

I need this script specially for exporting to OBJ -> Cinema 4D :)
From: Michael Gibson
19 Oct 2012   [#19] In reply to [#18]
Hi DesuDeus, I just tested ExportCentered2 over here both in Windows and Mac versions and I can't reproduce any of those problems.

How are you installing and running it? Make sure that you are placing it into the \commands folder and to trigger it put in only: ExportCentered2 as the command name, nothing else like "script:" for this case.

- Michael

Show messages: All  1-12  13-19