AnsweredAssumed Answered

Macro to Create Coordinate System for 3D Printing Export

Question asked by Andrew Glick on May 19, 2019
Latest reply on Jun 17, 2019 by Andrew Glick

Hi, 

 

Normally when exporting a part for 3D printing, the object is rotated 90 degrees counterclockwise about the x-axis due to the programming of 3D printers. I have seen some solutions to this issue, such as creating a template file with alternate views and plane names, detailed here: http://www.agcross.com/2015/02/orient-solidworks-axes-3d-printing/. I also saw this STL macro (which actually spawned this question of mine) that exports the file as an STL using an alternate coordinate system called "3DPrint", detailed here: https://forum.solidworks.com/thread/230322.

 

The only drawback to either of these solutions is that they will not work on preexisting documents. I would like to make a macro that automatically creates a coordinate system feature named "3DPrint" at a part's origin, but rotated 90 degrees counterclockwise about the x-axis to be properly aligned for 3D printing (the new z-axis is where the y-axis was). Also, if it's possible, I'd like it to be put at the top of the FeatureTree, right after the origin (so it doesn't clutter the rest of the tree) and for the macro not to create a coordinate system if the "3DPrint" coordinate system already exists. I tried looking into the Solidworks API, but I don't have much experience in VBA and ended up very confused.

 

Can someone help me get started or give me a few simple examples of similar macros?

 

Thanks,

Andrew

Outcomes