slic3r / Slic3r

Open Source toolpath generator for 3D printers
https://slic3r.org/
GNU Affero General Public License v3.0
3.35k stars 1.29k forks source link

Reading color attributes for vertices from obj files #5137

Open balloonhotair opened 2 years ago

balloonhotair commented 2 years ago

Has anyone tried to accessed the color info for the vertices within obj files to create gcode filament changes? Meshlab can take ply files with color attributes for the vertices and save the files as obj with the color info intact so I was looking to see if I can modify the slicer to do the filament changes when producing the gcode. If there is anybody who could point me to the files that read in obj files would be big time saver. I see there is a gcode writer class so that should be the other end of my idea. I did a fair amount of C++ years back so the coding part I know, it is just getting a feel for where all the pieces are in github that I would like to make quicker and anything to be aware of if I do this.

lordofhyphens commented 2 years ago

Don't believe we have. That would be under libslic3r's src.

https://github.com/slic3r/Slic3r/tree/merill-merge/src/libslic3r

You want the Format classes, things that touch TriangleMesh.

Color in the UI isn't used in slicing (it's a Material property).

You probably should subdivide the mesh into its components based on color if you wanted to get this through with the least amount of pain and suffering.

On Thu, Apr 7, 2022, 3:35 PM balloonhotair @.***> wrote:

Has anyone tried to accessed the color info for the vertices within obj files to create gcode filament changes? Meshlab can take ply files with color attributes for the vertices and save the files as obj with the color info intact so I was looking to see if I can modify the slicer to do the filament changes when producing the gcode. If there is anybody who could point me to the files that read in obj files would be big time saver. I see there is a gcode writer class so that should be the other end of my idea. I did a fair amount of C++ years back so the coding part I know, it is just getting a feel for where all the pieces are in github that I would like to make quicker and anything to be aware of if I do this.

— Reply to this email directly, view it on GitHub https://github.com/slic3r/Slic3r/issues/5137, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAHYCTJG35RDJQ74ALJV4LVD5BJ5ANCNFSM5S2RD6BQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

lordofhyphens commented 2 years ago

You should target that branch for your changes.

On Thu, Apr 7, 2022, 4:08 PM Joe Lenox @.***> wrote:

Don't believe we have. That would be under libslic3r's src.

https://github.com/slic3r/Slic3r/tree/merill-merge/src/libslic3r

You want the Format classes, things that touch TriangleMesh.

Color in the UI isn't used in slicing (it's a Material property).

You probably should subdivide the mesh into its components based on color if you wanted to get this through with the least amount of pain and suffering.

On Thu, Apr 7, 2022, 3:35 PM balloonhotair @.***> wrote:

Has anyone tried to accessed the color info for the vertices within obj files to create gcode filament changes? Meshlab can take ply files with color attributes for the vertices and save the files as obj with the color info intact so I was looking to see if I can modify the slicer to do the filament changes when producing the gcode. If there is anybody who could point me to the files that read in obj files would be big time saver. I see there is a gcode writer class so that should be the other end of my idea. I did a fair amount of C++ years back so the coding part I know, it is just getting a feel for where all the pieces are in github that I would like to make quicker and anything to be aware of if I do this.

— Reply to this email directly, view it on GitHub https://github.com/slic3r/Slic3r/issues/5137, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAHYCTJG35RDJQ74ALJV4LVD5BJ5ANCNFSM5S2RD6BQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

balloonhotair commented 2 years ago

Thanks you for giving me a starting point.

supermerill commented 2 years ago

check the GLGizmoMmuSegmentation::update_model_object() it shows how to set the ModelObject's ModelVolume's mmu_segmentation_facets

I don't 100% understand the code. The data object is a bit cryptic (usage is in TriangleSelector::deserialize, but I don't understand it fully)