This a guide for using the HTC Vive with Solidworks. No native support currently exists so a workflow using third party software is necessary. A similar process can be used with the Oculus Rift.
The best way to view to view any 3D content in VR is with the Unity game engine. “Best” is subjective here. Unity is a complex and powerful game design package that offers well-supported and high performance VR viewing modes with the HTC Vive. Unity is also available for free use. The downside is that you’re introducing an unfamiliar and near redundant software package to your workflow.
Unity will act as our VR viewer but we need to find a way to import our Solidworks files. There is no direct data exchange between Solidworks and Unity. Solidworks can export a variety of neutral geometry formats but not the .OBJ type that Unity accepts. The good news is that there is a free macro to export Solidworks geometry as .OBJ files.
These are the broad strokes for the work flow. We now know enough to put together the process.
Visit https://unity3d.com and download the installer. You will need to create an account. The Personal edition will work fine for our purposes.
Installation should be straightforward, nothing special is required.
Set up .OBJ export macro
Neil Larsen has written an excellent macro to export Solidworks geometry as an .OBJ file.
It is available with installation instructions on this page: https://forum.solidworks.com/thread/54270
We only need the Free SolidWorks OBJ Exporter v2.zip file.
Follow the instructions inside to install the Solidworks macro. The included Blender scripts are not required.
Set up Unity template
CAD-VR has created a Unity template to streamline the process of using VR with Solidworks.
The template has support for the Vive headset, controllers, and teleportation built in. Thanks goes to thestonefox and his Unity VR Toolkit for making this possible.
The template is available here.
Extract the “Solidworks Template” folder to a safe working location.
Export .OBJ data from Solidworks
Import the .STEP file and save the new assembly.
Click the .OBJ export macro button to bring up the export dialog box.
Most of the default export settings are fine but I needed to select “Output mesh with Y axis up” due to my coordinate system.
Click “RUN EXPORTER” and wait patiently until you get a “Complete” dialog box.
You should now have a new folder in the location of the saved assembly with a .OBJ file.
Import into Unity
Launch Unity and open the Solidworks Template project folder that was saved above.
In Unity go to Assets > Import New Asset
Select your .OBJ file and click Import
Unity will process the geometry and the asset will appear in your project file at the bottom of the screen.
The asset will have a property dialog associated with it that appears on the right hand portion of the screen.
In the asset dialog box check the “Generate Colliders” box and click Apply. This will make teleportation easier later in the process.
Import into Scene
Your geometry is now in your project file but not yet in the scene.
The scene is empty except for a large base slab that will serve as the scene floor.
Import your geometry by dragging the asset file from the project file at the bottom of the screen to the scene file tree on the left hand side of the screen.
Your geometry should appear in the view space.
There’s a good chance your geometry is not correctly oriented and is intersecting with the base plane.
Click on the geometry asset in the left hand file tree and a transform dialog should appear in the right hand side of the screen.
Adjust the position and rotation values to correctly orient the geometry. You may need to adjust the scale values if your dimensional units did not import properly.
For the example files included use the following values:
Position X:10 Y:3 Z:0
Rotation X:90 Y:0 Z:0
View in VR
Launch SteamVR and make sure the service is running
To view the scene click the Play icon in the top center of the screen. This will launch Unity into a rendering mode and output the display to your Vive headset.
The Vive controllers can teleport you around the geometry by using the touch pad button.
Unity offers great VR viewing capabilities. The geometry exchange could be streamlined between the packages but it’s a minor hiccup for now. The provided template is a nice sandbox for importing geometry. I hope this guide is helpful in realizing VR as a powerful design tool.