What's new

New Add-On for conversion of .stl to .stp and open in Alibre. Complete C# rewrite.

bolsover

Alibre Super User
How to convert .stl to .stp?

I've seen this topic come up several times over the last few years so I finally decided to prepare an Add-on to (partially) solve the problem.
A complete new implementation.
Internally, the Add-on uses the well known Slugvev stltostp executable: https://github.com/slugdev/stltostp
This is the same solution others have applied using the scripting environment. I've just packaged it as an Add-on.


The source code and an initial executable to install the Add-on and standalone converter is available here:

Now at version 1.2

Updated to version 1.3

https://github.com/bolsover/AlibreImportStlAsStep/releases/tag/V1.3

Release version 2.0 - Complete rewrite in C# no longer using the slgdev code.
This version is significantly faster and produces smaller .stp files than the original


Release version 2.1 - now includes a Splitterator!!

Important
When installing Release version 2.0. You should first uninstall the earlier AlibreImportStlAsStep Add-on as this may conflict with the new release and cause a duplication of menu items.
The uninstaller should be found in the C:\Program Files\AlibreImportStlAsStep directory

Testing has been quite limited but it seems to work OK for smaller .stl files but the Slugvev stltostp executable clearly struggles with more complex designs and Alibre will likewise perform poorly when given a larger .stp!

As is usual with this type of Add-on, it is quite likely that anti virus measures will object to downloading/installing the raw executable. For this reason, I have wrapped the installation .exe in both .zip and .war in an effort to mitigate any download issues. As usual, it's up to you to trust the code or not either way, I welcome comments.
 
Last edited:
1762198492829.png
Hi David,
I tested your add-on and I'm getting this error. Also, when saving the file, the full file path is displayed in the name bar. Setting the name without the path always gives the same error. I hope others can test to confirm. Thanks for your work.
Regards,
Francesco
 
View attachment 45824
Hi David,
I tested your add-on and I'm getting this error. Also, when saving the file, the full file path is displayed in the name bar. Setting the name without the path always gives the same error. I hope others can test to confirm. Thanks for your work.
Regards,
Francesco
Hi Francesco
Thanks for the feedback.. I'll run some more tests but in the meanwhile, can you let me have a copy of the failing .stl? I only tested on a few simple .stl and had one downloaded file cause stltostp.exe to crash.
David
 
Thanks for sharing. I will test at home when I get some time.

I'm curious if the Analysis Situs community version can be used as an alternative to stltostp.exe. There is a short article on converting facets to faces, which highlights an interesting function called maximize-faces. This feature works well with non-scanned meshes that have many flat surfaces. It could be presented to users as an option in a dialog box.

Here’s the link to the article: Analysis Situs Features.
All available commands can be found here.

From what I understand, Analysis Situs can operate without a graphical interface by running commands via the command line.
 
Thanks for sharing. I will test at home when I get some time.

I'm curious if the Analysis Situs community version can be used as an alternative to stltostp.exe. There is a short article on converting facets to faces, which highlights an interesting function called maximize-faces. This feature works well with non-scanned meshes that have many flat surfaces. It could be presented to users as an option in a dialog box.

Here’s the link to the article: Analysis Situs Features.
All available commands can be found here.

From what I understand, Analysis Situs can operate without a graphical interface by running commands via the command line.
I did run a couple of tests with Analysis Situs and while it was able to convert stl to stp, it did a remarkably poor job! That could of course be because I made some poor choices in the conversion routine. That said, it is undoubtably impressive software and probably warrants further investigation. I suspect integrating it into some simple routine to open stl, convert to stp, save and then open the resultant file in Alibre will require some effort.
All I can say is watch this space...
David
 
Thanks for sharing. I will test at home when I get some time.

I'm curious if the Analysis Situs community version can be used as an alternative to stltostp.exe. There is a short article on converting facets to faces, which highlights an interesting function called maximize-faces. This feature works well with non-scanned meshes that have many flat surfaces. It could be presented to users as an option in a dialog box.

Here’s the link to the article: Analysis Situs Features.
All available commands can be found here.

From what I understand, Analysis Situs can operate without a graphical interface by running commands via the command line.
I've just had a couple of hours downloading and building the Analysis Situs source code.. I managed to get the application running under Visual Studio. It is a BIG application in terms of the parts needed to get it working with Alibre. I'm sure it is possible and may be worthwhile but will certainly take some time!!
 
V1.1
1762291847077.png
after setting stp name. I get the same result with or without the path in the name.
stl part included. (renamed to txt for uploading)
 

Attachments

I did run a couple of tests with Analysis Situs and while it was able to convert stl to stp, it did a remarkably poor job!
AS has a strict work flow when doing things, perhaps too many steps to achieve a single result, and most stuff aren't populated as buttons in the GUI. If you had used maximize-surface command before the conversion, it often messes up the mesh if has too many triangles, and if there is no distinctive flat surfaces. You may need to reduce/increase the angle and linear tolerance for a better outcome, but this takes a several trial/error. I generally had very good results with using AS for mesh to solid conversions.

I'm sure it is possible and may be worthwhile but will certainly take some time!!
Understand, no worries. I wish I had the knowledge to be able to help you out on this.
 
Last edited:
If you had used maximize-surface command before the conversion, it often messes up the mesh if has too many triangles
That was certainly the issue for one of the tests.
The other issue which also applies to stltostp, is the speed of the conversion process. I have one downloaded model with a very large number of curved surfaces. AS was able to load the stl but after two hours it had not completed the maximize-surface command I gave up.
Without the maximize-surface command, the converted stp was about 25Mb. Alibre was still trying to load after an hour - I halted Alibre.
I'm still working on getting the AS source code to properly compile all the outputs so haven't yet tested just the command line option.
I think it's a question of managing expectations. Converting from any native modelling environment to stl and then converting stl to stp is a process full of compromises and the results may not always be good enough.
 
V1.1
View attachment 45832
after setting stp name. I get the same result with or without the path in the name.
stl part included. (renamed to txt for uploading)
I'm really not sure what the problem is; I was able to convert the stl without issue. I 'think' the error is from stltostp.exe but need to confirm. I'll dig into the source code and try to identify the issue.
 

Attachments

Just updated to version 1.2..
I don't know if this will resolve the issues reported by @albie0803 and @Cator but it should go some way to resolving the file path issue.
In this version , I've changed the dialog to show the input stl, output stl and added a tolerance spinner. using a smaller number (e.g.: 0.0000001) for the tolerance should result in a higher resolution, a larger number (e.g.: 0.1) may cause problems resolving fine detail. The trade off is file size and speed loading the resultant .stp file into Alibre.
David
 
View attachment 45824
Hi David,
I tested your add-on and I'm getting this error. Also, when saving the file, the full file path is displayed in the name bar. Setting the name without the path always gives the same error. I hope others can test to confirm. Thanks for your work.
Regards,
Francesco
@Cator, @albie0803
The latest version should copy a test.stl file into the program directory usually C:\Program Files\AlibreImportStlAsStep. There is also a test.bat file. If you run the test.bat form a command prompt with elevated permissions it should generate a test.stp file in the same program directory. If test.stp is generated, it confirms that the stltostp executable is working correctly if it fails, I guess you will see some error in the command window - might give me some clue as to the cause of problem you have seen.
David
 
VCRUNTIME140D.dll not found
MSVCP140D.dll not found
VCRUNTIME140_1D.dll not found
ucrtbased.dll not found
 
VCRUNTIME140D.dll not found
MSVCP140D.dll not found
VCRUNTIME140_1D.dll not found
ucrtbased.dll not found
Thanks. I'll check that out. Maybe these are normally installed with the stltostp.exe. I didn't notice these being dependencies. I'll let you know when investigated further. David
 
VCRUNTIME140D.dll not found
MSVCP140D.dll not found
VCRUNTIME140_1D.dll not found
ucrtbased.dll not found
@albie0803, @Cator
I hope this problem is fixed with the latest release:
I've rebuilt stltostp from sources for release deployment. Previously stltostp was a debug version.
Added runtime libraries to fix error on systems where these may not be present.
Fixed errors in convert dialog to ensure conversion process can be cancelled.

Thanks for the testing...
David
 
Just to keep thing interesting, I'm now testing a complete rewrite of the original C++ slugdev code implemented in C#.
I had thought that migrating to C# would result in unacceptably poor performance - but that does not seem to be the case possibly because the 'old' C++ code did not make any use of async methods which the C# does.
I've tested my new code against just a few stl files - it seems to work OK but more testing needed..
 
  • Like
Reactions: tyc
I finally got some time to test your add-on v1.3

It works great. I had no issues with the conversion. It's quite nice to have the progress bar and the ability to cancel the conversion if it takes too long. The bottleneck is still the Alibre import, if there are too many faces. Took a while to import 50mb of converted STP file.

Nevertheless, it's a great add-on. Thanks for your time and enthusiasm.
 
Yup. Worked great for me too. Very impressive indeed.

893k became 20MB became 49MB

(If you can make that final file 5MB you can charge $200 a pop and retire an internet hero)
 
What settings do you use for the stp import?
I have an import that seems stuck at 21%
The CPU usage for Alibre is fluctuating in the Task Manager window so I don't think its locked up.
 
Back
Top