MoI discussion forum
MoI discussion forum

Full Version: STL import script with some helpers

Show messages: All  1-2  3-12

From: mkdm
12 Mar 2018   [#3] In reply to [#1]
Hello "r2d3"!

Many thanks for this very interesting "coding"! My congratulations!

Maybe not really useful for "real life" use-cases but anyway, very interesting piece of code.

Thank you very much :)

Ciao!
From: r2d3
12 Mar 2018   [#4] In reply to [#2]
>>But what about load an STL file inside a "Polygon modeler" then export as OBJ, then import "OBJ file" inside MOi ?

My old way to import STL was to use FreeCad to prepare the file for MoI.. But you still have no clean NURBS file...
Or do you have a SECRET PILOU trick??
From: r2d3
12 Mar 2018   [#5] In reply to [#3]
>>> Maybe not really useful for "real life"...

For 3Dprint-MoIers the STL is a very common format.
But sometimes a only as STL available print file needs a little tweak to fit and then you need a clean file ...

>> but anyway, very interesting piece of code.

THX :-)
From: mkdm
12 Mar 2018   [#6] In reply to [#5]
Hello r23d!

Just a little clarification to my previous words :)

When I've written "Maybe not really useful for "real life"..." I only meant that unfortunately the execution of the scripts with objects containing many faces is rather slow.
Clearly because Moi is not very well suited to manage that kind polygonal information, and this is normal.

@You : "...For 3Dprint-MoIers the STL is a very common format..."

Yes, for sure!

Anyway as I've said, it's a really useful bunch of JS code, a kind of "proving ground" :)

Thanks.

Marco (mkdm)
From: Frenchy Pilou (PILOU)
12 Mar 2018   [#7]
<< a SECRET trick??
_import OBJ by Max Smirnov ?
But not sure that result will be different than your before some cleaning...
From: r2d3
12 Mar 2018   [#8] In reply to [#6]
Absolut no clarification necessary :)

>> Anyway as I've said, it's a really useful bunch of JS code, a kind of "proving ground" :)
Exactly, just playing around and learning whats possible to realise with MoI.
From: Hamish Mead (HAIRYKIWI)
12 Mar 2018   [#9]
Very nice work Ralf!

There can never be enough conversion tools - even if extra time is still needed to clean and tweak such imported files.

Many thanks :)

- Hamish
From: Chris (UGMENTALCASE)
18 Aug 2022   [#10]
Hi,

Is there a way to edit this script so it just imports the stl without trying to make it solid and so on? I have literally no idea when it comes to scripts so forgive me :-)
From: Michael Gibson
18 Aug 2022   [#11] In reply to [#10]
Hi Chris, you might want to try converting the STL file to .obj format and then use the OBJ to 3DM wireframe converter from here:
https://moi3d.com/wiki/Resources#Obj23dmWireframe_converter

That makes wireframe lines or closed polylines for each polygon instead of trying to construct a solid out of it which is much more heavyweight.

If you did want to edit this script to not try to join it into a solid, the joining part is done by a function named JoinTriangles(). The function is called on line number 17 in the file _STLimport.js . It's a long line of code, look for the piece of it that has this:

var solid=JoinTriangles(triangles);var sol=solid.numSolids;if(sol<1){var message="SORRY!\nI WAS NOT ABLE TO MAKE A SOLID!\nDont't try to \"Clean flat surfaces\"";}else{var message=sol+" SOLID CREATED!";};

Delete all of that or "comment it out" by putting /*    */ around it and then it shouldn't do the joining part.

- Michael
From: Chris (UGMENTALCASE)
19 Aug 2022   [#12] In reply to [#11]
Cheers I'll take a look. I have used the other script a little bit, but sometimes there is just too many lines!

Show messages: All  1-2  3-12