Category Archives: 3D Printing

Importing Lattice Type Geometry into Solidworks

I’ve been daydreaming about some 3D printing projects again and have spent some time looking at the lattice style structures that are used as low density volume fillers in SLA or SLS prints. I think this is an underappreciated area of printing because these structures can only be created practically by printing and there is likely some interesting strength and stiffness optimizations you can do by tinkering with the lattice geometry. I think this will become much more interesting as flexible material prints become more popular.

These lattice structures are pretty simple geometrically so in theory you could create them in Solidworks but in practice I think it would be tedious and a bit of a pain. The geometry should be easy to generate with a few lines of code so I thought it would be interesting to see if I could generate some geometry programmatically and then import it into Solidworks.  After doing some research I couldn’t find an existing method of doing this.  The closest thing was a few Solidworks macros to import point clouds.

I’ve found the Solidworks API and associated VBA difficult to work with in the past.  In theory I could generate all my geometry just using some VBA in a Solidworks macro but I think that would be an exercise in frustration for myself.

I decided to do most of the heavy lifting outside Solidworks and then write a macro to import the geometry and create some simple swept cylinder features to replicate my geometry.  I’ve done some 3D work in Processing before so I expected the geometry creation to be straightforward by reusing some existing code.

Here’s a quick overview of the plan I developed:

  1. Generate line geometry in Processing
  2. Export lines as pairs of 3D points and a diameter parameter
  3. Use a Soldiworks macro to create 3D sketches based on the points, then create a swept circular profile for each

Predictably the Solidworks macro was the most difficult part for myself.  It imports data from a text file with each line defined by Diameter, X1, Y1, Z1, X2, Y2, Z2.  It creates a 3D sketch, inserts a line, then performs a circular profile sweep (SW 2017 and later).  Overall it’s pretty crude.

The macro works OK but could use some improvement.  The swept cylinders end with flat surfaces which creates gaps at intersections.  Ideally each cylinder would have a spherical end to reduce gaps.

Each cylinder is created as a separate body by design.  This allows the lattice to be easily trimmed in Solidworks without leaving any weird partial bodies.

Overall this was a fun project.  I don’t have any immediate plans for this work but I think I’ll dust off this code in the future.  If this project interests you I would suggest that you don’t go into the deep end of programming complicated geometry. Mesh Mixer has a lot of high end tools for this type of work.

Here’s the macro code:

Dim swApp As Object
Sub main()

Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc

Dim x As Integer
x = 1
Dim sketch As String

‘open file
Open “lines.txt” For Input As #1
Do While Not EOF(1)
Input #1, D, X1, Y1, Z1, X2, Y2, Z2

‘create 3d sketch
Part.SketchManager.Insert3DSketch False
‘create line
Set skSegment = Part.SketchManager.CreateLine(X1 / 1000, Y1 / 1000, Z1 / 1000, X2 / 1000, Y2 / 1000, Z2 / 1000)
Part.SketchManager.Insert3DSketch False

‘select new line
sketch = “3DSketch” & x
boolstatus = Part.Extension.SelectByID2(sketch, “SKETCH”, 0, 0, 0, True, 4, Nothing, 0)
x = x + 1

‘create sweep
Dim myFeature As Object
Set myFeature = Part.FeatureManager.InsertProtrusionSwept4(False, False, 0, False, False, 0, 0, False, 0, 0, 0, 0, False, True, True, 0, True, True, D / 1000, False)

Close #1

Set swApp = Application.SldWorks
End Sub

Magnetic Camera Mount

I’ve been looking to dip my toes into the 3D printing pool for a week or so now.  I really needed a project that would be a good excuse to print some parts.  I decided to start with the design of a magnetically fastened camera mount that would use a Maxwell kinematic coupling.  I love kinematic couplings and used them in some cool automation applications in the past.  They’re a great way to repeatably and accurately locate tooling or fixtures that need to be easily removed.

I started off with the design in Solidworks going through a few iterations of the magnet spacing and contact surfaces.  The V-grooves in the base part accept a roundish spherical feature in the mount for accurate location. Three magnets are located in circular pockets in both the base and mount piece.  The center of each piece has a counterbore to accommodate a socket head cap screw for the standard 1/4-20 camera thread.

I shipped the files off to Shapeways to try out their “professional plastic” material which is really HP’s Multi Fusion Jet process which I was not familiar with.  As an aside, I think I’m going to rely on printing services in the short term before I invest in a printer.  I’m really tempted to get the AnyCubic Photon but I think I would be limited by the build volume.  Services will give me a lot of flexibility for experimentation.

I received the parts a few days later and I was impressed with the results.  The plastic had a nice smooth finish and matte appearance.  The prints were close to being dimensionally accurate but their was a weird curled lip on a few of the sharper edges.  The assembled pieces didn’t quite hold the small 0. 020″ gap I designed in between the two halves.  This indicates that the V-grooves and spherical contact features are slightly off in size.

I assembled everything including gluing the magnets into the parts.  The pockets I designed for the magnets had a lot of extra clearance because I wasn’t sure how accurate the inner diameter would print.  In the future I would like to get this to a press fit but in the short term adding some super glue is an easy assembly step.

The design worked great!  Snapping the pieces together has a nice satisfying feeling and overall the design is practical and functional.  In the next version I would like to increase the magnetic holding force because it’s at the limit when holding my 70D.

Overall I’m pleased with the project and the design of the mount.  I think there a lot of room to explore this application in the camera mounting space.  The magnetic coupling is a novel approach and I think the design could be a great solution to mounting smaller GoPros.  Stay tuned!

My Thoughts on 3D Printing

Hobbyist 3D printing has never made sense to me as a design engineer.  The applications always seemed limited to printing useless trinkets.  At best you could maybe print an interesting piece of geometric art.  Arguments for “functional prints” always involved a large investment of time for a small payoff.  I don’t want to take an hour to model and print a 5 cent knob.

The technology seemed limited as well.  The prints were low resolution.  Small build volumes limited prints to the desktop trinket size.  FDM printing can have issues with distortion or warping.

My mind has recently started to change.  I have been aware of the DLP SLA printers such as the Form but I was surprised by the price and capability of the AnyCubic Photon.  Although limited in build volume I can appreciate the print quality and resolution.

Inexpensive high resolution printing got my gears turning.  I could build parts that could hold tolerances that would be workable in assemblies. I could build homogeneous parts with an attractive finish.  I could flex some design muscles and build some extremely complex parts that would be impossible for traditional fabrication methods.  I saw a path for some novel design work that I haven’t seen anywhere else online.

Although I would be handcuffed by the build volume I very quickly came up with a mental list of interesting projects. I found my own use case for 3D printing that didn’t fit the traditional mold.

One of the final ideas that clicked was the ease of creating parts.  As an apartment dweller I don’t have a large shop to build or tinker in. I certainly don’t have a garage with a modest machine shop. 3D printing offers an inexpensive and low resistance path to creating and making new parts.  My day job has me working with a variety of machine shops to quote and order parts.  There is a very real cost and time investment to making the parts that I am familiar with.

3D printing offers almost the same experience in a convenient and inexpensive method.  Parts will certainly be made a material that has greatly diminished strength but this can be addressed.  Compromises will have to be made by the upside is worth it.

I’m excited about the opportunities and I’m looking into a few different projects.  I plan to cover a variety of projects and investigation in the near future.