Command Line Publishing with swbatch
From a shell command line, SolidWorks CAD data can be converted to Creo View format using the swbatch script. This chapter outlines how to use the swbatch command, including the most commonly used command line options. For a complete list of command line options, refer to the Advanced Adapter Configurations chapter.
* 
Before using swbatch, verify that swpublish is working.
swbatch Overview
swbatch is used to publish SolidWorks CAD data from the command line. swbatch runs SolidWorks in non-graphics mode. By typing a simple command at the prompt, CAD data is converted and immediately viewable using the Creo View client.
* 
Only one instance of SolidWorks can be run on a computer. If you are already running SolidWorks, swpublish, swbatch, or swworker, any attempt to run another swbatch process will fail, displaying the following error:
sw2pv Fatal: SolidWorks is already running please exit SolidWorks first
Using swbatch
The operation of the Creo View Adapter for SolidWorks involves utilizing a single command to publish CAD data.
The form of command line is as follows:
swbatch [options] <cad_data>
A command line conversion has the following stages:
1. Open a command prompt and navigate to the directory containing the CAD data you want to convert.
For the purposes of this example, the directory is C:\\sw_data\\.
2. Type in the swbatch command, for example:
C:\ptc\sw_setup\swbatch -p output sw_test.SLDPRT
In this example, the command line can be broken down in order, from left to right, as follows:
a. The setup directory containing the adapter configuration, followed by the command to convert the data:
C:\ptc\sw_setup\swbatch
b. Option -p <output path> is shown as output. This is the name of the directory where the adapter places the converted data.
c. The SolidWorks data to be converted is given as sw_test.SLDPRT.
3. Press ENTER and swbatch is launched. When the command prompt returns, the conversion is completed.
* 
swbatch can publish more than one instance of CAD data at a time. To publish a list of CAD data, type all of the names on the command line, separated by a space. Wildcards (asterisks *) can also be used, if the user is confident that the data returned will be correct.
4. You can now open the converted data output in Creo View.
Converting SolidWorks Configurations
Tags can be used within the specified CAD data name to define which SolidWorks configuration is required. When converting a specific configuration, the CAD data name must take the following form:
<cad-data-file-name>:Part:<configuration-name>
For example, to convert the 2_liter configuration within the Engine.SLDASM, use:
Engine.SLDASM:Part:2_liter
Was this helpful?