Import STL to MoI
All  1-20

Next
 From:  thsorensen
7046.1 
Hi,

Is there any possibility that MoI will support import of STL-files somewhere in the near future?


Or does anyone know a good way of converting STLs to a MoI friendly format?

Cheers,
Thomas
  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)
7046.2 In reply to 7046.1 
As exist some OBJ importers for Moi, that should be not difficult to import it ! ;)
http://moi3d.com/forum/get_attachment.php?webtag=MOI&hash=1672dd45da321f51513d74216e78cd7b&filename=importObj.zip
by Max Smirnov

The free MeshLab can convert STL in OBJ
http://meshlab.sourceforge.net/

then you can use the subdivider by Max Smirnov again ;)
http://moi3d.com/forum/index.php?webtag=MOI&msg=6674.82

EDITED: 19 Nov 2014 by PILOU

  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
7046.3 In reply to 7046.1 
Hi Thomas,

> Is there any possibility that MoI will support import of STL-files
> somewhere in the near future?

Sorry no it's not likely anytime soon - STL files contain a much different kind of 3D model data than what MoI uses at modeling time.

You can export STL files out from MoI, but not import them back in again.


> Or does anyone know a good way of converting STLs to a MoI friendly format?

It's a difficult task, because STL files contain data that is made up of a whole bunch of little flat triangle facet pieces, it's a polygon based file format, not a CAD solids file format.

MoI is designed to work with structured solids, with things like a sphere being one single sphere surface, not with a sphere being made up of many thousands of separate little facet pieces.

When you export from MoI to STL format, the structured surfaces are diced up into little facets to go in the exported STL file, but it's not easy to go the reverse direction and try to reform large structured CAD surfaces out of already diced up pieces...

If you have something with a pretty low polygon count it could be possible to convert it, by using a polygon editing program to convert it to OBJ format and then one of the tools Pilou mentions above, or also the OBJ2Wireframe converter from here could do it: http://moi3d.com/wiki/Resources#Obj23dmWireframe_converter

But again the issue is that STL files contain a much different type of model data than what MoI is designed to work with for modeling, you will usually need to use a polygon modeling program to load in and work with an STL file since it's made up of little polygon facets. That's why generally STL file use with MoI is for export only, not for importing back into MoI.

- 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:  thsorensen
7046.4 
Thank you for the good answers guys!

I will try use the methods you suggested in the weekend :)

--
Thomas
  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:  dune1982
7046.5 In reply to 7046.4 
Hey Guys,
a good friend and I have done some work, we made a script that imports ascii stl files in MoI. The script works but depending on your computer and the stl file you have to give it some time to calculate.

Since my friend had to stop putting time into this, it would be great if somebody could help me optimize this script.

  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
7046.6 In reply to 7046.5 
Hi dune1982, thanks for posting the script!

I've attached a version with some optimizations in it - basically switching to use PlanarSrf to build the surfaces will help a bit because it's more friendly to re-using the same factory many times.

- Michael
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:  Michael Gibson
7046.7 In reply to 7046.5 
Hi dune1982 - one more round of optimizing attached. This one uses Loft instead, so it only has to create 2 lines, and does more of the factory setup stuff out of the loop.

It might not get much better than this one until sometime in the future when there's more methods for creating geometry from scripts.

- Michael
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:  bemfarmer
7046.8 In reply to 7046.7 
From the clara.io site, downloaded the dragon in .Stl and .Obj formats, to try out import of the two formats to Moi.

Results were similar. Joining took numerous seconds.
Stl had 37 joined surfaces, 450 naked edges in head/neck.
Obj had 39 joined surfaces, 394 naked edges in head/neck.

https://clara.io/view/b64d1057-9b13-4381-9674-4d91dd127f7f#

- Brian

(Still trying to puzzle out the scripts :-)
  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:  dune1982
7046.9 In reply to 7046.7 
Thank you Michael, with your optimizations the script is about 3 times faster now on my computer.
It takes about 9sec to import my testfile with 23760 triangles.

Last thing would be to make it read bin stl too.
  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:  chippwalters
7046.10 In reply to 7046.7 
Michael,

Downloaded P_ImportSTL.htm and installed in commands folder on Mac.
Didn't show up in Max's ExtScripts button. Tried <tab> and "P_ImportSTL.htm" and "P_ImportSTL" from command bar and still nothing.

Any special sauce on how to use this?
  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
7046.11 In reply to 7046.10 
Did you get the JS file from the original post?

That's here:

http://moi3d.com/forum/index.php?webtag=MOI&msg=7046.5

EDITED: 31 Oct 2015 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:  bemfarmer
7046.12 In reply to 7046.10 
(Windows 7)
Scripts that start with _ are listed before scripts starting with alphabetical letters.
P_******* would occur near the tail end of the ext. scripts list.
I deleted the P, and translated the Alert to English: alert("Import complete. " + a + " triangles imported.");

- Brian

There was a recent post about the proper directory for a Mac...
  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
7046.13 In reply to 7046.10 
Hi Chipp yeah Burr's got it - you need the .js file from the earlier post to go along with the .htm file, the .htm file that I posted was just an optimized version of that one file it still needs the other file for the command to be complete.

- 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:  chippwalters
7046.14 In reply to 7046.13 
Thanks.

Interesting. I thought the .js would be the business logic and the .html the GUI. So, I figured out you somehow forced the biz logic into the HTML as you said you had changed it. Apparently biz logic can reside in the HTML- and I dunno then what the legacy .js was.
  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:  chippwalters
7046.15 
Well, I finally did get the script to run, but I ended up with this dialog:



1) Message saying (I believe) 0 triangles imported
2) Simple STL model (as shown in Mac Preview app)

for this file. FWIW, the STL file I used was a simple file exported directly from MoI3D.
  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
7046.16 In reply to 7046.14 
Hi Chipp,

> Interesting. I thought the .js would be the business logic and the .html the GUI.

It is set up to be like that, but the .js code runs out of process so that it can be canceled at any time by tearing down the worker process, while any code in the .htm GUI side runs in-process. Any calls to MoI from the out of process code run through inter-process marshaling and so have a higher overheard per call into MoI code. This doesn't really come into any significance for regular MoI commands because their business logic just acts at a high level as glue logic, not doing heavier computation directly in the script itself.

So anyway, wedging the code into the in-process GUI side can have some performance improvements for more calculation heavy type code like in this case.

I'm going to attempt to change the threading model in the next version of MoI to make the .js code to run on its own dedicated in-process thread instead of out of process, which will have the downside of losing the automatic canceling (right now anything that runs in the .js can automatically be canceled without any cooperation of the script), but should make the call-into-MoI performance to be equivalent.


re: STL exported from MoI doesn't work - that's probably because your STL file was a binary STL file and this import script only supports ascii STL files currently. In MoI if you go to Options > Import/Export > STL options > File Type and set it to "File type = Ascii" that should then make a file that will work with this importer.

- 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

Message 7046.17 deleted 31 May 2016 by BEMFARMER

Previous
Next
 From:  chippwalters
7046.18 In reply to 7046.16 
Michael,

Thanks for the clear explanation. Didn't know about the ascii vs binary switch in MoI. Thanks for the tip!
  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:  dune1982
7046.19 In reply to 7046.16 
Is there any one that could help me improve the script to read binary stl files too? I have no idea how to parse the binary stl file.
  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
 From:  Michael Gibson
7046.20 In reply to 7046.19 
Hi dune1982 - it will difficult to try and read in a binary file because the method currently set up for scripts to access files (moi.filesystem.openFileStream) is currently only focused on reading text files line by line, and does not have anything set up in it for reading binary files which would be more like reading in a certain number of bytes rather than scanning for carriage returns or newline characters.

- 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
 

Reply to All Reply to All

 

 
 
Show messages: All  1-20