Triple Squid Software Design
6729 25th Avenue NW
Seattle, Washington 98117
USA

   web: http://moi3d.com ¦ http://moi3d.com/wiki
forum: http://moi3d.com/forum
e-mail: moi@moi3d.com


Documentation & other

Beta realease notes: V1 ¦ V2 ¦ V3 Video tutorial Mentions… Companions Links
Version 2.5 OSX beta release notes: 2.5

Inline scripts

Instruction Handling view Selecting Display Hiding CLine Browser Other

Custom commands

Measure Distance Constraint Polyline Import Point File Save Point File
Copy To Points Select By Type Spur Gear Profile ReconstructCurves
Scale Array Cross Section Nudge Batch processing
Close Curves Pipe
Ring Circle Import Folder Quick Circle
ToroidalHelix SineWave CustomRevolve
CenterAtOrigin MoveSliceToPoint ConnectPoints
LineMorph BisectorLine
MarkOpenCurveStartV2 HideClickedV2 LineWeb (+update)V2
AssignNameV2 AssignPresetNameV2 Intersect2Circles
Quick Splitting AutoRotate CycleSelect

UI

Clock Bar Full Screen without UI Plugin Gallery Osnap toolbar
CustomUI CustomUI 2 View Controls Reverse Button
Modified Text Command

Stand alone utilities

Obj23dmWireframe converter OBJ file editor Merge OBJ utility Relabel OBJ utility
3dmCurves2DXF converter Blender importer Other…

List of commands without UI button

Incremental save
Rebuild
Flip
Merge
ArrayGem
ExplodeMove
BoundingBox
BoundingBoxCenter
ShrinkTrimmedSrf

Scripting projects by David C. Morrill

Moment of Inspiration Javascript Documentation
MoI external scripting interface

Inline Scripts

You can put the following scripts as a keyboard shortcuts. To define them, open Option dialog window, go to Shortcut keys section, push the "Add" button there which will insert a new blank shortcut key; click in the "Key" column and add the key you want to use to activate it, like "H" for example; then click in the "Command" column and paste in the script line _or_ open the moi.ini file (C:\Documents and Settings\[your user name]\Application Data\Moi\moi.ini) and edit directly the [Shortcut Keys] section. Just assign some key (e.g. K, Space) or key combinations (e.g. Ctrl+U, Alt+E) or function key (e.g. F5). The code for shortcut should be one long single line. Simple shortcuts can be found in moi_hotkey.txt file.


Note: for keyboard shortcus that have script code in them, you can put a comment in the code with a note in it. You put in a text surrounded by /* */ , just after the script: part – see MoI forum for example.


Zoom & Pan – the way this version works is it will do it on the viewport the mouse is currently over. If the mouse is not currently over a viewport, it will use the one that last had a click in it, or if there is just one single viewport maximized it will use that one.

Ctrl+LeftArrowscript:moi.ui.getActiveViewport().Pan( -1, 0 );
Ctrl+RightArrowscript:moi.ui.getActiveViewport().Pan( 1, 0 );
Ctrl+UpArrowscript:moi.ui.getActiveViewport().Pan( 0, 1 );
Ctrl+DownArrowscript:moi.ui.getActiveViewport().Pan( 0, -1 );
PageUpscript:moi.ui.getActiveViewport().Zoom( 0.9 );
PageDownscript:moi.ui.getActiveViewport().Zoom( 1.1 );

ZoomArea – trigger the area zoom on the viewport that the mouse is over.

Zscript:var v = moi.ui.getActiveViewport(); if ( v ) v.interactiveViewChange('zoomarea');

ZoomExtents: It works the same as the reset button. It will zoom extents to the selected objects the first time you activate it, and if you do it a second time it will zoom extents to everything:

#1 to zoom extents all view

Zscript:moi.view.resetAll();

#2 for zooming extents for just one single viewport instead of all of them – it will zoom the active view it means the viewport under the mouse or the one that last had a click in it.

Alt+Zscript:moi.ui.getActiveViewport().reset();

#3 to zoom extens for just one single viewport that the mouse is over or zoom extents all view if the mouse is not currently over a viewport.

Ctrl+Zscript:var viewport = moi.ui.getViewportUnderMouse(); if ( viewport ) { viewport.reset(); } else { moi.view.resetAll(); }

RotateView – this allows rotating the 3D view with the arrow keys. To do this, use these keyboard shortcuts:

UpArrowscript:moi.ui.mainWindow.viewpanel.getViewport('3D').rotate( 'up', 6.0 );
DownArrowscript:moi.ui.mainWindow.viewpanel.getViewport('3D').rotate( 'down', 6.0 );
LeftArrowscript:moi.ui.mainWindow.viewpanel.getViewport('3D').rotate( 'left', 6.0 );
RightArrowscript:moi.ui.mainWindow.viewpanel.getViewport('3D').rotate( 'right', 6.0 );

MaximizeViewport – switches viewport under the current mouse cursor location between respective split and top(bottom)/front(back)/right(left)/3D view.

Spacescript:if ( moi.ui.mainWindow.viewpanel.mode != 'split' ) { moi.ui.mainWindow.viewpanel.mode = 'split' } else { var viewport = moi.ui.getViewportUnderMouse(); if ( viewport ) viewport.viewpanel.mode = viewport.name; }

ReverseViewport – reverses all viewports (Top-Bottom, Front-Back, Right-Left and vice versa).

Wscript:var viewport = new Array( 'Top', 'Front', 'Right' ); for ( a in viewport ) { moi.ui.mainWindow.viewpanel.reverseView( viewport[a] ) }

You can also set this scripts up to reverse a specific view, for the parameter use 'Top', 'Front', or 'Right':

Tscript:moi.ui.mainWindow.viewpanel.reverseView( 'Top' );

Or if you want to reverse the view that the mouse is currently over, this one will do that:

Tscript:moi.ui.mainWindow.viewpanel.reverseView( moi.ui.getActiveViewport().name );

MoveTargetToObjectsV2 – Rhino-like command; moves a viewport target's position to the center of the bounding box of selected objects.

Alt+Qscript:var objs = moi.geometryDatabase.getSelectedObjects(); if ( objs.length > 0 ) { moi.ui.mainWindow.viewpanel.getViewport('3D').targetPt = objs.getBoundingBox().center; }

SetView

Various scripts for switching views – see this post.


Set View Angle – sets specific view angles by a shortcut key;
Up/down angle controls the vertical angle, 0 is at the top looking straight down.
Left/right angle controls horizontal angle, 0 is looking straight forward, 90 is looking from the right, etc.
Tilt controls twisting to the left or right along the current view direction.

Shift+Vscript:var v = moi.ui.mainWindow.viewpanel.getViewport('3D'); v.leftRightAngle = 45; v.upDownAngle = 90; v.tiltAngle = 0;

Set Isometric

Iscript:var vp = moi.ui.mainWindow.viewpanel.getViewport('3D'); vp.projection = 'Parallel'; vp.setAngles( 90 - (Math.asin(Math.tan(30 * Math.PI/180)) * 180/Math.PI), 45 );

SetDimetric

Dscript:var vp = moi.ui.mainWindow.viewpanel.getViewport('3D'); vp.projection = 'Parallel'; var as13 = Math.asin(1/3); vp.setAngles( 90 - (Math.asin(Math.tan(as13)) * 180/Math.PI), as13 * 180/Math.PI );

Return to Perspective view

Pscript:var vp = moi.ui.mainWindow.viewpanel.getViewport('3D'); vp.projection = 'Perspective';

Set camera by eye and look at points – That should set the 3D view direction given an eye point and a "look at" point. Substitute your camera coordinates for the eye which above is set at 10,10,10 and also substitute your look-at coordinates which are set to 0,0,0 above.

Pscript: /* set camera by eye and lookat points */ var vm = moi.vectorMath; var eye = vm.createPoint( 10, 10, 10 ); var lookat = vm.createPoint( 0, 0, 0 ); moi.ui.mainWindow.viewpanel.getViewport( '3D' ).setCameraAndTarget( eye, lookat );

Match horizontal view angle – for converting a full horizontal angle of view into what MoI uses, try the following script – there are 3 values to substitute:
horiz_angle = 40 replace with your horizontal angle of view
width = 1024 replace with your rendered image pixel width
height = 768 replace with your rendered image pixel height

Pscript: /* match horizontal view angle */ var horiz_angle = 40; var width = 1024; var height = 768; var x = Math.tan( (horiz_angle/2) * (Math.PI/180) ); x *= height / width; var central_angle = Math.atan( x ) * 2 * (180/Math.PI); moi.ui.mainWindow.viewpanel.getViewport('3D').fieldOfViewAngle = central_angle;

Then render image to clipboard using CaptureViewToClipboard.


Set top viewport zoom to 1 pixel = 1 unit – the pixel dimensions of the viewport are not currently accessible to scripts, so you'll need to find some other way of getting that info – maybe try a screen capture utility and see what size image it grabs from a viewport window or if you have Visual Studio installed use Spy++ from there to find the pixel width and height of the viewport's window.
Then plug in the smaller of the width and height into this script, putting that number in place of where it says 482 currently.

Pscript: /* Set top viewport zoom to 1 pixel = 1 unit */ var viewport_pixel_size = 482; var vp = moi.ui.mainWindow.viewpanel.getViewport('Top'); vp.fieldOfViewAngle = viewport_pixel_size;

Set that script up on a shortcut key and then when you trigger it, it should zoom the top viewport to be 1 pixel = 1 unit.
Note that if you do anything that changes the viewport size like sizing the main window or switching from split view to a maximized top view, that it will no longer be 1 pixel = 1 unit after that.

SwitchingOverViewsJacob's script to switch views.

Nscript: /* switching over views */ var views = ["split", "3d", "top", "front", "right"]; var vp = moi.ui.mainWindow.viewpanel; var current = vp.mode; for (var i = 0, len = views.length; i < len; i++) {if (current == views[i]){ vp.mode = views[(i+1)%len]; }}

SelectStyleV2 – The main method for selecting by style is to use the browser by clicking on the text part of the style name. But you can do it by using this script as well – it will expand the selection to include all objects of the same style as one that is currently selected. To use that, first select an object from the style you want to target, then hit the key to trigger that script and all the other objects of that same style will be added to the selection.

Nscript: /* Expand selection over same styles */ var objects = moi.geometryDatabase.getObjects();var styles = new Array();for ( var i = 0; i < objects.length; ++i ) { var obj = objects.item(i); if ( obj.selected ) styles[obj.styleIndex] = true; } for ( var i = 0; i < objects.length; ++i ) { var obj = objects.item(i); if ( styles[obj.styleIndex] ) obj.selected = true; }

This script currently will only look at "top-level" objects, it won't go into sub-objects like faces or edges that may have different styles on them.


ExtendSelectionToSameNamesV2 – it will go through and select any objects which have the same name as one that is already currently selected. Also see modified version.

Mscript: /* Extend selection to same names */ var names = new Array(); var objs = moi.geometryDatabase.getSelectedObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if ( obj.name != '' ) names[obj.name] = true; } objs = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if ( obj.name != '' && names[obj.name] ) obj.selected = true; }


SelectTinyV2 – it will select all objects that are smaller than 1 unit in size (by bounding box diagonal). To adjust the size, edit the part that says size = 1.0 and change the 1.0 to whatever number that you want.

Nscript: /* Select objects smaller than the given size */ var size = 1.0; var objs = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); var bbox = obj.getBoundingBox(); if ( bbox.diagonalLength < size ) obj.selected = true; }

SelectLongestCurveV2 – script that just selects the longest curve; it will look through all curves that are not hidden or locked, so if you have some curves that you don't want to have considered lock or hide those before running the script.

Nscript: /* select longest curve */ var curves = moi.geometryDatabase.getObjects().getCurves(); var maxlen = -1; var maxcrv = null; for ( var i = 0; i < curves.length; ++i ) { var crv = curves.item(i); if ( crv.hidden || crv.locked ) { continue; } var thislen = crv.getLength(); if ( thislen > maxlen ) { maxlen = thislen; maxcrv = crv; } } if ( maxcrv != null ) maxcrv.selected = true;

SelectShortestCurveV2 – same as script above except it will select the smallest curve instead.

Nscript: /* select shortest curve */ var curves = moi.geometryDatabase.getObjects().getCurves(); var minlen = 1e100; var mincrv = null; for ( var i = 0; i < curves.length; ++i ) { var crv = curves.item(i); if ( crv.hidden || crv.locked ) { continue; } var thislen = crv.getLength(); if ( thislen < minlen ) { minlen = thislen; mincrv = crv; } } if ( mincrv != null ) mincrv.selected = true;

SelectNakedEdgesV2 – it deselects all objects and highlight all edges that are not joined so that can help to show you what parts of an object are the ones stopping it from being a closed solid (watertight object).

Nscript:var gd = moi.geometryDatabase; gd.deselectAll(); var breps = gd.getObjects().getBreps(); for ( var i = 0; i < breps.length; ++i ) breps.item(i).getNakedEdges().setProperty( 'selected', true );

SelectVisibleV2 – when you push the key that you assigned the shortcut to, it will select the visible objects. These are all the objects that have any part of them visibly displayed on any viewport that is showing – these are all objects that would have been accessible by a click type selection. See forum.

Shift+Vscript:moi.geometryDatabase.selectVisible();

SelectParents – if you have an object selected, it switches selection to all the parents that were input into the making of that object. So for example if you select a lofted surface, after you run that script the original curves that went into the loft will be selected.

Shift+Pscript:var gd = moi.geometryDatabase; var objs = gd.getSelectedObjects(); gd.deselectAll(); for ( var i = 0; i < objs.length; ++i ) { var parents = objs.item(i).getHistoryParents(); parents.setProperty( 'selected', true ); }

SelectChildren – if you have an object selected, it switches selection to the children that were made as a result of using of that object. So for example if you select one of the original curve of lofted surface, after you run this script the lofted surface, which was created using that curve, will be selected.

Shift+Cscript:var gd = moi.geometryDatabase; var objs = gd.getSelectedObjects(); gd.deselectAll(); for ( var i = 0; i < objs.length; ++i ) { var children = objs.item(i).getHistoryChildren(); children.setProperty( 'selected', true ); }

SelectLastCommandCreated – selects all the objects that were generated by the last command. So for instance after finishing Array you can hit the shortcut key with this script on it, and all the results of the array will be selected.

Lscript:var a = moi.command.lastCommandRevisionStart; var b = moi.command.lastCommandRevisionEnd; var objects = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objects.length; ++i ) { var obj = objects.item(i); if ( obj.databaseRevision > a && obj.databaseRevision <= b ) obj.selected = true; }

If you would always like to have the created objects be the exclusively selected objects (with everything else deselected) instead of being added to the current selection, then use this script instead:

Lscript:moi.geometryDatabase.deselectAll(); var a = moi.command.lastCommandRevisionStart; var b = moi.command.lastCommandRevisionEnd; var objects = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objects.length; ++i ) { var obj = objects.item(i); if ( obj.databaseRevision > a && obj.databaseRevision <= b ) obj.selected = true; }

SelectCurves – selects all curves.

Cscript:moi.geometryDatabase.getObjects().getCurves().setProperty( 'selected', true );

SelectClosedCurves – selects all closed curves.

Qscript:var curves = moi.geometryDatabase.getObjects().getCurves(); for ( var i = 0; i < curves.length; ++i ) if ( curves.item(i).isClosed ) curves.item(i).selected = true;

SelectOpenCurves – selects all open curves.

Oscript:var curves = moi.geometryDatabase.getObjects().getCurves(); for ( var i = 0; i < curves.length; ++i ) if ( !curves.item(i).isClosed ) curves.item(i).selected = true;

SelectCompoundCurvesV2 – selects all curves that are made up of more than 1 sub-segment.

Oscript:var crvs = moi.geometryDatabase.getObjects().getCurves(); for ( var i = 0; i < crvs.length; ++i ) { var crv = crvs.item(i); if ( crv.getSubObjects().length > 1 ) crv.selected = true; }

SelectUnnamedObjectsV2 – when you hit that key you should end up with only all the unnamed objects selected. One note – this version will not select any hidden or locked objects, those will remain hidden or locked.

Uscript:var gd = moi.geometryDatabase; gd.deselectAll(); var objects = gd.getObjects(); for ( var i = 0; i < objects.length; ++i ) { var obj = objects.item(i); if ( obj.name == '' ) { obj.selected = true; } }

SelectClosedBReps – selects all closed surfaces or polysurfaces.

Bscript:moi.geometryDatabase.getObjects().getSolids().setProperty( 'selected', true );

DeselectRandomObjectsV2 – Select objects first then trigger shortcut. You can change the value for the percent = 30 part in the script to adjust keeping more or fewer objects selected when it is triggered. It won't give you exactly 30% of objects to remain selected, because it goes just object by object and gives each object by itself a 30% chance of remaining selected. But it should give a result somewhere close to 30% of the objects remaining selected.

Bscript: /* Deselect random objects */ var percent = 30; var objs = moi.geometryDatabase.getSelectedObjects(); for ( var i = 0; i < objs.length; ++i ) { if ( Math.random() * 100 > percent ) objs.item(i).selected = false; }

SwitchSelectionFromFaceToEdges – this script switches selection from a selected face to its edges.
So for example, after you have your faces selected (either from their intiail selection or by using the Scene browser Style section to select them), trigger that script and then the edges that belong to those faces will get selected and you can then apply the style to them.

Shift+Sscript: /* switch selection from a face to its edges */ var gd = moi.geometryDatabase; var faces = gd.getSelectedObjects().getFaces(); gd.deselectAll(); for ( var i = 0; i < faces.length; ++i ) faces.item(i).getEdges().setProperty( 'selected', true );

RandomizeStyleColors – it is possible for scripts to access the color of styles. So for example here is a script that will set styles to randomized colors:

Alt+Vscript: /* Randomize style colors */ var styles = moi.geometryDatabase.getObjectStyles(); for ( var i = 0; i < styles.length; ++i ) { var style = styles.item(i); var red = Math.random() * 255; var green = Math.random() * 255; var blue = Math.random() * 255; style.color = (red << 16) | (green << 8) | blue; }

LightingOptions – it is possible to control all of the lighting options from a shortcut key script; see MoI forum and a few setting examples.


CaptureViewToClipboard – this render a larger image of the active viewport and copy it to the clipboard; you can possibly adjust the resolution and the line width – see MoI forum.

Alt+Vscript:var v = moi.ui.getActiveViewport(); if ( v != null ) { moi.view.lineWidth = 4; v.renderToClipboard( 2560, 2560 ); moi.view.lineWidth = 1; }

CaptureScreenToFile – you can use this script to save a screenshot out to an image file by using a shortcut key, without needing to run any other program.

Alt+Sscript:var img = moi.view.screenshot( 'viewpanel', false ); var name = img.getSaveFileName(); if ( name != '' ) img.save( name );

ViewStack – if you're looking for something like the "named views" mechanism in Rhino, you can try this set of scripts.


ToggleLightDirection – toggles the light direction, between the standard and alternate one.

F6script:var dir = moi.view.lightDirection; if ( dir.x == 1 && dir.y == 1 && dir.z == -1 ) { dir.set(-0.5,1,0); } else { dir.set(1,1,-1); } moi.view.lightDirection = dir;

ToggleHiddenLine – to toggle hidden line display on or off quickly.

Tscript:moi.view.showHiddenLineCurves = !moi.view.showHiddenLineCurves; moi.view.showHiddenLineEdges = !moi.view.showHiddenLineEdges;

ToggleHiddenLineV2 –to toggle hidden line for V2 use this modification.

Tscript:moi.view.showHiddenLines =! moi.view.showHiddenLines;

Temporary Shaded Display Mode (without edges) – to turn on or off edge display.

Alt+Sscript:var breps = moi.geometryDatabase.getObjects().getBReps(); var hide = true; for ( var i = 0; i < breps.length; ++i ) { var edges = breps.item(i).getEdges(); if ( i == 0 ) hide = !edges.item(0).hidden; edges.setProperty( 'hidden', hide ); }

Temporary WireFrame Display Mode – to turn on or off face display.

F12script:var breps = moi.geometryDatabase.getObjects().getBReps(); var hide = true; for ( var i = 0; i < breps.length; ++i ) { var faces = breps.item(i).getFaces(); if ( i == 0 ) hide = !faces.item(0).hidden; faces.setProperty( 'hidden', hide ); }

SetSelectedObjectToWireframeV2 – this one sets the selected objects to "wireframe" (faces hidden) mode.

F12script: /* Set selected object to wireframe */ var breps = moi.geometryDatabase.getSelectedObjects().getBreps(); for ( var i = 0; i < breps.length; ++i ) breps.item(i).getFaces().setProperty( 'hidden', true ); moi.ui.redrawViewports();

SetUnSelectedObjectToWireframeV2:

F12script: /* Set unselected objects to wireframe */ var breps = moi.geometryDatabase.getObjects().getBreps(); for ( var i = 0; i < breps.length; ++i ) { var brep = breps.item(i); if ( !brep.selected ) { brep.getFaces().setProperty( 'hidden', true ); } } moi.view.resetAll(); moi.ui.redrawViewports();

SetSelectedObjectToWireframe&LockV2 – this one sets the selected objects to "wireframe" (faces hidden) mode, and also locks the object as well.

F12script: /* Set selected object to wireframe and lock it */ var breps = moi.geometryDatabase.getSelectedObjects().getBreps(); for ( var i = 0; i < breps.length; ++i ) { breps.item(i).getFaces().setProperty( 'hidden', true ); breps.item(i).locked = true; } moi.ui.redrawViewports();

ToggleUnselectedObjectsToWireframeV2:

F12script: /* Toggle unselected objects to wireframe */ var breps = moi.geometryDatabase.getObjects().getBreps(); var didone = false; for ( var i = 0; i < breps.length; ++i ) { var brep = breps.item(i); if ( brep.hidden ) continue; if ( !brep.selected ) { var faces = brep.getFaces(); for ( var j = 0; j < faces.length; ++j ) { if ( !faces.item(j).hidden ) { faces.setProperty( 'hidden', true ); didone = true; break; } } } } if ( !didone ) { for ( var i = 0; i < breps.length; ++i ) { var brep = breps.item(i); if ( brep.hidden ) continue; brep.getFaces().setProperty( 'hidden', false ); } } moi.view.resetAll(); moi.ui.redrawViewports();

ShowAllEdgesOfVisObjsV2 – the script will only show edges on objects that are currently visible and not touch the edges on objects that are totally hidden.

F12script: /* Show all edges of visible objects */ var breps = moi.geometryDatabase.getObjects().getBReps(); for ( var i = 0; i < breps.length; ++i ) { var brep = breps.item(i); if ( !brep.hidden ) brep.getEdges().setProperty( 'hidden', false ); }

HideSeamEdge – it will hide seam edges of breps.

Alt+Shift+Iscript: /* Hide seam edges */ var breps = moi.geometryDatabase.getObjects().getBReps(); for ( var i = 0; i < breps.length; ++i ) breps.item(i).getSeamEdges().setProperty( 'hidden', true );

HideToHidden – hide selected objects, and assign to style = Hidden; see forum.

Alt+Shift+Iscript: /* Hide selected objects, and assign to style = Hidden */ var gd = moi.geometryDatabase; var styles = gd.getObjectStyles(); var si = -1; for ( var i = 0; i < styles.length; ++i ) { if ( styles.item(i).name.search( /hidden/i ) != -1 ) si = i; } if ( si == -1 ) { var style = gd.addStyle(); style.name = 'Hidden'; si = style.index; } var objects = gd.getSelectedObjects(); objects.setProperty( 'styleIndex', si ); objects.setProperty( 'hidden', true );

HideBckgImg – hide all visible / show all invisible background images.

Alt+Shift+Iscript:var images = moi.view.getBackgroundImages(); for ( var i = 0; i < images.length; ++i ) images.item(i).hidden = !images.item(i).hidden;

HideSwap – hides all visible objects and shows all previously hidden objects.

Xscript:var gd = moi.geometryDatabase; gd.deselectAll(); gd.hide( true ); gd.invertSelection(); gd.hide( true );

HideUnselected – hide all visible unselected objects. For V2 see Isolate.

Alt+Uscript:moi.geometryDatabase.invertSelection(); moi.geometryDatabase.hide( true );

HideCurves – hides all curves.

Shift+Hscript:moi.geometryDatabase.getObjects().getCurves().setProperty( 'hidden', true );

HideSurfaces – hides all surfaces.

Shift+Sscript:moi.geometryDatabase.getObjects().getBReps().setProperty( 'hidden', true );

HideSolids – hides all closed (poly)surfaces.

Shift+Qscript:moi.geometryDatabase.getObjects().getSolids().setProperty( 'hidden', true );

IsolateV2 – to isolate the current selection (hide everything else other than what is selected), right-click on Edit/Hide or use this script. This will remember the state of objects right before the isolate, and when you right-click on the button a second time the previous state will be restored.

Iscript: /* Isolate selection */ moi.geometryDatabase.isolate();

HideWithMemoryV2 – this shortcut key works like a kind of "hide with memory" (Invert selection + Isolate method together in just one keyboard shortcut, actually). Select an object and use the shortcut key to hide it, and then later on trigger the shortcut key a second time to restore the object to visible again.

Shift+Tscript:var gd = moi.geometryDatabase; gd.invertSelection(); gd.isolate();

KeepConstructionLine – keeps construction line, so it won't get erased at the end of the current command.

Kscript:moi.geometryDatabase.getObjects().getConstructionLines().setProperty( "isTemporary", false );

RemoveConstructionLines – removes all construction lines.

Ctrl+Kscript:var gd = moi.geometryDatabase; gd.removeObjects( gd.getObjects().getConstructionLines() );

RemoveLastAddedCline – you can set up this keyboard shortcut which will remove the last added construction line.

Alt+Kscript:var gd = moi.geometryDatabase; var clines = gd.getObjects().getConstructionLines(); if ( clines.length > 0 ) gd.removeObject( clines.item(clines.length-1) );

You can also install Paul's custom command ConstructionLine to handle the stuff above. See forum.
Yet another updated version of the ConstructionLine.


Toggle browser pane on/offV2.

Bscript: /* Toggle browser pane on/off */ moi.ui.showBrowserPane = !moi.ui.showBrowserPane;

Toggle between adjacent and inline browser modesV2.

Bscript: /* Toggle between adjacent and inline browser modes */ moi.ui.browserPosition = (moi.ui.browserPosition == 'Inside' ? 'Adjacent' : 'Inside');

Toggle between opposite and inline browser modesV2.

Bscript: /* Toggle between opposite and inline browser modes */ moi.ui.browserPosition = (moi.ui.browserPosition == 'Inside' ? 'Opposite' : 'Inside');

AddStyle – to set up a shortcut for "Add new style", use this as the command part of shortcut:

script: /* Open Add new style dialog */ var gd = moi.geometryDatabase; gd.styleEditorOpened(); var dialog = moi.ui.createDialog( 'EditStyleDialog.htm?titleid=Add style dialog title&index=-1', '', moi.ui.mainWindow ); if ( dialog.window.doModal() != -1 ) { var styles = gd.getObjectStyles(); if ( styles.length > 0 ) moi.ui.propertiesPanel.editStyleIndex( styles.length - 1 ); } gd.styleEditorClosed();

EditStyle – to set up a shortcut for the "Edit styles" dialog, use this as the command part of shortcut:

script: /* Open Edit styles dialog */ var dialog = moi.ui.createDialog( 'EditStylesDialog.htm', 'resizeable,defaultWidth:380,defaultHeight:420', moi.ui.mainWindow ); dialog.window.doModal();

SetObjectNameV2 – it sets object name as style name (each object will get assigned a name of its associated style name, plus a unique increasing number, like BlueLayer_2, BlueLayer_3, etc… The number is appended to make the names unique to avoid combination of mesh objects with identical names). See forum

Alt+Oscript: /* Set object name as style name + num */ var objs = moi.geometryDatabase.getObjects(); var styles = moi.geometryDatabase.getObjectStyles(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); obj.name = styles.item(obj.styleIndex).name + '_' + i; }

MatchObjectNameV2 – the script works purely off of selection – to use it you must make a combined selection that includes at least one of the objects that already has the name assigned to it, along with other unnamed objects that you want to have assigned to that same name.
When you have a selection set up like that, then push the shortcut key and it will assign the unnamed objects to have that same name.
You can use the Scene browser to help you make the selection – right click on the object name in the scene browser to make it the "isolated selection" – everything else will get deselected and only those named objects will be selected. Then select the unnamed objects and then push the shortcut key.

Alt+Oscript: /* Match object name */ var name = ''; var objects = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objects.length; ++i ) { var obj = objects.item(i); if ( obj.selected && obj.name != '' ) { name = obj.name; break; } } if ( name != '' ) { for ( var i = 0; i < objects.length; ++i ) { var obj = objects.item(i); if ( obj.selected && obj.name == '' ) { obj.name = name; obj.selected = false; obj.selected = true; } } }

CreateStyleFromObjectNameV2 – you get a style created for every named object, with the object assigned to it

Alt+1script: /* Create a separate style for each named object */ var AllObjects = moi.geometryDatabase.getObjects(); var NamedObjects = new Object(); for ( var i = 0; i < AllObjects.length; ++i ) { var Obj = AllObjects.item(i); if ( Obj.name != '' ) { if ( !NamedObjects[Obj.name] ) { NamedObjects[Obj.name] = new Array(); } NamedObjects[Obj.name].push( Obj ); } } for ( var Name in NamedObjects ) { var style = moi.geometryDatabase.findStyle( Name, true ); var Objects = NamedObjects[Name]; for ( var i = 0; i < Objects.length; ++i ) { Objects[i].styleIndex = style.index; var SubObjects = Objects[i].getSubObjects(); for ( var j = 0; j < SubObjects.length; ++j ) { SubObjects.item(j).styleIndex = style.index; } } }

SetObjectNameAsStyleNameV2:

Alt+3script: /* Set object name as style name */ var objs = moi.geometryDatabase.getObjects(); var styles = moi.geometryDatabase.getObjectStyles(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); obj.name = styles.item(obj.styleIndex).name; }

SeparateObjectNameV2 – it will add numbers to the names of any duplicate objects no matter how you duplicated the objects, whether it was by array, copy/paste, importing another file, transform/copy, rotate with copy option, Ctrl+drag, whatever…For example if you have 5 objects all named "Blah", after you run the script you will instead have Blah_1, Blah_2, Blah_3, Blah_4, Blah_5

Alt+3script: /* Separate object name */ var Objects = moi.geometryDatabase.getObjects(); var Names = new Object(); for ( var i = 0; i < Objects.length; ++i ) { var Obj = Objects.item(i); if ( Obj.name == '' ) { continue; } if ( !Names[Obj.name] ) { Names[Obj.name] = new Array(); } Names[Obj.name].push( Obj ); } for ( var Name in Names ) { if ( Names[Name].length == 1 ) { continue; } for ( var i = 0; i < Names[Name].length; ++i ) { Names[Name][i].name = Name + '_' + (i+1); } }

PurgeUnusedLayerV2 – it deletes any layers (styles) that have no objects assigned to them.

Alt+0script:var gd = moi.geometryDatabase; var styles = gd.getObjectStyles(); var counts = new Array(styles.length); for ( var i = 0; i < counts.length; ++i ) { counts[i] = 0; } var objs = gd.getObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if ( obj.styleIndex < counts.length ) ++counts[obj.styleIndex]; var subobjs = obj.getSubObjects(); for ( var j = 0; j < subobjs.length; ++j ) { var subobj = subobjs.item(j); if ( subobj.styleIndex < counts.length ) ++counts[subobj.styleIndex]; } } for ( var i = 0; i < styles.length; ++i ) { if ( counts[i] == 0 ) styles.item(i).remove(); }

SortStylesAlphabeticallyV2 – then when you hit shortcut key, the styles should get sorted alphabetically.
Oh also you probably shouldn't run this script while while the style editor dialog is also open, because it won't know how to deal with the styles changing out from underneath it like this script will do. So trigger the script when you are not in that dialog.
Also the script is not tremendously efficient, if you have something like more than 100 styles it may take a few seconds or something for it to complete.

Alt+3script: /* Sort styles alphabetically */ moi.geometryDatabase.styleEditorOpened(); var styles = moi.geometryDatabase.getObjectStyles(); var stylearray = new Array(); for ( var i = 0; i < styles.length; ++i ) { stylearray.push( styles.item(i) ); } function sortfunc(a,b) { return a.name.localeCompare( b.name ); } stylearray.sort( sortfunc ); for ( var i = 0; i < stylearray.length; ++i ) { var style = stylearray[i]; while ( style.index > i ) style.moveUp(); } moi.geometryDatabase.styleEditorClosed();

AssignRandomStylesToFaces&EdgesV2 – it will randomly assign each face or edge to one of the current style colors.

Alt+5script: /* Assign random styles to faces and edges */ var styles = moi.geometryDatabase.getObjectStyles(); var breps = moi.geometryDatabase.getObjects().getBReps(); for ( var i = 0; i < breps.length; ++i ) { var brep = breps.item(i); var edges = brep.getEdges(); for ( var j = 0; j < edges.length; ++j ) { edges.item(j).styleIndex = Math.floor(Math.random() * styles.length); } var faces = brep.getFaces(); for ( var j = 0; j < faces.length; ++j ) { faces.item(j).styleIndex = Math.floor(Math.random() * styles.length); } }

OpenSnapMenu – you can set up the following on a keyboard shortcut to make that snap menu open up with a keystroke instead of going to the button to launch it <or> which shows it in the center of the screen:

Alt+Sscript: /* Pop up the object snap menu */ var cb = moi.ui.getUIPanel('moi://ui/CommandBar.htm'); moi.ui.showMenu( 'ObjectSnapMenu.htm', cb.document.body.lastChild.lastChild, 2, 0 );
Alt+Pscript: /* Show object snap dialog */ moi.ui.createDialog( 'moi://ui/ObjectSnapMenu.htm' );

UntrimSelectedSurface – to use it, select some individual surfaces (that are not joined to any other surfaces), and hit that keyboard shortcut. It's the equivalent of selecting all the edges of those surfaces and doing delete.

F10script: /* Untrim the selected surface */ var gd = moi.geometryDatabase; srfs = gd.getSelectedObjects().getSingleFaceBReps(); gd.deselectAll(); for ( var i = 0; i < srfs.length; ++i ) srfs.item(i).getEdges().setProperty( 'selected', true ); moi.command.execCommand( 'delete' );

Camera&TargetPointToClipboard – it will copy the camera and target locations to the clipboard as a text string:

F9script:var v = moi.ui.mainWindow.viewpanel.getViewport('3D'); moi.copyTextToClipboard( 'Camera=' + v.cameraPt.toString() + '\r\nTarget=' + v.targetPt.toString() );

Similarly you can set the .cameraPt value to something to place the camera at a certain x,y,z location:

F7script:var v = moi.ui.mainWindow.viewpanel.getViewport('3D'); v.cameraPt = moi.vectorMath.createPoint(50.2, 30.5, 10.1);

CurveLengthV2 – It is possible to measure a length of curve in v2 by setting up a keyboard shortcut with this as the command. Then when you push that shortcut key it will calculate the length of the selected curves and copy it to the clipboard as text, and you can paste it into a text editor to see it.

Lscript:/* Calculate length of selected curves and copy to the clipboard as text */ var crvs = moi.geometryDatabase.getSelectedObjects().getCurves(); var len = 0.0; for ( var i = 0; i < crvs.length; ++i ) len += crvs.item(i).getLength(); moi.copyTextToClipboard( len );

CurveLengthBeingDrawnV2 – Here's a script Michael put together that you can run while in any of the curve,arc or line commands that will show the length in realtime.
Start any of the commands, like arc or freeform or line, and pick your first point. Then hit the script and a label displaying the length will appear in the active command window.

Lscript: /* Show length of current curve being drawn */ try { moi.ui.commandUI.setInterval( 'var crvs = moi.geometryDatabase.getObjects().getCurves(); var len = 0.0; if ( crvs.length > 0 ) { len = crvs.item(crvs.length-1).getLength(); } if ( !window["_crvdistlabel"] ) { document.body.insertAdjacentHTML( "beforeEnd", "<div id=_crvdistlabel></div>" ); } _crvdistlabel.innerText = len.toFixed(4);', 250 ); } catch(e) {}

LockedToEditControlPoints – this script will show control points for selected objects and then turn on selection lock for every object that does not have points turned on. When in this mode, other objects won't be selectable, so you can select and drag different points while in this mode without other objects getting in the way. Press Esc key twice to exit this mode (actually, it works like if nothing is selected when you push Escape, it will look to see if there is any locked selection and if there is it will clear the locked selection).

Lscript:moi.geometryDatabase.showPoints(); var objs = moi.geometryDatabase.getObjects(), locked = moi.geometryDatabase.createObjectList(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if ( !obj.showPoints ) locked.addObject( obj ); } locked.lockSelection();

LockUnselected – locking all the objects that are _not_ currently selected. Press Esc key twice to exit this mode.

Alt+Lscript:var objs = moi.geometryDatabase.getObjects(), locked = moi.geometryDatabase.createObjectList(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); if ( !obj.selected ) locked.addObject( obj ); } locked.lockSelection();

See also discussion about locking mechanism. Note:There is regular Lock command/button for locking objects in the V2!


RepeatLastCommand – a right click in a viewport repeats the last command. You can also assign a keyboard shortcut for it like this:
Spacescript:moi.command.repeatLastCommand();

ToggleAxisSnap – this turns on/off snapping on to the major axis lines of the grid in any viewport, just as if there was a permanent construction line there.

F8script:moi.drawingAids.objectSnapAxis = !moi.drawingAids.objectSnapAxis;

DuplicateBorders – this script macro might be useful for some data transfer stuff – this will duplicate every edge of every surface or solid in the scene as a regular independent curve object. Those curve objects can then be processed into DXF using 3dmCurves2DXF utility.

Alt+Bscript:var breps = moi.geometryDatabase.getObjects().getBReps(); for ( var iBrep = 0; iBrep < breps.length; ++iBrep ) { var brep = breps.item(iBrep); var edges = brep.getEdges(); for ( var iEdge = 0; iEdge < edges.length; ++iEdge ) { var newedge = edges.item(iEdge).clone(); moi.geometryDatabase.addObject( newedge ); newedge.selected = true; } }

DeletePoints

Ctrl+Pscript:var gd = moi.geometryDatabase; var pts = gd.getObjects().getPoints(); gd.removeObjects( pts );

SetConstraint – set shortcut for specific distance or angle constraints.

There's a method moi.ui.getActivePointPicker() which returns the pointpicker which is currently waiting for a point, or null if none is currently waiting.

Then there is also a setDistanceConstraint() and setAngleConstraint() which is available on a point picker.

So following script for instance sets up a distance constraint of 10 units. So to create a polyline with a lot of 10 unit segments, set this up and then push shortcut after picking each point.

Alt+Cscript:var pointpicker = moi.ui.getActivePointPicker(); if ( pointpicker != null ) pointpicker.setDistanceConstraint(10.0);

Setting shortcut for angle constraint.

Alt+Ascript:var pointpicker = moi.ui.getActivePointPicker(); if ( pointpicker != null ) pointpicker.setAngleConstraint(20.0);

ToggleMeshingParameters – toggles meshing parameters between default detailed mesh density and rougher one and vice versa, so that you can handle complex model smoothly.

Alt+Mscript:moi.view.meshAngle = ( Math.abs( moi.view.meshAngle - 40 ));

ToggleSnapAngle – switches snap angle between default 90 and 45 and vice-versa.

F9script:moi.drawingAids.straightSnapAngle = Math.abs( moi.drawingAids.straightSnapAngle - 135 );

SnapGrid – it does allow you to set up a quick 10.0 or 100.0 unit snap by using one keypress which you can turn on or off in the middle of drawing things.

Typing "G" (not holding it down, just push and release it) will enable a grid snap of 10.0 units. Typing "H" will enable a grid snap of 100.0 units. You can type "G" or "H" a second time to turn the snapping off.

Gscript:var da = moi.drawingAids; var grid = moi.grid; if ( da.gridSnap && grid.snapSize == 10.0 ) { grid.snapSize = 1.0; da.gridSnap = false; } else { grid.snapSize = 10.0; da.gridSnap = true; }
Hscript:var da = moi.drawingAids; var grid = moi.grid; if ( da.gridSnap && grid.snapSize == 100.0 ) { grid.snapSize = 1.0; da.gridSnap = false; } else { grid.snapSize = 100.0; da.gridSnap = true; }

ExtendGrid – extends the grid twice.

Alt+Gscript:moi.grid.Sections += moi.grid.Sections;

HandleGridSpacing – Paul's script. See forum.

Full Screen without UI (Michael Gibson)

This script allow you to hide the UI so only the viewports are visible.

First, create a new scripts directory underneath the main MoI program directory (on an equal level as \commands and \ui).

Unzip the file FullScreen.zip (for V1 use the old one – FullScreen-V1.zip) and put it in there. So the path for this file should be something like: C:\Program Files\MoI beta Dec-1-2006\scripts\FullScreen.js

Add a keyboard shortcut, for example:

F11FullScreen.js

Now pushing F11 will toggle the UI on or off.

Clock Bar

This script allow checking the clock, although MoI is covering up the taskbar. You know that the little arrow button next to the Help button controls whether MoI displays as full screen or not… or not? hehe…

Unzip the file Clock.zip into the \ui folder. (The MainWindowLayout.xml file must be overwritten – actually, there is only one extra line of text added in this file (<UIPanel dock="bottom" src="moi://ui/CommandBarClock.htm" />) – so needn't worry about it.

Plugin Gallery

How to set up a pop-up window with button you can use to launch a custom commands… slightly chaotic thread :) – see:
http://moi3d.com/forum/index.php?webtag=MOI&msg=1519.28
http://moi3d.com/forum/index.php?webtag=MOI&msg=1519.36
http://moi3d.com/forum/index.php?webtag=MOI&msg=1519.45
http://moi3d.com/forum/index.php?webtag=MOI&msg=1519.47
http://moi3d.com/forum/index.php?webtag=MOI&msg=1519.51

QuickCircle (Michael Gibson) (V2 and later)

This command draws a circle of a particular radius, placing the circle just with a single click for its center point. The circle will align itself to surfaces if the point you picked is on a surface.

To install, unzip the QuickCircle.zip to get 2 files (one .htm and one .js file) – copy these to the \commands subfolder inside of MoI's main installation folder, and then go to Options / Shortcut keys and set up a new shortcut key with QuickCircle as the command. You can then run the new command by pushing that shortcut key.

I left the default at 1.0, if you want to change the default to 0.1, you can edit the default="1.0" in the QuickCircle.htm file. But you can change the radius in the edit box.

Also after you pick a point, this command will keep running so that you can click down several points to place additional circles while inside the same command.

See for more info and download.

Nudge (Michael Gibson)

Nudge script lets you move selected objects, points or control points by small increments.

Unzip the file Nudge.zip (or for V2 CPlaneNudge.zip) into the \commands subfolder under your MoI main program files folder. Then go to Options / Shortcut keys, and add some new entries. For the command, put a space after Nudge, so it's 2 words like "Nudge Left". The Nudge command will look at those parameters when it runs.

LeftArrowNudge Left
RightArrowNudge Right
UpArrowNudge Up
DownArrowNudge Down

It's also possible to set, for example, PageUp and PageDown for 'z' nudging, like:

PageUpNudge zup
PageDownNudge zdown

and you can also add some more for doing a larger or smaller step, like:

Ctrl+LeftArrowNudge Left Large
Alt+LeftArrowNudge Left Small

There is Paul's variation of nudge script – NudgeViewAxis.zip – this one uses imaginary viewport XY axis instead of world axis to nudge the objects in a given direction. A syntax for command part of shortcut is the same as above except it doesn't make sense to define 'z' nudging.

See for more info.

Cross Section (Michael Gibson)

This script allow you to create the cross-section curves through profile curves similar to Rhino's CSec.

Unzip the file CSec.zip into the \commands subfolder under your MoI main program files folder. That installs the new CSec command, but you need a way to trigger it – you can do this by adding a new keyboard shortcut under Options, for example:

Add a keyboard shortcut, for example:

Alt+CCSec

To use the CSec command, you pick your CSec curves one by one in order from first to last in a circular order, and then push Alt+C, to do your CSec-ing right inside of MoI. See for more info.

Scale Array (Michael Gibson)

This script allow you to scale the results of the array like this.

Unzip the file ScaleArray.zip into the \commands folder, then add a keyboard shortcut for ScaleArray; go to your moi.ini and add a keyboard shortcut, for example:

Add a keyboard shortcut, for example:

Alt+SScaleArray

To use the ScaleArray command, you use any array command, but make sure to include a single point object with the objects you are arraying. The point object will become the center of the scale for each array instance.

After you do an array, select the arrayed objects (and only the arrayed objects, so for example if you do an array curve make sure the path curve is not selected), then do Alt+S (or whatever your shortcut key is) and follow a prompt.

Measure Distance

This script allow evaluating the distance between two picked points.

Unzip the file CustomDistance.zip or Michael's CustomDistanceXYZ2.zip (it shows delta values for x, y, and z individually as well as the full distance) into the \commands folder.

Add a keyboard shortcut, for example:

Ctrl+PCustomDistance

Now pushing Alt+D will launch the CustomDistance command.

Original message: MoI forum.

Constraint Polyline

This script allow you to keep the same distance or/and set constraint angle while drawing a polyline.

Unzip the file ConstraintPolyline.zip into the \commands folder.

Add a keyboard shortcut, for example:

Alt+PConstraintPolyline

Now pushing Alt+P will launch the ConstraintPolyline command. After calling this new command you can choose from three constraint mode for drawing a polyline – distance constraint, angle constraint or both of them. If you don't want to use one of them, you just type 0 (zero) or delete a value.

Copy To Points

This script allow you to copy an objects into the set of existing target points.

Unzip the file CopyToPoints.zip into the \commands folder (e.g. C:\Program Files\MoI beta Apr-26-2007\commands)

Add a keyboard shortcut, for example:

Ctrl+PCopyToPoints

Now pushing Alt+P will launch the CopyToPoints command. There is only one difference in comparison with regular Copy command. You must select a target points instead of picking the ones. If you check the "Delete points" option, the target points will be deleted. For selecting a target points, you can set a keyboard shortcut to select all points in the scene:

Ctrl+Pscript:moi.geometryDatabase.getObjects().getPoints().setProperty( 'selected', true );

Import Point File

This script allow you to import point file as points, polyline or free-form curve. Points in the file should be in format like X,Y,Z (you can choose a delimiter of coordinates) with no comments or header section.

Unzip the file ImportPointFile.zip into the \commands folder (e.g. C:\Program Files\MoI beta Apr-26-2007\commands) and add a keyboard shortcut for this new command.

Some issues in using script above: The particular method that script uses to show the "get filename to open" dialog is apparently not available on Windows Vista or higher – use ImportPointFile_Update2.zip second updated version instead (you can use it along Win XP as well). It won't work with MoI v1, though.


Note: You can download updated version of the script which works on the OSX version.


Add a keyboard shortcut, for example:

Alt+IImportPointFile

Save Point File

This script allow for saving a coordinates of point objects to the plain text file in format X,Y,Z.

To save a point, run a command and select the point objects. Choose the delimiter character and number of significant digits of precision in the command prompt options and push done button. In the dialog box, type a name for the file including some extension like .txt, .csv, .xyz; e.g. outline.txt

To install it, unzip the file SavePointFile.zip into the \commands folder (e.g. C:\Program Files\MoI beta Apr-26-2007\commands) and add a keyboard shortcut for this new command.


Note: You can download updated version of the script which works on the OSX version.


Add a keyboard shortcut, for example:

Alt+ESavePointFile

Select Objects By Type

This custom command helps you select all visible objects of a given type. The command doesn't deselect the selected objects, it means the command adds to the current selection only.

You can select the object which will define the object type to select before the command starts. In this case, when one and only one object is selected, command will run without any user intervention and in accordance with the state of a subtype checkbox the objects of the given type will become selected. The object you can pre-select:

Without pre-selected object the command prompt will stay accessible in order to enable user to check/uncheck the subtype button and pick the object. If you pick the curve or point, command will do its work and finishes. If you pick a surface, the "Done" button appears – then you will be able to finish command by pushing it (or clicking the right mouse button in the viewport) immediately to select all closed or open surfaces _or_ select edge or face in drill-in mode first to select all edges or faces.

If there is more than one object selected before command starts, it will work as described above except the pre-selected objects become deselected temporarily.

It sounds somewhat complicated, but I believe it's quite intuitive.

Unzip the file SelectByType.zip into the \commands subfolder under your MoI main program files folder. Then go to Options / Shortcut keys, and add some new entries, like:

SSelectByType

See also MoI forum.

Spur Gear Profile

This custom command creates an involute spur gear profile. It is as simple as possible – just for fun. You can specify the gear by number of teeth and its module or diametral pitch (it depends on current unit settings). Then you can use that curve to make a meshing gear.

Some vague definitions:

Unzip the file SpurGearProfile.zip into the \commands subfolder under your MoI main program files folder. Then go to Options / Shortcut keys, and add some new entries, like:

GSpurGearProfile

Reconstruct Curve(s) [for V2 beta Jun-23-2009 or later]

! I have decided to rename this RebuildCurve custom command to avoid confusion with regular Rebuild command !

This custom command allow you to reconstruct a curve/curves using sample points evenly distributed along the original curve. You can choose from three different mode which alter the way how a new curve is built – this is possible only if there is no selected curve when triggering command, though.

Unzip the file ReconstructCurve.zip into the \commands subfolder under your MoI main program files folder. Then go to Options / Shortcut keys, and add some new entries, like:

RReconstructCurve

Close Curve (Michael Gibson) [for V2 beta Jun-23-2009 or later]

This command closes curves by adding line segment between curve's start and end point.

To install the new command, unzip the attached CloseCurve.zip file to get 2 files: CloseCurve.js and CloseCurve.htm . Copy these files to the \commands subfolder inside of MoI's main installation folder.

Then inside of MoI either assign a shortcut key to have a command of CloseCurve, or you can also type CloseCurve to launch it by using the mini-command line entry.

See MoI's forum

Import Folder (Michael Gibson)

This is a command for importing all the IGES files inside of a folder that you pick. (Note that it can be modified easily to do importing all the AI or 3DM files.)

To install the new command, unzip the attached ImportFolder.zip file, then copy ImportFolder.js into the \commands sub-folder inside of MoI's main installation folder.

This will give you a new command named "ImportFolder".

To trigger the command you have to set up a keyboard shortcut – go to Options / Shortcut keys, and add a new entry. Put whatever you like for the Key, for example Ctrl+I , then for the Command put in ImportFolder.

See MoI's forum

Batch processing (Michael Gibson)

MoI allows for automatic batch processing type operations.

The first step is that you can pass the name of a script file as a command-line parameter to MoI.exe. If there are any spaces in the script file name, the entire file name should be enclosed in double quotes, like:

MoI.exe "c:\path with spaces\script.js"

The script will execute immediately before the main window is displayed, so if your script decides to exit MoI the actual MoI UI will never show up on the screen.

Michael made an example to get you started. This BatchConvert.zip script shows how to convert IGES to OBJ files.

BatchConvert.js is the file that you would overwrite with your own script, before launching MoI.exe. You just add in one line for a call to Convert() for each IGES (extension .igs or .iges) file you want to convert to an OBJ.

TheConvert() function is defined in the Convert.js library file which is included into BatchConvert.js.

Convert() handles the basic calls into MoI to open and save the files. There are some comments in there about how to control the meshing parameters, this is done by an option string you can pass to the saveAs() function. If you pass NoUI=true, the mesh dialog will not be displayed.

See for more info.

Pipe (Michael Gibson)

This command makes it quicker to create hollow pipes around many curves in one shot. (Note that there is the "auto place" mode for sweeping which makes it easy to create a pipe with different shape of profile even without using this custom command. Also, Michael is going to improve regular Sweep command to handle additional stuff for V2!)

However, this will only work properly on a smooth curve, you will have to wait until MoI version 2.0 before this will handle sharp corners properly.

To install this new command, download the Pipe.zip file. Copy the 2 included files (Pipe.htm, Pipe.js – updated version for V3 which should work in V2 as well) to the \commands subfolder under MoI's main installation folder in C:\Program Files.

That will install the new command, but you also need to add a new shortcut key to trigger it. To do that, go to Options / Shortcut keys, and push the "Add" button, and put whatever you wish for the key (for example P), and then for the command put in Pipe.

Now when you push that key the new Pipe command will be launched.

Select your rail curves first, then run the command. Then you will have the options for Outer and Inner radius which you can set in the command options area in the upper right corner of the MoI window.

This should speed up the creation of a larger number of pipes or tubing.

See original post.


You can also download a modified version (Pipe2.zip) which allows you to specify different outer and inner radius values which get applied to the end of the sweep. The command for this one is Pipe2, you can rename the files if you want it to replace the previous Pipe command instead.

Note this version doesn't automatically update the pipes when you enter values in, you need to push the Update button to see your changes take effect for this version. This is so you can more easily input multiple values, because Pipe does not have the same kind of interruptability that regular commands have.

See forum.

Ring Circle Creator (Michael & Jesse)

Michael was kind enough to build a tool for MoI jewelry designers to draw specific ring sizes and Jesse filled in the measurements for each country system, referencing a number of ring size charts he found online.

To install, unzip this file RingCircle.zip, placing both RingCircle files (html and jscript) in the "commands" folder of MoI – C:\Program Files\MoI 1.0\commands.

The RingCircle tool won't show up in MoI unless you turn it on with a keyboard shortcut. To make the shortcut, click the "Options" icon at the bottom right area of MoI (it looks like a yellow gear) and under "Shortcut Keys", add a key and a command. You can choose whatever key you prefer and typed in the command RingCircle.

See MoI's forum for more info.

Stand-alone utilities

Obj23dmWireframe converter (Michael Gibson)

This is a polygon wireframe to 3dm converter. It enables bringing polygon data (OBJ) into MoI to use as construction guides. Download the file Obj23dmWireframe.zip. Unzip it to some folder, and then you can run the Obj23dmWireframe.exe program. It will prompt you for the name of an OBJ file, and after that the name of a 3DM file. It will read all the polygon data from the OBJ file and convert the edges of polygons into line segments, and save those line segments to the 3DM file that you specified. You can then load that 3DM file into MoI and use those line segments to snap on to.

See MoI forum.


3dmCurves2DXF converter V3 update (Michael Gibson)

Download the files 3dmCurves2DXF.zip, unzip this to some folder, then run the 3dmCurves2DXF.exe program. It will ask you for the name of an input .3dm file, and then the name of an output .dxf file. It will read through the input .3dm file and convert any curve objects it finds to Spline entities in the DXF file.

See MoI forum.

And also MoI forum.


OBJ file editor 1th update (Michael Gibson)

Utility program that edits the OBJ file to break larger objects up into smaller object pieces – see MoI forum and also emit material IDs – see here.

For V2 beta Jun-23-2009 or later, see this info.

Download a SeparateOBJ.zip file.


Merge OBJ (Michael Gibson)

MergeOBJ.exe utility – it will edit the .obj file to remove the grouping and object label directives so it should appear as one single mesh object – see MoI forum.

For V2 beta Jun-23-2009 or later, see this info.


Relabel OBJ (Michael Gibson)

If you run the RelabelOBJ.exe (see MoI forum) program, it will ask you for a file name, and then it will go through and replace all the object names to be based off the file's own name instead of just "object".

So for instance if you have a file named my_file.obj, if you run the RelabelOBJ.exe program on it, all the object names will be turned from just "object1", "object2", etc... into "my_file1", "my_file2", etc...

Well, you could do something like search & replace in your favorite text editor to change the names as well.

For V2 beta Jun-23-2009 or later, see this info.


Blender importer (Anthony D'Agostino)

Anthony wrote a custom blender import script that handles true normals and real-time UV coords. It also adds some pretty cool vertex colors that simulates the global-illumination from a hemisphere. The light value is calculated from the true vertex normal not the average of the face normals that surround a vertex.

Anthony highly recommend the use of his blender import script when using Blender & MoI. It reads UVs & Normals from LWO files exported from MoI3D (note: export with the vertex-welding option turned off). You can download it for free here:
http://home.comcast.net/~gamma-ray/moi/import_moi.py (or a zipped copy).

The animated GIF on this MoI forum page shows the difference between Anthony's importer and the standard one that ignores MoI's true normals.


3dm2sculpt converter

You can get a 3dm2sculpt converter from here – that will enable converting from a .3dm file that MoI saves into a .tga sculpt map texture file. See the page in the "How to use ?" section for some instructions: http://wiki.secondlife.com/wiki/3dm2sculpt


iges2step converter Note that V2 is able to handle STEP I/O directly!

MoI can import/export IGES files … to translate STEP file to IGES or vice versa you can use iges2step converter/viewer; see http://iges2step.narod.ru/. After finishing an installation process you must reboot your computer before first launching this converter!

IGES2STEP is a freeware CAD file viewer for Windows XP/2000/NT. It allows viewing IGES and STEP files and translating between them.
The versions of the formats are:
IGES: up to 5.3
STEP AP203: Mechanical Design (General 3D CAD)
STEP AP214: Automotive Design
STEP AP209: Finite-Element Analysis (initial support)

obj2jot converter

JOT is an academic project of real–time non photorealistic render, see http://www.cs.princeton.edu/gfx/software.php.

Download the files obj2jot.zip and supp.zip, unzip and dig into it…


stl2dxf converter

This converter uses ADMesh, see http://www.varlog.com/index.html.

Download the file stl2dxf.zip, unzip and dig into it…

Some more info here (MoI forum).