syclone Posted July 24, 2021 Posted July 24, 2021 (edited) Good Day. Started using LDcad recently to make instructions, but need a custom part to complete a project (the new Technic 49.5x14 tyre from upcoming Creator pickup and VW van). I have modified a 49.5x20 tyre to a 14mm width in Blender and exported as .stl (in mm, then exported into LDD to test and it is the perfect size). Now when it came to making a dat, I ran into some issues: - https://github.com/HazenBabcock/stl-to-dat Partially worked, but it output an empty dat file like this: 0 input_file.dat 0 !LDRAW Unofficial_part 0 BFC CERTIFY CCW And Python IDLE writes this error: Traceback (most recent call last): File "D:\lego\stl2ldraw\stl2ldcad.py", line 30, in <module> for line in fp_in: File "C:\Users\Moroz\AppData\Local\Programs\Python\Python39\lib\encodings\cp1251.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 563: character maps to <undefined> >>> - https://gist.github.com/johnholbrook/3db07cda9e267ea6ee53b443588df44c I think I started it correctly, but it did not produce any results at all. - http://marc.klein.free.fr/lego/stl2dat/stl2dat.html I honesty lack the knowledge to make this work. - As last resort, tried Stud.io part designer, which first wanted me to install Stud.io (why???), which I did, but then it refused to properly start up, getting stuck on "parsing file" screen, despite various reinstalls and computer restarts. Are there any other tools that I missed out there? Frankly speaking, I'm inept at any sort of programming and simple command line interactions, even executing a python file has been a challenge for me, so perhaps I'm just commiting an error somewhere? If anyone could help in, or convert the file, I would really appreciate it. The modified .stl: download Edited July 24, 2021 by syclone Quote
1963maniac Posted July 24, 2021 Posted July 24, 2021 In the video, he talks about making .stl files in LDRAW and converting .stl back to .dat, which I believe is what you want to do. Quote
syclone Posted July 24, 2021 Author Posted July 24, 2021 18 minutes ago, 1963maniac said: In the video, he talks about making .stl files in LDRAW and converting .stl back to .dat, which I believe is what you want to do. Thanks for such an interesting video. Seems that he is using the same github code from my first try - will have to dig deeper into python and solve that random error then. Quote
roland Posted July 24, 2021 Posted July 24, 2021 Are you using an ascii (human readable) stl file? If so be sure it's encoded as utf8 and not using some windows codepage. The python error is about an invalid unicode character, which is what happens if you try to use a non utf8 file containing 'weird' (e.g ß etc) characters like it is utf8. Quote
syclone Posted July 24, 2021 Author Posted July 24, 2021 (edited) 34 minutes ago, roland said: Are you using an ascii (human readable) stl file? If so be sure it's encoded as utf8 and not using some windows codepage. The python error is about an invalid unicode character, which is what happens if you try to use a non utf8 file containing 'weird' (e.g ß etc) characters like it is utf8. Thank You so much!!! Indeed, turns out my stl file was a binary one, converted to ASCII and it all worked flawlessly! Didn't even know there were different types of .stl Here's the result, the .dat as well if anyone needs it: download Thank You once again! Edited July 24, 2021 by syclone Quote
1963maniac Posted August 6, 2021 Posted August 6, 2021 I'm now trying to also convert stl files to dat. I'm trying to understand what you did that was successful. I made a custom Lego compatible gear with with gear-v3.scad from thingyverse which is an .stl file. Now I want it to become a .dat file. What did you use to covert to .dat? and then you used converted to ASCII ? Sorry, I'm a novice at this. Quote
syclone Posted August 6, 2021 Author Posted August 6, 2021 1 hour ago, 1963maniac said: I'm now trying to also convert stl files to dat. I'm trying to understand what you did that was successful. I made a custom Lego compatible gear with with gear-v3.scad from thingyverse which is an .stl file. Now I want it to become a .dat file. What did you use to covert to .dat? and then you used converted to ASCII ? Sorry, I'm a novice at this. Yes, I ended up succesful))) - converted my binary .stl file to ascii-encoded .stl using this website tool: https://www.meshconvert.com/ - used this tool to convert the resulting stl into .dat: https://github.com/HazenBabcock/stl-to-dat The .dat converter is a python program, I used Python IDLE, opening the file there, then "Run" > "Run Customised" (or Shift+F5) Then in the command box that opens wrote the input file name (with the .stl extension). The .py program and the input file must be in the same folder, the output .dat will be generated with same name as input file in that folder too. Then I've placed mine into the unofficial library, re-run the indexing executable and was able to use the part. ----------------------------------------------------------- Although I've run into another small issue: When editing in LDCad, the part is invisible, only can see a crosshair marking the part position (it can be edited and placed that way). The part does show up in LDView,POVRay and LDpub though, so instructions and renders are unaffected. Have no idea why this happens. Quote
roland Posted August 6, 2021 Posted August 6, 2021 4 hours ago, syclone said: When editing in LDCad, the part is invisible, only can see a crosshair marking the part position (it can be edited and placed that way). The part does show up in LDView,POVRay and LDpub though, so instructions and renders are unaffected. Have no idea why this happens. Is it a yellow or red crosshair? If yellor it means a render preparation error, in which case I would be interested in the .dat file used. If red it means it couldn't find the referenced part. In that case make sure it is findable by placing it in the same folder as the model using it or in a parts folder of a known library location. Quote
syclone Posted August 6, 2021 Author Posted August 6, 2021 15 minutes ago, roland said: Is it a yellow or red crosshair? If yellor it means a render preparation error, in which case I would be interested in the .dat file used. If red it means it couldn't find the referenced part. In that case make sure it is findable by placing it in the same folder as the model using it or in a parts folder of a known library location. It was a red one, placing the .dat in the model's location fixed it, thank you so much!! Quote
1963maniac Posted August 31, 2021 Posted August 31, 2021 On 8/6/2021 at 11:18 AM, syclone said: Yes, I ended up succesful))) - converted my binary .stl file to ascii-encoded .stl using this website tool: https://www.meshconvert.com/ - used this tool to convert the resulting stl into .dat: https://github.com/HazenBabcock/stl-to-dat The .dat converter is a python program, I used Python IDLE, opening the file there, then "Run" > "Run Customised" (or Shift+F5) Then in the command box that opens wrote the input file name (with the .stl extension). The .py program and the input file must be in the same folder, the output .dat will be generated with same name as input file in that folder too. Then I've placed mine into the unofficial library, re-run the indexing executable and was able to use the part. ----------------------------------------------------------- Although I've run into another small issue: When editing in LDCad, the part is invisible, only can see a crosshair marking the part position (it can be edited and placed that way). The part does show up in LDView,POVRay and LDpub though, so instructions and renders are unaffected. Have no idea why this happens. I'm kind of stuck. I had https://www.meshconvert.com/ convert my file to ascii. I just don't know enough about this to be successful. My son is printing some roller coaster track and I would really like to be able to use this part in my track layouts. I downloaded https://github.com/HazenBabcock/stl-to-dat . Does the Hazen Babcock converter have to be used within a "Py" program? Would someone be kind enough to help me get my file converted to .dat? I would be forever grateful!! Quote
syclone Posted August 31, 2021 Author Posted August 31, 2021 10 hours ago, 1963maniac said: I'm kind of stuck. I had https://www.meshconvert.com/ convert my file to ascii. I just don't know enough about this to be successful. My son is printing some roller coaster track and I would really like to be able to use this part in my track layouts. I downloaded https://github.com/HazenBabcock/stl-to-dat . Does the Hazen Babcock converter have to be used within a "Py" program? Would someone be kind enough to help me get my file converted to .dat? I would be forever grateful!! Yes, his program has to be used via Python: https://www.python.org/downloads/ Though I can convert these to .dat for you, you can send the files through PM if you need Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.