Category Archives: 3D Modeling

Coding Custom Infills for the Slic3r Based Slicers (PrusaSlicer, Bambu Studio, Orca, etc.)

Prusa Slicer and Bambu Studio are built over the Slic3r code base. In a meeting proceeding the 2023 East Coast RepRap Festival (ERRF), the board members made a joke about making our own ERRF infill pattern. It got me wondering, what would be involved with making a custom infill? I downloaded the PrusaSlicer code from GitHub and it turned out and it is pretty do-able with the Visual Studio 2022 I already use for other projects.

Here’s how I approached it. I’ve only done this in PrusaSlicer, but I believe the steps should be similar in other Slic3r-based slicers like Bambu Studio and Orca. I’ve done three infills now – the original ERRF, one for 3DPrintopia, and my favorite some tessellated hearts!

Heart Infill!

Note: Not everything in this giant post is going to apply to you, but the information is there for those who will find it handy. If you need a TL;DR, the most basic steps would be:

  1. Get the source code on your development machine.
  2. Plan out the “output points” for your pattern. This could be low-tech like graph paper or you could use a tool like Blender.
  3. Update the code. The impacted files would be:
    1. libslic3r\Fill\FillPlanePath.cpp – Add your logic to define all your output points.
    2. libslic3r\Fill\FillPlanePath.hpp – Add declarations for your new infill functions in FillPlanePath.cpp.
    3. libslic3r\Fill\Fill.cpp – Add in a new case into the surface_fill.params.pattern switch statement.
    4. libslic3r\Fill\FillBase.cpp – Add a new case into the new_from_type switch statement.
    5. libslic3r\PrintConfig.cpp – Add new values into:
      1. s_keys_map_InfillPattern.
      2. Fill pattern options in PrintConfigDef.
    6. libslic3r\PrintConfig.hpp – Add a new value into the InfillPattern enum.
    7. libslic3d\PrintObject.cpp – Optional – you can add in a new case for determine_bridging_angle.
  4. Test your infill.
  5. Print!

Getting and Building the Source Code

I think for me, the longest step was getting the source code ready and initially compiled on my machine.You can get the source code of the slicer you want from GitHub:

PrusaSlicer Souce Code
Bambu Studio Source Code
Slic3r Source Code

Building On Your Development Machine

The PrusaSlicer doc folder on GitHub has “How to Build” instructions for Windows, Linux and MacOS. Like everything Prusa does, the documentation was thorough and helpful! I’m working on a Windows machine, so I used the “Building PrusaSlicer on Windows” instructions. I think the instructions did a great job of highlighting the prerequisites and walking me through the process.

Planning The Infill

The code is in C++ which I hadn’t worked with in over two decades. Luckily, one can be rusty in C++ and still copy and paste! I started by looking through the infill code in the libslicer\Fill directory. The FillPlanePath.cpp is where I ran across the Hilbert Curve. It was pretty much just making a large collection of points for the infill, like connect the dots. That meant I just needed logic to come up with my points. Once I make all my output points, all the existing code does the rest.

Planning with Graph Paper

I decided on my points for the ERRF infill and the 3DPrintopia Infill in a decidedly low-tech way. I got out graph paper, I drew what I wanted and planned my points.

Drawing my ERRF Infill

Tip – One best practice I learned is if you are doing text and you want it readable from the top of your print, you’ll want to plot your points backwards (a mirror image of what you want).

When you are planning your infill, think about it as one continuous line. This also means considering how you are going to start a brand new line of your pattern. You don’t want the printer to draw (or collide!) with lines that were already printed.

An example of what you *don’t* want.

You could address it like a typewriter where at the end of each line, you add in some points that get you back to the beginning for the next line. With the ERRF and 3DPrintopia text, that journey back to the start gave me an opportunity to refine my letters more. With a continuous path the R’s were pretty basic, but on my way back to start a new line, I could take a quick “detour” and draw some little holes in my R’s.

If you look again at my ERRF graph paper, you’ll see two sections of points. First, I have my points that draw my base letters which can be repeated as much as necessary.

ERRF Points - Initial Pass
ERRF Points – Initial Pass

Then for the return back to the start of the beginning of the “page”, I have my points to fill in extra details for the letters to come.

ERRF Points - Return Pass
ERRF Points – Return pass

I translated both of those to x/y coordinates using the graph paper as a guide.

Figuring out the coordinates to draw a single ERRF
Coordinate points for my “connector” line for the ERRF Infill

Planning The Infill (With Blender and Python)

The heart infill, I expected to be more complicated and with more points, so I attacked that in a different way. In Blender, I used a Bezier Curve to draw my heart (with an Array modifier to give me an idea of how it would look with repetition). Once I was satisfied with the shape, I right clicked on it and chose Convert To -> Mesh.

Converting a curve to a mesh in Blender

That converted my curve to vertices/points. Instead of graph paper, I could then refer to Blender’s coordinate system to get my output points.

Planning my output points using Blender’s coordinate system

The heart was a lot of points and it was going to be a wee tedious to grab the X and Y coordinate of all 106 vertices. In this case, I decided to speed up the process using a Python script. Under the Scripting tab, I ran the following code to not only get my coordinates, but write out the lines of C++ code I would ultimately need for the slicer (more later):

The Python script in Blender to get the coordinates of all the vertices

Viewing Results in the Blender System Console

If you are new to Python scripting for Blender and are wondering how to see the results of all your “print” commands, go to the Window main menu and hit Toggle System Console.

How to view the System Console in Blender

This will give you access to a Command window where you can see the fruit of your labor.

The code produced by the Python script

Sorting the Vertices in Blender for the Python Script

I was so excited when my code worked but when I started spot checking I noticed my vertices were not in order. This was going to be an issue because I’m aiming for a continuous line for the slicer to draw. My vision is not going to come to life if the tool path isn’t going in order. I needed to figure out a way to control the order of the output points.

In Blender, vertices are assigned an index as they are created. In Overlays, if you check Text Info, you can see those indexes.

Using overlaps to see vertex index numbers

Doing so revealed that my vertices were dreadfully out of the order and that was trickling down to the output points my Python script was so helpfully making for me.

Oh no, my vertices are terribly out of order!

I could have considered changing my Python code, but I ended up using a nice “Shape Keys” Hack by StackOverflow user leander. Once I did that, my points where going from 0 to 101 in the order that I wanted the slicer to draw them.

Corrected order of the vertices

Using ChatGPT to Reverse the Points

With the ERRF and 3DPrintopia infill when the nozzle was traveling back to the starting X coordinate to start a new line, I was using it to fill out the letters more. I didn’t need that for the hearts, so on the way back, I just wanted to draw another row of hearts…but in reverse. I got that code by pasting in my original code and asking ChatGPT to reverse it for me. It did a good job!

Using ChatGPT to reverse my output points code.


Arguably a better way to approach that would be to create an array of all the points then it would be easy to print them forward or backwards. But hey, this way I finally got to use ChatGPT for some coding. 🙂

Coding the Infill

With the actual coding of the infill, there are seven files in the PrusaSlicer-master solution that are updated. If you don’t want to hash through this blog post, another thing you could do is simply search for “hilbert” in the code to locate the spots you need to revise. That’s what I originally did!

I’m including marked up screenshots of the code changes and then I’m also including GitHub Gist excerpts where you can copy and paste.

Tip – With the GitHub Gist examples, if you click on the filename at the bottom of the code and then click on Revisions, you can see what lines were changed (with existing functions).

List of Changed Files for Infill

libslic3r\Fill\FillPlanePath.cpp

This is the file where all the action is. I pretty much copied two functions, renamed them, and updated them for the infill I was working on:

  • void FillHilbertCurve::generate
  • static void generate_hilbert_curve

FillHearts::generate
This function is a straight copy of the FillHilbertCurve::generate. The only difference is it is renamed.

New FillHearts::generate

generate_hearts

Thanks to the hard work of all the code contributers before me, the generate_hearts function first determines how many columns and rows of hearts we’ll want to print. This is based off the object_width and object_height variables which I set according to the size of the pattern. With the Hearts example, one heart section is 12.4334 mm wide and 13.7993 mm high. My code added just a little padding to the height for aesthetic purposes, but for the most part, you can fill in the dimensions of your pattern block.

Relationship between the pattern size and the object_width and object_height variables.

The generate_hearts function already receives the minimum and maximum x and y coordinates for the 3D model. It is simple division to determine how many rows and columns of hearts would be needed.

Once we know how many columns and rows of hearts we’ll need, it is two nested loops to go through and add all our “output points”. The first goes through all the “rows” of hearts and the second one goes through all the “columns” of hearts.

When we are determining the y coordinate of a single heart block, we are adjusting the coordinates from Blender based on what row the heart is in.

The row the heart is in determines its Y position

Similarly, the x coordinate is adjusted based on the column the heart is in.

The column the heart is in determines its X position

To keep one continuous line, the rows of hearts alternate whether they are going forwards or backwards. The even rows, including the very first one (Row #0) draw forwards. The next row, an odd row, also loops through the columns, but it goes backwards to draw the hearts in the opposite order.

The row the heart is in determines is Y position
New generate_hearts function


libslic3r\Fill\FillPlanePath.hpp

In this header file, we are going to put in declarations for our new infill pattern. Here I shamelessly copied the FillHilbertCurve code and adjusted it for Hearts.

List of Changed Files for Infill

libslic3r\Fill\Fill.cpp

In the switch statement for surface_fill.params.pattern, we add in a case for the new infill pattern (ip).

Changes to Fill.cpp

libslic3r\Fill\FillBase.cpp

In the switch statement in the new_from_type put in a case for your new infill pattern (ip) and return a call to your new function for drawing the infill.

Changes to FillBase.cpp

libslic3r\PrintConfig.cpp

There are two changes in the PrintConfig.cpp file.

s_keys_map_InfillPattern
In s_keys_map_InfillPattern, we are setting up a new enum with our option.

Adding a new s_keys_map_InfillPattern to PrintConfig.cpp

Low-fill infill density

Under PrintConfigDef function, we are adding a new entry to the low-fill infill density pattern.

Adding a new low-density infill to PrintConfig.cpp

Solid/Top Infill
You do not have to make any changes to the solid/top infill section.

You don’t need to add to the solid-fill-pattern

libslic3r\PrintConfig.hpp

Update the InfillPattern enum to include our new infill pattern (ip).

Changes to PrintConfig.hpp

libslic3r\PrintObject.cpp

Optional – in the determine_bridging_angle function, add logic for the new infill pattern. I just copied and pasted from, you’ve guessed it, the Hilbert Curve. 🙂

Changes to PrintObject.cpp

Testing the Infill

One of the most crucial steps is testing your infill. One easy way to do this is once your code is running and your PrusaSlicer comes up, right click on the bed and choose Add Shape and add a quick Cylinder or Box. Update your infill setting and give it a whirl!

A quick way to test is to Add Shape

Just like any other code, you may have some debugging opportunities. These could just be benign like a missing point in your logic.

Whoops – I’m missing some points in my T and my A

But they could also be things that are detrimental to the health and happiness of your printer.

Whoops– my row of hearts is overlapping.

When you slice, if PrusaSlicer gives you a “Detected print stability issues” warning, pay attention.

One neat thing about the code is it already handles the different infill percentages. You don’t have to write any code for that… though I think it is all relative. I don’t think the percentages are going to be an accurate assessment of how filled your object is. 🙂

Heart Infill – 90% and 5%

Print Your Infill!

Admittedly, there are not a lot of practical applications as infill is usually hidden away inside the print. That said, there are a lot of aesthetic applications when you start removing top and bottom layers and even more so when you start to use modifiers to only expose infill on certain parts of your object!

Desktop Makes has some great examples of exposed infill ornaments and this video from Prusa3D is a great illustration of what can be done with modifiers.

Printing the ERRF Infill.
Printing the ERRF Infill.


Good luck and enjoy!

Using Blender’s Curve Modifier for 3D Printing

In this video, we discuss Blender’s Curve Modifier. I do a quick overview of its usage then I share a variety of projects I have used it in to give you an idea of the capabilities. A lot of my Curve Modifier progress was the product of “brute force”. I end the video with some tips to hopefully help your journey go a bit smoother. 🙂



00:39 – Overview of Curve Modifier

Example Projects
02:05 – Maker Coin – Curving Horizontal Text
02:24 – Custom Gazebo – Curving Vertical Text
02:40 – I Ching Coffee Cup – Curves Can Have Sharp Edges Like Hexagons 03:00 – Standing Cancer Ribbon – 3D Curves
03:33 – “Dial-O-Lantern” – Curving Faces to Carve Out of a Pumpkin
04:14 – Soda Can Cuff Bracelets – Modeling Flat and Curving at the End
04:40 – Cthulhu Air Plant Holder – Real-Time Design Changes ‘

Tips
06:01 – Curves Have Direction
07:08 – Watch Out for Negative Scales
08:00 – Impact of Object Origins
10:51 – More Vertices are Better

New to Blender?
If you are looking for a good video-based introductory course to Blender, I recommend the online courses by JWall at Print That Thing. https://www.community.ptt.live/

Photo Credit
Pond by Kaveh https://www.flickr.com/photos/kavehkh…

Thank you for watching. Happy Modeling and Printing!

3D Printed Ornaments – Strategies for Hanging and Balancing

Tis the season for 3D Printed Ornaments! In this video, I’ll go over some techniques and approaches I have used in my ornaments to hang and balance them.



Hanging
0:43 – Poke a Hole in the Piece for a Ribbon or Hook
1:18 – Glue Two Mirrored Pieces Together
2:31 – Include Your Own 3D Printed Clasp into the Design
3:35 – Embed Split/Jump Rings into your Design
Balancing
5:14 – Using Blender for Guidance on the Center of Gravity
6:54 – Adding a Symmetrical Base
7:16 – Adding a Hidden Counterweight


If you are interested in my Etsy shop, that can be found at https://www.etsy.com/shop/vickytgaw Thanks for watching! Have a great day!

Wine Cork Turkeys

My latest upcycling 3D Printing project is a Turkey Centerpiece feature 24 of my mother’s wine corks. This is my first model uploaded to Prusa Printers! https://www.prusaprinters.org/prints/…



3:53 – Slicing Snippet (with Cura) – Don’t forget the hypotenuse of a triangle is greater than its parts. Practical application – try rotate for fitting larger parts.
4:57 – Blender Bit – By default Blender rotates around an object’s origin (usually the center of mass). You can change either your object’s origin or the pivot point to better control your rotations.

When printing the head, this is where I do my color switches:
0 – 25mm – Brown (in 0.25 mm layers)
25 – 25.40 – White (in 0.10mm layers)
25.40 – 25.80 – Black (in 0.10 mm layers)
25.80 – 26.20 – Orange (in 0.10 layers)
26.20 – End – Burgundy (in 0.10 layers)

Happy Thanksgiving! P.S. Speaking of the holidays, my 3D Printing Etsy store is at: https://www.etsy.com/shop/vickytgaw

P.S.S. If you are curious about my husband’s computer science/board game channel, that is at   
Ryan Somma – YouTube

Upcycling Keurig K-Cups into Daisies

I published a new video today going over how to upcycle Keurig K-Cups into daisies.

Although I do use 3D Printing, this project does not necessarily need to require 3D Printing.

NOTE – There is no slicing or modeling footage in this video. Instead, you’ll have a lot of footage of processing K-Cups. A lot of footage. 🙂

COMPOSTING (Starts at 1:30)
With removing the grounds from the K-Cups, you do have some options:
1) 3D Printed K-Cup Compost Tool from Shapeways (One of my earliest designs) https://www.shapeways.com/product/3SH…
2) 3D Printed Coffee Monsta Designed by Derek Bibeau https://www.thingiverse.com/thing:711329
3) Non 3D Printing Option – -A Fork (which is what I most commonly use now-a-days.

CUTTING DAISIES (Starts at 3:35)
With just a couple of deviations, my process mirrors the one documented in the Make It Easy Crafts blog post on making a Patriotic Wreath: http://www.makeiteasycrafts.com/2012/… Eventually, I sped up and improved the accuracy of the project with a 3D Printed template. That template is available on Thingiverse at: https://www.thingiverse.com/thing:370…

MAKING CENTERS (Starts at 6:05)
I use 3D Printed Centers for my daisies which can be downloaded from Thingiverse (https://www.thingiverse.com/thing:370…) or purchased at Etsy (https://www.etsy.com/listing/715459369/) BUT– you don’t have to use 3D Printed centers. The Make It Easy Blog used embossed felt.

For the Virginia Tech Maker Festival last fall, we used a 1 1/2″ Circle Punch and yellow paper to help kids make their own flowers at the show.

FINAL ASSEMBLY (Starts at 7:42)
I used Goop to affix the centers to the K-Cups. For the pendant lamp shade, I used the Regolit shade from IKEA (https://www.ikea.com/us/en/catalog/pr…) and affixed the daisies via a Glue Gun.

You can also double up and paint the daisies for a different look. If you do paint them, I recommend covering a spot on the center with painters or masking tape. That way, your center is glued directly to the K-Cup and not a layer of paint.

Please do share any K-Cup projects you tackle. I would love to see them. As always, thank you for watching!

3D Printed / Plastic Canvas Heron

This year for my fifth Maker Faire Nova, I wanted to combine crafting and 3D Printing. I decided to make a giant 3 foot wide Great Blue Heron. The blank panels are 12 3D Printed pieces and all the colors were comprised of 130 hand-stitched Plastic Canvas panels. I am so in love with the final result and look forward to sharing it in June!

The 3D Modeling was done in Blender. I’m still working in Blender 2.78. I really do need to check out the beta version.

Most of the design work was done with Bezier Curves. Bezier curves are discussed in detail in the second chapter of “Blender 3D Printed by Example”*. I also did a talk on this topic at Northern Virginia Community College. The slides with step by step screenshots are at: https://www.slideshare.net/VickyTGAW/…

*If you do want to buy my book, please consider supporting another member of our 3D Printing community by using their Amazon Affiliate Link.

I translated my Heron design to 3D Printed outlines by using Blender’s Inset feature. Heads up– when you type in specific dimensions for Inset, those dimensions are for your object when it is at the 1:1:1 scale. The best practice is to first go to Object-Apply-Scale to tell Blender your object’s current dimensions are that 1:1:1 scale and THEN do your insets. For my outlines, I went with a thickness of 2mm. However, if you are hoping your piece supports itself, you’ll want to go thicker.

For printing, I split my outlines into 12 pieces with a maximum dimension of 280mm x 280mm. I believe We The Builders uses NetFabb to break up their community builds. In my case, I used the Boolean Intersection modifier in Blender.

The 3D Printed pieces also served as my templates for cutting the plastic canvas.

Tip– use colored Sharpies to help identify the pieces. Corollary tip – Invest in a white Sharpie for white pieces. When I used pink, it bleed all over my beautiful heron white.

Stitching was a THREE generation effort. Thank you to my Mom, my oldest son (and his classmate Gio!), and my husband for each tackling a panel.

Assembly was made MUCH easier thanks to a purchase of a custom frame from American Frame. I went with a frame with a 3/4″ rabbet height to accomodate the thickness of the 3D print, the plastic canvas, and the stitching. The outlines were attached by a Gorilla Super Glue Gel and black electrical tape. The needlework panels were attached with a glue gun. I spent a lot of time on the floor with this project. 🙂

I hope to see some of you at Maker Faire Nova. If not, perhaps the East Coast Rep Rap Festival which is October 12th-13th, 2019 in Bel Air, Maryland. Thanks for watching!

Blender and Bezier Curves for 3D Printing on SlideShare

The Northern Virginia Community College is working on a T-Shirt 3D Printer. They invited me to come by and show the students how they could use Blender and Bezier Curves to turn 2D ideas into simple 3D models for the T-Shirt Printer. I had an absolutely fantastic time, as I always do talking about 3D Printing. If you missed it, you can still follow along with my slides from SlideShare.

Cork Kitty Model on Thingiverse

Now that Maker Faire Nova is behind me, I am aiming to get my Upcycling models up and available to download for the community. This model preexisted my recent Maker Faire Nova efforts. I designed this Cork Kitty as a companion piece to EHM’s Cork Puppy back in the summer of 2015. They have been popular at Craft Fairs and black cats are particularly popular at Halloween.

Cork Kitties - Group

For me, I found the model to be an unintimidating way to ease into painting prints. The raised details of the face lend themselves well to painting. I find brushes geared for miniature painting to work well. I use Majestic Royal and Langnickel Short Handle Paint Brush Set, Detail, 11-Piece (Affiliate link).

I typically make the eyes green and the nose and ears pink. You can add paint to the whiskers. A dark grey looks particularly striking on black cats. I have done custom orders on Etsy where we mimick the markings to real cats.

I had a friend put a slice through the cork to hold labels describing all the dishes at a Halloween party.

Occoquan Craft Show - Eight Black Cork Kitties
A Friend Used a Set of Black Cats as Buffet Labels for a Halloween Pot Luck

Although they are made from wine corks, I have found them to have appeal to children. They love playing for them! Happy making!

IMG_20151212_135056884
Children Playing with Cork Kitties

P.S. If you don’t have access to a 3D Printer and covet a Cork Kitty, you can purchase one from me on Etsy.

Blender 3D Printing by Example – Published and On Sale!

Greetings All! Working with Packt, I wrote a project-based learning book to teach Blender for 3D Printing. It got published last week! I decided my return to YouTube should be called, “You Guys, I Wrote a Book!!!”.

The book walks through four separate projects to teach Blender tools and skills.

Profile Pendant

  • Background Images
  • Bezier Curves
  • Extrude
  • Boolean Union

Coordinate Bracelet

  • Standard Shapes
  • Mirror Modifier
  • Boolean Difference
  • Text

House Figurine

  • Loop Cut and Slide
  • Extrude
  • Inset
  • Subdivide
  • Array Modifier
  • Using SVGs
  • Boolean Intersection


Human Hand

  • Subdivision Surface Modifier
  • Topology Edits
  • Proportional Editing
  • Materials
  • UV Maps

YOU DO NOT HAVE TO BUY MY BOOK! I am already very happy as is. If you do wish to have a copy, you can purchase the book on Amazon.

What’s next for me? I have a long list of videos I would like to make. I’ll be working on my proposal and projects for the MakerFaireNova on March 18, 2018. I will also be helping with the East Coast RepRap Festival which is looking like it will be in late June. Also don’t forget to check out the Friday Night 3D Printing Community Hangouts . I’ve been known to show up from time to time. 🙂