1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Script Release: STL Import

Discussion in 'Alibre Script' started by NateLiqGrav, Apr 20, 2020.

  1. NateLiqGrav

    NateLiqGrav Alibre Super User

    upload_2020-4-20_23-18-5.png

    This script uses the open source stltostp to convert the STL file to an STP file and then optionally import it into Alibre.
    You must download and install stltostp before running.
    https://github.com/slugdev/stltostp

    If you installed stltostp but the script can't find it then you will need to correct the path in the code:
    Code:
    path_to_stltostp_exe = r'C:\Program Files\stltostp\1.0\bin\stltostp.exe'
    If the script says "Took too long. I stopped waiting." then you will need to extend the max time in the code:
    Code:
    MaxWaitTime = 100 #number of seconds to wait for the conversion to finish
    Please post here about any issues or suggestions. Also let me know if you use it and like it or even if you don't.

    [edit]
    Added new version with more error checking.
    'STL Import.py' was downloaded 21 times before being replaced by 'STL Import3.py'
    [/edit]
     

    Attached Files:

    Last edited: May 11, 2020
    M00m137, anson, markporter and 3 others like this.
  2. I am trying to open the exe file but nothing happens.
     
  3. NateLiqGrav

    NateLiqGrav Alibre Super User

    Hello Matthew,
    Per the creator of the stltostp.exe file - it is a Command line utility.

    It does not have a graphical user interface. Meaning you can only run it manually from the Windows Command Prompt or using another script/program. That is why I made this Alibre Script to run it.
     
  4. TimoCAD

    TimoCAD Senior Member

    What about letting the User pass the Installation path of 'stltostp' to the program at first start? Suggestion!

    Great work thumbs up!
     
  5. anson

    anson Member

    Im having trouble getting it to work. I just get this error:
    Code:
    >>>
    0 seconds waiting for conversion
    Done!
    C:\Users\Dell T3500\Downloads\stltostp-master\stltostp-master\test\bucket.stp
    Encounter problem importing.
    Exiting.
    >>>
    
     
  6. NateLiqGrav

    NateLiqGrav Alibre Super User

    This usually means something was wrong with the STL format. Can you upload the STL file for testing?
     
  7. anson

    anson Member

  8. NateLiqGrav

    NateLiqGrav Alibre Super User

    I had no problem with the bucket.stl or any STL file from there.
    I have added more error checking to let the user know if something was entered wrong.
    Try downloading the new version of my script and bucket.stl file again and trying again.
     
  9. anson

    anson Member

    I gave it three more tries this morning.
    Code:
    >>>
      File "", line 83
                    except
    
                          ^
    SyntaxError: unexpected token '<newline>'
    
    >>>
    Then I added a colon at the end of line 83
    Code:
    >>>
    0 seconds waiting for conversion to finish.
    Unknown parameter C:\Users\Dell
    Opening STP file.
    Encounter problem importing.
    Exiting.
    >>>
    
    This appears to be a space in file path problem so I put quotes around the path
    Code:
    >>>
    Wrong extension for STL Input File.
    Exiting.
    >>>
    
    Thanks for all your help. What else do you suggest I should try?
     
  10. NateLiqGrav

    NateLiqGrav Alibre Super User

    Ok, I see whats going on now.
    I accidentally deleted the colon when I deleted a console print just below it. I have fixed that.
    The other issue is that paths with spaces needed to be wrapped in double quotes - but only at the time they are passed to stltostp. Thank you for helping me pinpoint that issue. Please try the new upload.
     
  11. CADNoob

    CADNoob New Member

    I am having the following issue when I try and run the script, it seeems to work but this is the output from the console:

    0 seconds waiting for conversion to finish.
    Minimum edge tolerance set to 1e-06 Read 88 triangles from C:\Users\mitch\OneDrive\Desktop\Ender3\Files\STL\HEX Remote Test Box Connector Wedge.stl Merged 132 edges Exported STEP file: C:\Users\mitch\OneDrive\Desktop\Ender3\Files\STEP\HEX Remote Test Box Connector Wedge.stp
    Output File Not Found

    There is no *.stp file yet I thought that this script would create that
     
  12. NateLiqGrav

    NateLiqGrav Alibre Super User

    I noticed that the paths are different. Can you confirm that the STEP folder path exists before it tries to export it? I'm guessing it doesn't. If the folder structure does not exist it does not currently create it automatically.
     
  13. CADNoob

    CADNoob New Member

    Thanks for getting back to me, yes the paths are different in the files folder I have 2 sub-folders STL ( where the input files are) and STEP (where I want the converted files to be placed.
     
  14. CADNoob

    CADNoob New Member

    I moved the stl file to the root C:\ file.stl Then enterd this in the pop up:
    STL Input file: C:\file.stl
    STP Output File: C:\file.stp

    I unchecked Open In Alibre after Output? This is what was in the console:

    0 seconds waiting for conversion to finish.
    Minimum edge tolerance set to 1e-06 Read 88 triangles from C:\file.stl Merged 132 edges Exported STEP file: C:\file.stp

    Now the problem is there is no file.stp although the script claims to have exported it...

    Have any clue?
     
  15. CADNoob

    CADNoob New Member


    I have investigated further. I ran just the converter stltostp in the command line and get the same results, I can not find the step file?
     
  16. NateLiqGrav

    NateLiqGrav Alibre Super User

    I'm afraid I don't know. I didn't make the original stltostp command line program. I just wrapped it in an Alibre Script for convenience and added features. Perhaps try another program to see if it has issues with that stl file?
     
  17. srjacob

    srjacob Senior Member

    I tried to STLtoSTP as a standalone program, and it didn't work for the stl files I downloaded. It said that I couldn't find any triangle, but FreeCad converted the file. Unfortunately, the converted file was too big and Alibre choked on it.

    Any good conversion advice would be appreciated.
     
  18. bigseb

    bigseb Alibre Super User

    From another thread:

     
  19. NateLiqGrav

    NateLiqGrav Alibre Super User

Share This Page