MoI discussion forum
MoI discussion forum

Full Version: Updates to the MoI API of David C Morrill

Show messages:  1-18  19-38  39-47

From: pressure (PEER)
22 Sep 2022   [#19] In reply to [#17]
Brian,

Yes I've been going off of the 2015 idl, or rather Tudor's javascript translation of it.
From: pressure (PEER)
22 Sep 2022   [#20] In reply to [#18]
Thanks Michael! What you wrote is even better than what I was hoping for. Thanks for putting it all into human-readable format with comments.

I forgot to ask about trackpadgesture events.
From: Michael Gibson
22 Sep 2022   [#21] In reply to [#20]
Hi Peer,

re:
> I forgot to ask about trackpadgesture events.

Trackpad gesture events are handled internally by the C++ back end, there isn't any scripting involved in that part.

There are some options you can set under Options > View > Rotate/Pan/Zoom options > "MultiTouch options".

- MIchael
From: pressure (PEER)
22 Sep 2022   [#22] In reply to [#16]
Brian,

These are the new factories that I found. Anything missing?

addpointsrf
annotationtext
dimaligned
dimangle
dimhorizontal
dimradius
dimvertical
leader
arraygem
boundingbox
boundingboxcenter
conic
explodemove
flow
group
ungroup
ungroupall
inset
isocurve
make2d
nsided
orient
orientlinetoline
rebuildcurve
removeduplicates
silhouette
twist
viewproject
From: pressure (PEER)
22 Sep 2022   [#23] In reply to [#21]
Michael,

What are the methods for surface area and volume in the Details of the properties panel?
From: Michael Gibson
22 Sep 2022   [#24] In reply to [#23]
Hi Peer,

re:
> What are the methods for surface area and volume in the Details of the properties panel?

They use factories to get the built in non-blocking asynchronous updates.

Factory names: calclength, calcarea, calcvolume. Each takes an object list in input index 0 and fills in index 1 with the result value asynchronously. You have to call factory.waitForAsyncUpdate().

- Michael
From: bemfarmer
22 Sep 2022   [#25] In reply to [#22]
Hi PEER,

It was fairly easy to scan through the MoI5beta commands folder, of the *.js commands, using Microsoft Edge.
(I used to have to copy each file to notepad++)

It looks like you have identified all of the "new" factories, contained in the *.js commands.

However, a couple of points come to mind.

Trim factory has a second possible input for input 6, related to isocurve.
MoI3 has the isocurve factory.
Input 6 of Trim factory, could be more descriptive in your updated API (?)
Maybe API of David C. Morrill was for MoI2?

OrientViewToView.js uses the Orient factory, but the inputs are described a bit differently in the OrientViewToView command, than for Orient command.

Now have a new appreciation of the intricacy of the MoI user interface programming!

The conic factory is used in the Hyperbola and Parabola scripts here:
https://moi3d.com/forum/index.php?webtag=MOI&msg=7777.1772

- Brian
From: pressure (PEER)
23 Sep 2022   [#26] In reply to [#24]
Michael,

Thanks for telling me about these factories. When I search across all text files in the package contents I don't find these. The only place they seem to be mentioned is in moi_lib.dylib. Is that right, or am I missing some .js or .htm in my search?
From: Michael Gibson
23 Sep 2022   [#27] In reply to [#26]
Hi Peer,

re:
> Thanks for telling me about these factories. When I search across all text files in the
> package contents I don't find these. The only place they seem to be mentioned is in
> moi_lib.dylib. Is that right, or am I missing some .js or .htm in my search?

No, they just are being used only by the core C++ code and not being used by scripts.

The internal C++ code can call the same functions that scripts can, and sometimes it's convenient for things that are happening not inside the context of a "command" to be run that way.

For these functions on the object properties dialog, they have to be prepared that it may take some time to number crunch out the result. If they take more than 1 second a "Calculating..." dialog is shown which will let you cancel it. That cancel dialog functionality is set up inside the C++ side with the entry point being moi.ui.propertiesPanel.calcCurveLength() , moi.ui.propertiesPanel.calcSurfaceArea() , or moi.ui.propertiesPanel.calcSolidVolume().

Because you can work with the object properties dialog while you are not running inside a command, the regular command infrastructure was not as suitable for this particular functionality.

- Michael
From: bemfarmer
23 Sep 2022   [#28]
??, Statements which may or may not be correct:
By my limited understanding, a Factory is part of a user interface method, which connects Javascript .js and also .html, to MoI proprietary C++ code.
The associated C++ code is the factory / does the work of the factory.
Javascript code creating the factory, is inputting parameters into the associated factory C++ code.
With the factory, the user can access, or instruct, the work done by the C++ factory, with Javascript .js code. (Within the limitations of the factory instructions/inputs.)
As users, we do not directly mess with the C++ code. It is proprietary, and not permitted by user licensing agreement, which is as it should be.
Programming the C++ code is Michaels prerogative. (I wouldn't have a clue how to do c++ programming anyway :-) )
???
It is nice to be able to do Javascript scripts, to accomplish other tasks.

There is other user interface code which is not a factory. (?)
There is other, non-factory, interface code, which could be useful when creating scripts.(?)

I guess that API documentation, or Scripting documentation, is/ could be/ should be, more than just Factory documentation?

- Brian
From: Michael Gibson
23 Sep 2022   [#29] In reply to [#28]
Hi Brian,

re:
> I guess that API documentation, or Scripting documentation, is more than just Factories?

Yes, that's true.

Geometry factories are just one part of the whole system, like you wrote above a geometry factory is something set up to assist making commands. They are set up so that you can basically connect a UI control with a factory input ("binding") and then when the UI control is modified the factory will update and recalculate the result and deal with a bunch of things like deleting any previous results and restoring the original objects if the command is canceled and stuff like that.

That's quite a bit of stuff that many command scripts would need to do so it's helpful if that can be packaged up so that each command script doesn't have to those things themselves.

- Michael
From: pressure (PEER)
23 Sep 2022   [#30] In reply to [#27]
Michael,

So, should I include these factories, or will trying to use them in a custom javascript command cause problems?

arrow3d
backgroundimagerotatewheel
baserectangle
calcarea
calclength
calcvolume
drag
dragpointoncurve
labelpoint
objectframerotate
objectframerotatewheel
objectframescale
pdfencoding
scalenonuniform
From: pressure (PEER)
23 Sep 2022   [#31] In reply to [#25]
Brian,

An updated version of the API documentation is attached. Let me know if you find any problems.

If you remember any good forum posts or example code that belongs in here let me know.

EDIT: see below for new version
From: Michael Gibson
23 Sep 2022   [#32] In reply to [#30]
Hi Peer,

re:
> So, should I include these factories, or will trying to use them in a
> custom javascript command cause problems?

arrow3d - this one can be used by a script.
backgroundimagerotatewheel - this one is internal only and can't be created by a script command
baserectangle - this is a base class for the rectangle and rectcenter factories, it can't be created by itself
calcarea - could be used by a script
calclength - could be used by a script
calcvolume - could be used by a script
drag - could be used by a script
dragpointoncurve - internal only can't be created by a script command
labelpoint - factory name is just "label", could be used by a script
objectframerotate - could be used by a script, maybe
objectframerotatewheel - could be used by a script, maybe
objectframescale - could be used by a script, maybe
pdfencoding - there isn't a factory with this name
scalenonuniform - could be used by a script

But some of these are made for specific circumstances like the object frame and drag ones and it's possible they might not be able to do anything outside of that.

- Michael
From: bemfarmer
23 Sep 2022   [#33] In reply to [#31]
Hi Peer,

Had a brief little peek, due to time constraints, of your v5 API documentation.

Your API work in progress is very impressive.

Will study it more, in the next few days.

- Brian
From: bemfarmer
23 Sep 2022   [#34] In reply to [#31]
Hi Peer,

Blend has an Input 5:
https://moi3d.com/forum/index.php?webtag=MOI&msg=6955.5

List of asynchronous factories:
https://moi3d.com/forum/index.php?webtag=MOI&msg=6087.39

Dealing with 'special lightweight "proxy" object', (arraydir factory and other array factories):
https://moi3d.com/forum/index.php?webtag=MOI&msg=6087.47

ArrayGem
https://moi3d.com/forum/index.php?webtag=MOI&msg=6087.35
"ArrayGem needs both a curve and a surface that the curve is on - the surface normal is used to..."

Flow:
FlowExtendSrf.js uses the Flow factory, in one implementation:
https://moi3d.com/forum/index.php?webtag=MOI&msg=9747.21

The chainmaker script uses Flow factory. And Twist.
And flow.js shows the inputs as well.

Flow vs History:
https://moi3d.com/forum/index.php?webtag=MOI&msg=9278.2

- Brian
From: Michael Gibson
24 Sep 2022   [#35] In reply to [#31]
Thanks for putting this together Peer!

- Michael
From: pressure (PEER)
3 Nov 2022   [#36] In reply to [#34]
Thanks Brian for the links and also thanks to Pilou for archiving the entirety of the original API documentation page, to Cemortan_Tudor for translating the 2015 .idl into .js, and to Michael for many clarifications.

Here's the latest version. The .txt explains how to edit the .html and the .docx lists changes that I've made.

If you make any improvements to the documentation please post them here or PM me and I'll replace this version with your update.

EDIT: May 12, 2023 - updated API documentation to have .htm file extension rather than .html, to include a section on HTM tags, to correct some errors, and to add new classes. Change log and editing instructions also updated

EDIT: May 16, 2023 - updated dump() function in Hints and factory inputs and examples

EDIT: May 26, 2023 - All factory inputs, properties, and methods updated. Factory examples added. Bug in dump() function fixed. geomObject properties and methods updated. Thanks MO for all your contributions!

EDIT: September 1, 2023 - added description of calculateCurveOrientations() from MO and Michael.

- Peer

Attachments:
generateFactoryHTM.js
how_to_edit_API_doc.txt
moi_api_changelog.docx
MoI_v5_API_Documentation.htm


From: bemfarmer
8 Nov 2022   [#37] In reply to [#36]
Hi Peer,

Additional Extrude inputs, (By Michael), are here:
https://moi3d.com/forum/index.php?webtag=MOI&msg=9919.6

Also, example of cap ends should be input 5.

- Brian
From: pressure (PEER)
9 Nov 2022   [#38] In reply to [#37]
Thanks Brian for the link and for pointing out the error in the example. I'll make these changes next time I update the documentation.

Show messages:  1-18  19-38  39-47