MoI discussion forum
MoI discussion forum

Full Version: Moi3d model has a quick way to import keyshot.

Show messages: All  1-8  9-13

From: feirui445
18 Feb 2022   [#9] In reply to [#8]
Thank you. I want to press a shortcut key to open C: \ \ test obj,Use_ Importobj command, open directly without file dialog box
From: Michael Gibson
19 Feb 2022   [#10] In reply to [#9]
Hi feirui445,

re:
> Thank you. I want to press a shortcut key to open C: \ \ test obj,Use_ Importobj
> command, open directly without file dialog box

That command script was not set up to do that so you'll need to make some slight changes to the command.

Open up the file _ImportObj.js and find line number 4 which has this:

code:
var objPath = moi.filesystem.getOpenFileName( 'Import OBJ', ' (*.obj)|*.obj' );

remove that and put in this instead:

code:
var objPath = moi.command.getCommandLineParams();
if ( !objPath ) objPath = moi.filesystem.getOpenFileName( 'Import OBJ', ' (*.obj)|*.obj' );


Then you should be able to give a command line parameter in the shortcut key, like this (no doubled \\ in this case):

_ImportObj c:\test.obj

- Michael
From: feirui445
19 Feb 2022   [#11] In reply to [#10]
Thank you.

Image Attachments:
20220220_094548.gif 


From: feirui445
3 Mar 2022   [#12] In reply to [#11]
The imported box does not change the shape of an egg. What's wrong with the code?
After I use three shortcut keys, the fault appears

Q: script:moi.geometryDatabase.saveAs( 'c:\\test.obj', 'NoUI=true;Angle=180;Output=quads' );script:moi.geometryDatabase.deleteAll();script:moi.geometryDatabase.fileImportSubD( 'c:\\test.obj' );
A: script:moi.geometryDatabase.saveAs( 'c:\\test.obj', 'NoUI=true;Angle=180;Output=quads' );
Z: _ImportObj c:\test.obj

Image Attachments:
1.png 


From: Michael Gibson
3 Mar 2022   [#13] In reply to [#12]
Hi feirui445,

re:
> After I use three shortcut keys, the fault appears

Do you mean you're pressing these 3 keys in sequence or are you using just the first one which already does an combined export and reimport?

Your 3rd key has:

> Z: _ImportObj c:\test.obj

The _ImportObj plug-in brings in polygons as planar faces in MoI, it does not apply sub-d smoothing. If you want to use the native MoI sub-d converter use this instead for your importing step:
script: moi.geometryDatabase.fileImportSubD( 'c:\\test.obj' );

Another thing which may be a problem is that by default Windows restricts programs from writing to the root c:\ directory so you might need to run MoI with administrator privileges for it to be able to write to that location.

- Michael

Show messages: All  1-8  9-13