C API, Scripting Interface, Python, Other Langs
 1-20  21-30

Next
 From:  jeff (JSPRENGER)
10720.1 
Is there an API for MOI4?

I've seen some posts about a Javascript API from D. MORRILL, and those links are broken - long gone.
Also, mirroring of that site is broken.

I want to automate some of the CAD operations and to export data regarding objects.

Can someone provide details on how to run javascript from MOI (command link, and a few samples files)?

For the product author: What about a license for MOI SDK, allowing people to develop their own CAD-based applications that would use the MOI engine?

Thanks,

Jeff


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10720.2 In reply to 10720.1 
Hi Jeff,

re:
> Is there an API for MOI4?

Sorry no there is not currently a documented API for MoI.

There is an undocumented internal API used by scripts (using the JavaScript language)
and it is possible to learn it despite the lack of documentation, because it is used by
current commands to control the workflow and UI. You can find the scripts for current
Moi commands in the commands folder inside the main install.

There is also a little bit of information here:
https://moi3d.com/wiki/Scripting


re:
> Also, mirroring of that site is broken

You can find it in the Internet Archive:
https://web.archive.org/web/20191220163342/http://moi.maxsm.net/api


re:
> Can someone provide details on how to run javascript from MOI (command link, and a
> few samples files)?

The main examples are the regular commands that ship with MoI, they are in the
commands folder.


re:
> For the product author: What about a license for MOI SDK, allowing people to develop their
> own CAD-based applications that would use the MOI engine?

Unfortunately there is a significant amount of work, time, and effort required to do that. Currently
my time is very occupied just developing regular end-user facing features in MoI. That's why an SDK
has not been a focus area as of yet.

At some point I would like to work on that area but it has not been a priority as of yet.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10720.3 In reply to 10720.1 
Hi Jeff,

In my Gyroid, D & P surface posts, point data can be exported to Python, mathematically manipulated using advanced Python math and functions, and re-imported into MoI.
The Point sets can represent curves, from which surfaces can be generated.

MoI Javascript is the older ECMAScript 2009, also known as ES5, not ES6 nor later versions, so "regular" math functions are available in Javascript, but "exotic" math functions are not available.

Over a year ago I searched the internet for D Morrill, but found nothing for the past several years.

- Brian.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  wayne hill (WAYNEHILL5202)
10720.4 
ES6 can be converted to ES5 using this Babel compiler. Some things will not convert cleanly.

https://babeljs.io/

Use the 'Try it out' menu for the conversion area.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
10720.5 In reply to 10720.1 
I grabbed a local copy way back when.

Unzip and Put this folder in your APPDATA folder of the MoI install, then add this line to where you want a button to launch it. I use Sidepane.htm, just under "History" entry... (Note, I made my own icon i included here as a png. You can replace your own and change the line in the code for the new named icon..

code:
<td><vcenter><moi:CommandButton icon="icons/dmorril.png" onbuttonclick="moi.filesystem.shellExecute( moi.filesystem.getAppDataDir() + 'moi_ref\\index.htm' );">JavaScript ref</moi:CommandButton>
                                  </vcenter>      </td>





[EDITED: to change code data from old create dialogue to external html handeler. Works like a charm!]

EDITED: 8 Jun 2022 by BURRMAN


Image Attachments:
Size: 11.6 KB, Downloaded: 38 times, Dimensions: 64x64px
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10720.6 In reply to 10720.5 
Thanks Burr, I added a link to your post above on https://moi3d.com/wiki/Scripting .

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
10720.7 In reply to 10720.6 
Sure!

Keeping Max in my heart.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10720.8 In reply to 10720.7 
Thank you Burr.

On Windows 11, the Flask icon was successfully added to the MoI icon file, as well as the API htm file to the ui directory, MoI 4.
Only the initial index API screen comes up after clicking on the flask. Selecting a factory does not show the factory details screen. Windows 11 says that a new app is needed.
The Microsoft store has 100 file viewers. Did not download any due to potential hacking. Is there a certain APP to download to access the subscreens?
Do the subscreens come up in Windows 10?


(Also tried Max's 318 kb html file. Had to use .html, not .htm. But still no subscreens.)
(External to MoI, the Edge browser opens the htm(l) files with subscreen access.)

- Brian

Some newer factories have documentation by Michael on the forum.
e.g. Network.
offset factory has more details from Michael on the forum, than D Morrill's API.

EDITED: 7 Jun 2022 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10720.9 In reply to 10720.8 
Hi Brian, in the launcher button try changing the onbuttonclick="" attribute to this instead:

onbuttonclick="moi.filesystem.shellExecute( moi.filesystem.getUIDir() + 'moi_ref\\index.htm' );"

That should open it up in the system web browser when you click it.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10720.10 In reply to 10720.9 
Thank you Michael.

Your code was successful. Omitted the window resizing. Maximize/reset button in API screen changes window size, or drag. MoI 4 remembers the size.

- Brian

Do not know if some of the files of this modification should be in appdata?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10720.11 In reply to 10720.10 
Hi Brian,

re:
> Do not know is this modification should be in appdata?

You could put it there if you wanted. If you put it inside the appdata folder, change the script to call moi.filesystem.getAppDataDir() instead of moi.filesystem.getUIDir() .

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10720.12 In reply to 10720.11 
Thanks Michael.

Great API access addition by Burr.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  jeff (JSPRENGER)
10720.13 
Wow! Amazing responses from the community. I will sift through the docs and give this a go.

Michael,

I would like to say how much I like using MOI4. My work is in robotics modeling and simulation, and I find MOI is my quick go-to for creating simple parts and fixtures in 3D.
Among others, I've used SolidWorks, Fusion360, Rhino, SolverSpace, FreeCAD. Moi is, by far, the easiest and most intuitive to use with the seamless merging of 2D sketching and 3D construction tools for extrude, revolve and diff. Of course, I have a bunch of feature requests, but I can see that you're quite busy with your current load - so I'll hold off.

Thanks all for the help.

Jeff
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  jeff (JSPRENGER)
10720.14 In reply to 10720.13 
@BurrMan

I followed you instructions and now have the docs integrated. Thanks for providing that.
Image Attachments:
Size: 359.5 KB, Downloaded: 76 times, Dimensions: 1804x1204px
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  jeff (JSPRENGER)
10720.15 
A quick update.

Here's my quick hack to add a new sub-panel that will hold docs and automation scripts for me.
(video attached)
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
10720.16 In reply to 10720.15 
Cool UI result!
---
Pilou
Is beautiful that please without concept!
My Moi French Site My Gallery My MagicaVoxel Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
10720.17 
Hey Brian,

Yeah, i discovered that here too. Michael had fixed it.

I also like the idea of moving it to the appdata directory!

So i will make the changes to my sidepane code, and when i am sure i have done it correctly, i will update my original post code example, so i don't lead anybody astray....

If you have already created that line properly, maybe put it here so i can copy and paste it???

[EDIT: I have changed my original post here to fix "code" error]

EDITED: 8 Jun 2022 by BURRMAN

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
10720.18 In reply to 10720.8 
"""""""Some newer factories have documentation by Michael on the forum.
e.g. Network.
offset factory has more details from Michael on the forum, than D Morrill's API."""""""""

Yes. This doc is fairly old. It was derived from the old IDL file MoI had with it.

Alot has changed since then. But this doc is a great ""overview" so to speak. It has to be used with that understanding...
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10720.19 In reply to 10720.17 
Hi Burr,

Your MoI4 sidepane modification is just right.

Note to others: The change is located at line 143 +/- of MoI4 sidepane.htm file, replacing pre-existing spaceholders td and /td.
Below History, as per Burr.
Windows 10 or 11, MoI4 files located below program files directory.

The moi_ref file now located in appdata directory.

For my version, I changed the name of the flask Icon from dmorrill.png to API_Icon.png, and the flask command button name from JavaScript ref to API ref. spacesaving
Totally unnecessary changes. Burr's code is just fine.

- Brian

EDITED: 8 Jun 2022 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10720.20 
Burr's API modification works fine in MoI 5 beta, May 22, 2022.

It took about 2 minutes to copy the Icon, and modify the MoI 5 beta sidepane htm file (line 143 in notepad++).

AppData was already set up for the mod.

- Brian

I wonder what sort of editor was used by D Morrill to create the API?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-20  21-30