Modify STL 3D printing files with FreeCAD

There are many free STL files are available on the internet to 3D print useful objects at home. There are times when we want to make some adjustments to them to better fit our need or 3D printing equipment. If the STL file describes an object that is larger than the maximum dimensions your printer can produce, you can print the object in two or more pieces and glue them together. There are glues on the market that can make as strong bonds as the materials themselves they are attaching together.

There are free applications that can open and edit STL files, one of them is the open source FreeCAD.

Download FreeCAD from https://www.freecadweb.org/wiki/Download

Open and edit STL files in FreeCAD

Import an STL file into FreeCAD

  1. Start FreeCAD and create a new document with File > New,
  2. In the menu select File > Import and navigate to the mesh file you want to modify. FreeCAD can open STL, OBJ, and AST mesh files.
  3. In the dropdown select the Part workbench,
  4. In the Model window select the imported mesh,
  5. In the menu select Part > Create shape from mesh
  6. The default 0.10 tolerance is usually fine for most of the objects we 3D print, click OK,
  7. Delete the imported mesh in the Model window. Right-click the name of the imported mesh and select Delete,
  8. Convert the shapes to solid. In the toolbar click the Advanced Utilities icon,
  9. In the Tasks window select Solid from shell
  10. Click one triangle on the object,
  11. Click the Create button. You will not notice any change because the solid overlaps the shape.
  12. Click the Close button in the Tasks window,
  13. Delete the shape. In the Model window right-click the name of the shape and select Delete. We have converted the mesh to solid, ready to be edited.

Edit the solid model in FreeCAD

  1. To add or remove parts, open the Part Design workbench,
  2. Select the Solid in the Model window, so the object turns green,
  3. In the Part Design menu select Create Sketch
  4. Select the plane you want to draw and click OK,
  5. Draw lines, circles, rectangles that we will extrude to add or subtract them from the object. Don’t worry if the sketch is not at the correct elevation, we will move the sketch to the correct elevation later.
  6. To print a portion of a too large object, draw lines and trim them at the location where you want to separate the object into multiple parts.
  7. To close and save the sketch click the Close Sketch icon in the tool bar.
  8. To continue to edit the sketch, double click it in the Model window.

To change the elevation of a sketch

  1. Select a face on the solid the move the sketch to,
  2. In the Part Design menu select Map sketch to face
  3. Select the sketch in the drop-down list and click OK,
  4. The sketch opens. You can continue the editing of it, or just close it.

 

 

Pause 3D Printing

There are some designs where you want to change the filament or insert a nut into the product. To pause the 3D printing process

  1. Export the design into a .gcode file,
  2. Open the. gcode file with a text editor,
  3. Insert the following lines into the file at the point you want to pause.
    ; Display a message
    M117 Change the filament and continue
    ; Pause the printing
    M600

If you want to print text, it is possible to pause the printing, change the filament to a different color, and continue.

To find the layer where you need to change the color in Cura, the free 3D print utility

  1. Load the STL file of the design into Cura,
  2. Click the View Mode icon in the upper right corner of the screen, and select Layers,
  3. Use the slier to navigate between the layers,
  4. Find the layer that prints the bottom of the groove, and write down the layer number. Note that the slider starts to number the layers with 1.
  5. Save the .gcode file to the disk with the Floppy icon on the left side. If the icon is gray, the design is larger than the printable size of the printer. You may scale the design down with the Scale icon.
  6. Open the .gcode file with a text editor,
  7. Note that the .gcode file starts to number the layers with 0. To stop at the correct layer, we need to subtract 1 from the number we have seen on the slider.
  8. We will change filament colors to print the bottom layer of the groove. In our example, layer 113-1 = 112 printed the bottom of the groove, search for the text Layer:112 in the file,
  9. Place a pause instruction before that line in the file
    ; Display a message
    M117 Change the filament and continue
    ; Pause the printing
    M600
    ;LAYER:112
  10. Find the next layer in the file, in our example, search for the text Layer:113 in the file,
  11. Place another pause instruction before that line in the file to change the color again.
    ; Display a message
    M117 Change the filament and continue
    ; Pause the printing
    M600
    ;LAYER:113
  12. Save the file and start the printing process.

Chef Attributes

Chef attributes are global variables that are available for every cookbook on the node. There are multiple formats to declare and use an attribute. For important notes on the syntax, please see Undefined method or attribute error in a Chef recipe.

To override the value of an attribute that is defined in another cookbook, use the following syntax

node.override['ATTRIBUTE_NAME'] = 'NEW_VALUE'

During compilation, this line will replace the default value of the attribute with the NEW_VALUE.

 

Prevent the auto-termination of stranded instances in RighScale

When you launch an instance with RightScale Self Service, and the Chef cookbook execution fails, the instance goes into “stranded” mode. By default RightScale Self Service terminates the stranded instances, so there is no way to remote into them and read log files to find the cause of the problem.

To keep stranded instances running in RightScale

  1. Find the booting instance in Cloud Management and click the instance name,
  2. Click the lock icon on the top of the screen

RightScale Self Service cannot terminate locked instances. To terminate the instance after the troubleshooting process, unlock the instance and terminate the instance by hand.

Getting started with InSpec

InSpec is an open-source testing framework to verify your infrastructure satisfies the design requirements.

In this article, we will learn to install and use InSpec with Chef.

Install InSpec

  1. Navigate to https://downloads.chef.io/inspec, and download the installer for the operating system of your workstation.
  2. Execute the downloaded installer.

Start to use InSpec

To use InSpec as the default integration testing tool in Chef Test Kitchen

  1. Open the .kitchen.yml file of the cookbook,
  2. Add the following lines to the file:
    verifier:
      name: inspec
  3. Add this to every suite, so InSpec will search for the test files in the test/recipes directory. Otherwise, the test file needs to be in the test/recipes/SUITE_NAME directory
     verifier:
       inspec_tests:
         - test/recipes
  4. Create a folder structure in the cookbook folder for the InSpec integration tests,
    test
    |--recipes
  5. Create an integration test for your recipe. Create a new file in the test/recipes folder and name it RECIPE_NAME_test.rb. For the default recipe call it default_test.rb,
  6. The following is a simple example of an InSpec integration test:
    # # encoding: utf-8
    
    # Inspec test for recipe my_cookbook::default
    
    # The Inspec reference, with examples and extensive documentation, can be
    # found at https://docs.chef.io/inspec_reference.html
    
    unless os.windows?
     describe user('root') do
     it { should exist }
     skip 'This is an example test, replace with your own test.'
     end
    end
    
    describe port(80) do
     it { should_not be_listening }
     skip 'This is an example test, replace with your own test.'
    end

As you can see, the syntax of InSpec is (intentionally) very similar to ServerSpec, that it replaces. It is very easy to convert existing ServerSpec integration tests to InSpec compliance tests.

Differences between ServerSpec and InSpec

ServerSpec “process”

changed from

 describe process('PROCESS_NAME') do
   it { should be_running }
 end

to

describe processes('PROCESS_NAME') do
  its('states') { should eq ['R<'] }
end

Autodesk Inventor Solid Modeling Application

Autodesk Inventor is a professional 3D modeling application. If you are a full-time student you can create an Autodesk account and use the student edition for free. More information is at https://www.autodesk.com/education/home

Import and export STL mesh files

To enable Autodesk Inventor to open and save .stl files add the STL Import and STL Export add-ins to Adobe Inventor. .stl files are used to transfer 3D print designs between computers. You can download most of them for free from the Internet.

  1. In the Tools menu open the Add-in Manager
  2. On the Translators tab select the STL Import and STL Export translators.

To be able to edit the STL mesh files

install the Mesh Enabler add-in

Download the Autodesk Inventor Mesh Enabler

  1. Navigate to the Autodesk app store at https://apps.autodesk.com/en
  2. Sign in with your Autodesk account
  3. Search for Mesh Enabler
  4. Click the Download button

Install the Autodesk Inventor Mesh Enabler

  1. Double click the downloaded AutodeskMeshEnabler.msi file and complete the installation
  2. Start Autodesk Inventor
  3. In the Tools menu select the Add-in Manager
  4. On the Applications tab select Autodesk Mesh Enabler
  5. Select the Load Automatically checkbox
  6. Click OK

To convert an STL mesh file to a solid model

  1. Start Autodesk Inventor
  2. Open the STL mesh file
  3. In the browser right-click the MeshFeature1 element and select Convert to Base Feature
  4. In the dialog box select the output you need and click OK.

    1. Solid/Surfaces: Converts the selected mesh features to multi-solids or individual surfaces. To create solids, the mesh features must form closed meshes.
    2. Composite: Converts the selected mesh features to a single composite feature.
    3. Delete Original: Deletes the selected mesh features after conversion.

Set the default project location

Inventor saves the new projects in your document folder. To set a different default location

  1. In the Tools menu select Application Options
  2. On the File tab click the yellow folder icon next to Project folder and set the desired location.

To save the solid model as an STL 3D mesh

  1. Open the Inventor Parts (.ipt) or Inventor Assembly (.iam) file in Autodesk Inventor,
  2. Click the Inventor icon in the upper left corner,
  3. Click the small arrow next to Save As,
  4. In the submenu select Save Copy As,
  5. In the Save as type dropdown select STL Files,
  6. Enter a name for the file and click Options…,
  7. Select Source Units to make sure the size of the mesh is identical to the objects in the Inventor document,
  8. Click OK to close the Options window,
  9. Click Save to write the file to the disk.

Recommended 3D Printer settings

There are many 3D printers, filaments, and project types out there, so the variations of 3D printer settings are almost limitless. This page contains recommended settings for the most common 3D printing jobs, printers, and materials.

Printer settings for filament type

Filament material Nozzle temperature range (recommended) Build platform temperature range (recommended) Platform adhesion Advantage
3D Solutech PLA
1.75 mm  and 3 mm
190-220 °C
(205 °C)
0-60 °C
(50 °C)
Blue painters tape  Less warping, No heating bed required, Eco-friendly, Odorless
Hatchbox PLA
1.75 mm  and 3 mm
180-210 °C
(195 °C)
0-60 °C
(50 °C)
Blue painters tape  Less warping, No heating bed required, Eco-friendly, Odorless
Hatchbox ABS
1.75 mm  and 3 mm
210-240 °C
(225 °C)
55- 85 °C Kapton tape or Hairspray  Prints at higher temperature, Durable, Requires less manual finishing, Process in acetone for polished finish, UV resistant
Hatchbox PETG
1.75 mm  and 3 mm
230-260 °C 55- 85 °C Blue painters tape or Kapton tape or Glass bed  Hydrophobic (does not absorb moisture), Odorless, Environmentally safe, Easy adhesion to a number of surfaces, No heating bed required
Hatchbox PPLA
1.75 mm  and 3 mm
180-220 °C 55- 85 °C Blue painters tape or Kapton tape  Less warping than PLA, Eco-friendly, No heating bed required, Odorless
Hatchbox TPU
1.75 mm  and 3 mm
980-235 °C 55- 85 °C Blue painters tape or Kapton tape  Flexible, Easy to clean, Will adhere to most surfaces

Printer settings for job type

For the best look, select the closest recommended layer height for your printer. See Layer Height below for the explanation.

Job type Layer height (mm) Fill density (%) Print speed (mm/s) Minimal layer cool time (sec)
Decorative 0.1 15 50 3
Light duty, mainly straight pull (casing, rotor blades)  0.1 30 50 3
Light duty (fast printing of parts with low load, where vertical surfaces are not visible) 0.3 30 50 3
Medium duty (shafts, casing with load) 0.1 50 50 5
Medium heavy-duty (structural elements with high load, lighter weight) 0.1 70 50 7
Heavy duty (structural elements with high load, motor brackets) 0.1 100 50 10
Extra heavy duty (nuts, bolts, gears, arms) 0.1 100 20 10

Layer height

The 3D printer extrudes the melted material layer-by-layer to build the object, so you will always see horizontal lines on the side of the print. The stepper motor, that controls the Z axis, moves the head or the platform in small steps. Every printer has a minimum resolution, that is the distance the head or the platform moves for a single step of the stepper motor. The stepper motor cannot stop between steps, so that is the minimum distance the head or the platform can move. If you select a layer height that is a multiple of the minimum resolution, the lines on the side of the product will be nice and even. If the layer height is not exactly the multiple of the minimum resolution, you will see lines in waves, that is called aliasing. Regular ink printers use the same technique to compensate for the not perfect harmony between the physical resolution of the printer, and the resolution of the printed picture. The following table contains the recommended layer heights for the most common 3D printers.

Model Recomended layer height mm
Monoprice Select Mini 0.043750 0.087500 0.131250 0.175000 0.218750 0.262500 0.306250

 

Cura 3D Printing software

The Cura 3D printing software is made by Ultimaker, the 3D printer manufacturer.

When you install the application create a profile for your printer. The user’s guide or data sheet of you printer should contain the necessary information to populate the form.

Troubleshooting

The save button is not enabled

Symptom:

The design is loaded into the program, but the Save button is not enabled.

Cause:

When the design is larger than the maximum size your printer is able to print the Save button is grayed out.

Solution:

Load a smaller design or reduce the size of the object.

 

Monoprice Select Mini 3D Printer

The Monoprice Select Mini 3D printer is one of the best values on the market today. For $220 you get a 50-micron (0.05 mm) resolution 3D printer with PLA and ABS capabilities, and heated printing platform. The heated platform can reduce or eliminate the warping of the edges when the object cools down too quickly.

The printer comes with a mini SD card with a sample .gcode file that prints a cat, and two 3D printing applications:

  • Cura and
  • Repetier

The manual recommends starting with Cura because it can import .stl and .obj 3D printer design files and able to generate the .gcode file that the printer needs to print from an SD card. For more information see Cura 3D Printing software

 

Undefined method or attribute error in a Chef recipe

There are multiple reasons Chef can display the following error message

NoMethodError
 -------------
 Undefined method or attribute `...' on `node'

 

There are multiple ways to reference an attribute in a Chef recipe:

node['ATTRIBUTE_NAME'] (the recommended way)
node["ATTRIBUTE_NAME"] 
node[:ATTRIBUTE_NAME]  ( use it only if the single or double quotes (' or ") would cause a problem in the expression)

node.ATTRIBUTE_NAME

To check if the attribute value is nil, use the following format:

if ( !node['ATTRIBUTE_NAME'].nil? )
   ...
end

If you use the node.ATTRIBUTE_NAME format and the value is nil Chef throws the above error message.