Converting STL to Collada [dae] #119
Unanswered
jlpoolen
asked this question in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building objects in OpenSCAD and then exporting them as STL (stereolithography CAD software created by 3D System) so that I can convert the STL into Collada ("*.dae") (COLLAborative Design Activity) which can then be imported into good old own-your-own software SketchUp Pro v. 8.0 (2012).
I wanted to be able to quickly take my STL exports and convert them. While I found the web site https://3d-convert.com/en/ extremely helpful and able to accomplish that goal, my penchant to do what I can myself brought me to MeshLab which, in turn, brought me to this project, PyMeshLab, since the MeshLab server was discontinued in favor of this project.
I was unsuccessful in finding an examples of documentation that touched on what I wanted to accomplish. I'm posting now because I just wanted to document how simple it is to perform a conversion.
After installing PyMeshLab (in Gentoo use the "pip install --user pymeshlab" to keep the install specific to the user and not alter the system's Python managed by Gentoo), I searched around for some conversion examples. Finding none, I started digging around and finally concocted this script, test_PyMeshLab1.py, which simply opens and magically converts by specifying the file extension "dae". Sometime cleverness and "intuitive" escape newcomers leaving them in the lurch. I was expecting some sort of "convert" function or something. Here's my script:
A very important point. I found what I imported into SketchUp to be extremely large and had to be scaled down and rotated, as it turns out the scaling 1000. So I did a little digging and found that my converted Collada file (Collada is in XML format) from 3d-convert.com had at the head of the file:
I then got hold of the Collada Specification at https://www.khronos.org/collada/, specifically COLLADA 1.4.1 Specification (Second edition) managed by the nonprofit technology consortium, the Khronos Group, and read up on the element and its attributes. OpenSCAD has units, but they are not tied to anything such as inches or meters, they're just units. My OpenSCAD script was designed using units as inches, but that assumption is not in code anywhere and there is nothing to retain that assumption in the STL export. I found I had to make the following alteration in my collada export as follows to have it nicely import at the desired dimension and rotation:
The value "0.0253999862840074" is what an inch represents in meters. I also changed to "Z_UP" since the default "Y_UP" and "X_UP" caused the object to come in at a rotation other than what I wanted.
So this posting is for the next person in my seat who is working with OpenSCAD and importing into SketchUP via PyMeshLab so everything is mapped out and you can be up and running without having invested the hours I did.
Beta Was this translation helpful? Give feedback.
All reactions