API question: "save as" STL (with color) file format?

Hi!
I am using Solidworks API in VC++ 6.0 I could use "saveAs4" to save as STL files. But now I wish to save to STL files with color information (R,G,B)
Is it possible for me to do this?
Thank you!
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Well I'm sure you've already been through the API help. Nothing there that I could see to help you out. In fact, from looking at the SolidWorks UI I don't think this can be done (ie - file -> save). If it isn't possible through UI it most certainly wouldn't be available through the api. Perhaps there is a third party program for opening and saving SW files as STL you could utilize?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thank you, Mr Who. Indeed, no special type of STL could be saved in SolidWorks UI. Actually I searched on the web and found something about coloured STL in links such as this: http://rpdrc.ic.polyu.edu.hk/old_files/stl_colour_binary_format.htm
What I wish to do is to obtain the colour information from a part or assembly file. STL format stores vertices and normals, while in the API color information can be obtained only by features or faces (using MaterialProperties). I have the problem of matching the color obtained from API methods with STL structure.
Thanks a lot.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
I see. It might be possible, but I am having trouble getting my head around it.

the form of triangles. Each triangle can have its own color. So the million dollar question is; How do you map the color on a face to the triangles that get mapped out to an STL file?
The answer is to hire a $10 an hour intern to spend the whole summer color mapping =). Seriously though, you would have to find some means of correlating the normal and vertex information with SolidWorks normal and vertex information. But one thing you should investigate and may not work is whether normals stay the same when exported to STL. There will be two types of surfaces exported, planar and nonplanar. I would assume the SolidWorks STL export has to break up nonplanar surfaces into many triangles. These will be difficult to analzye and we can return to later. Let's start by thinking about planar surfaces.
Start by making sure that exported planar surfaces properly report their normal direction. Export a cube and match the triangles with the SW model. If the normal information is correct then you are good to continue.
Now you have to consider planar surfaces that have curved edges. I assume these will get broken up into multiple triangles for STL too. And I'm pretty much out of ideas here. Without being able to correlate vertice information to SolidWorks edge/vertice information there is now way to determine whether a specific triangle originally made up a face.
My next suggestion would be to put in an enhancement request to SolidWorks because all of this would be a LOT easier if the translation tool actually wrote out the color information for you.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Why color an STL?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.