Export OBJ out of SolidWorks for free!!

I don’t work much with file export into various format but getting across a free OBJ export tool from Neil Larsen and macro-maker Karpena, I thought it might be good thing to spread across the SolidWorks community.

Neil Larsen has shared a free macro, suitable for SW2005 and up, to export your models in Alias|Wavefront .obj format complete with .mtl and textures. The macro works with parts and assemblies and configurations. It has been made to enable SolidWorks models to be rendered in cg applications such as Blender and Octane Render. As of the time of this post Blender 2.62 and Octane beta2.57 are current.

The macro can be can downloaded from here. It comes to you courtesy of karpena, who wrote the basis of the macro, and yours truly who extended it and gave it a UI. The zip contains the necessary files and instructions. Please be sure to read the README about the ins and outs of installing/using the macro. This macro won’t as a rule be supported but if there are teething issues with this release please report them here.

Neil does request everyone who so ever uses this macro,“All we ask, aside from not to sell it, is that you make sure any variants in the wild have some distinction in the name so that its clear which macro is for which apps and not confuse revisions. Its sort of in keeping with the spirit of open source because both Roman (karpena) and I make use of Blender.”

INSTALLATION:

The SW macro can go anywhere but conveniently where you keep your other SW macros. You will need to use the provided toolbar button to launch the macro from SW. See the SW Help>Macros>Customize buttons to find out how to set this up. See also the included picture of the custom button showing to select the modSWtoOBJ.InitialUI as the ‘Method’ to start.

NOTE: The macro will not run from the menu Tools/Macro/Run> or from the toolbar Macro>Run.

The macro included was authored in SW2009. Different SW versions will require you to open the macro in the SW MS VBA window, reselect the Reference Libraries appropriate to that version, andthen save the macro. See the included ‘References’ picture of SW2009. Opening in another version may show the References as being ‘MISSING’. Look down the list and find equivalent entries but for the year of your SW install. Sometimes SW will find these references itself. The Blender helper script is required to load the finished .obj into Blender automatically.

It should work with Blender 2.5 and up. Make sure it goes in the same folder as the Blender.exe . The path to Blender is assumed to be C:\Program Files\Blender Foundation\Blender\blender.exe

The path to Octane is assumed to be C:\Program Files\Refractive Software\OctaneRender\Octane.exe

You can change these paths if necessary in the vba module code by going to lines 627 & 632 respectively.

Here is one example of OBJ export (you can find them in the zip file too).

Happy rendering!

Advertisements

14 thoughts on “Export OBJ out of SolidWorks for free!!

  1. Fritz

    What’s wrong if my “method” says “Free_SolidWorks_OBJ_Expor.main” instead of the “modSWtoOBJ.InitialUI” you mention?

    Reply
    1. Deepak Gupta Post author

      Firstly there is no main sub in the macro. And moreover you won’t get the UI when you run the macro.

      Are you sure that you’ve not accidentally created a new macro and saved over the Free_SolidWorks_OBJ_Exporter_v2.0.swp file. Please download/extract the file again and check.

      Reply
  2. rickdunn92

    i did it, but it doesn’t work, could you send me the video pls?. it said that i have an error: “run time error ‘5’: invalid procedure call or argument”

    Reply
  3. Tcherba

    Could you please do some video to explain better the way to do this process please, i’m a new guy in SW and i really need this exporter to .obj so i can increase the quality of my renderings. Thank’s for everything.
    Tcherba

    Reply
      1. Tcherba

        I just finish to saw the video and i tried to do the same. But does not work, i cannot even get to the first img that you show in this blog, and i don’t know why…
        Just a note, my SW is the 2011 SP 0

        Reply
        1. Deepak Gupta Post author

          Did you tried to fix the libraries in the macro? Also if you’re using x64 bit OS, then after you run the macro, please press alt + tab to see if there is any window behind the SW screen.

          Reply

I'll be happy to know your views and opinions as this will help me to improve. You can share them as comments below.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s