MoI discussion forum
MoI discussion forum

Full Version: Exploration of Scripting in MOI

Show messages: All  1-4  5-8

From: Michael Gibson
10 Sep 2019   [#5] In reply to [#4]
Hi Dave, for select all try:

moi.geometryDatabase.selectAll();

If you want to do something that is in the regular UI you can look in the .htm files in the UI subfolder to see what it's doing. Most stuff is in SidePane.htm so for example if you search in there for "SelectAll" that would take you to a button with with some script on it's onclick="" handler with the above code in it.

Also if you have your code above in its own .js file you can leave off the "script:" parts in front, that's something that you can put in the start of a shortcut key definition to tell the shortcut key processor that it's a chunk of script code in the shortcut key instead of a command name.

- Michael
From: 3d2cnc
13 Sep 2019   [#6] In reply to [#5]
Hi Michael,

That information was very useful. Thank-you so much.

Have setup hotkeys for the scripts that are working thus far.



Unsuccessfully trying to Imitate your " Include Edge Option " in the Silhouette Script.

Currently cannot get the objects edges silhouette to happen correctly.

Hoping to avoid using the sidepane silhouette icon and having to select "Include edges" checkbox.

Looking for easier solution to script that "Include Edge Option" .

Any tips on what steps to take?

P.S.
Moi has been great for designing structures. "Quickly". Although I haven't used it for any piping designs as of yet, but it looks like a snap.

Dave

Image Attachments:
16x24x8 basic.png 


From: 3d2cnc
13 Sep 2019   [#7] In reply to [#6]
So far coming out of this endeavor to create this proposed script is...

Combining the freehand from two axis planes, loft and use this

well, create a terrain map on an object?

Attachments:
sil-edge-dev2.3dm

Image Attachments:
sil-edge-dev2.png  topo-mapping.png 


From: Michael Gibson
13 Sep 2019   [#8] In reply to [#6]
Hi Dave, that's great that you're making good progress!

So for include edges the way to figure out how to replicate that in a script is to first look at the Silhouette.htm file and find the "Include edges" button which is this:

code:
<moi:CheckButton id="includeedges"><moi:Text textid="Include edges checkbox"/></moi:CheckButton>


The key thing that you're looking for is the id value. So then go to the Silhouette command script file (Silhouette.js) and search for includeedges, which is this:

code:
ui.bindUIToInput( 'includeedges', 'value', factory.getInput(4) );


So what the regular command is doing there is making a link between the includeedges checkbox UI controls's value property and the silhouette factory's input with index 4.

In your script you'd want to do something like factory.setInput( 4, true ); to turn it on.

Some UI will set up a binding like that and others will look for a UI event of that id value being triggered if they need to do other stuff in addition to just setting a value on the factory.

Hope that helps!

- Michael

Show messages: All  1-4  5-8