This article walks through the steps of manually changing the location of Product files when using an existing Composer Project. The process discussed below can be utilized if the file structure containing Composer Products must be modified in any way.
It is important to note that file structure should be planned out before creating a Project, as Composer does not have an in-software method for pointing to changed Product locations. More information on recommended Project file structure can be found by navigating here: http://www.hawkridgesys.com/blog/solidworks-composer-projects/
Project Structure Before Change
The scenario for this article will be as follows:
- The top level folder that contains all Project and Product files is C:\Engineering Project\Composer Files. There are three Products that currently reside in this location.
- The Project that references these three Products is located in C:\Engineering Project\Composer Files\Composer Project.
- The goal will be to move the Products from their current location to C:\Engineering Project\Composer Files\Composer Products.
The illustrations below show some examples of this setup.
Each Product that is created will generate four separate files. These files will all need to be grouped together in the same file path in order for the Product to work correctly.
Creating a new Project will generate a .smgProj file, which is used to open the Project itself, along with a folder having the same name as the .smgProj file. This folder will contain all data related to the Project, such as camera views and Product references. As discussed earlier, this example Project named "ExampleProject" is stored in C:\Engineering Project\Composer Files\Composer Project.
For this example, the Project folder only contains the three standard files that are generated when a Project is created. Projects do not contain any geometry of their own, so a .smgGeom file will not be created. The .smgXml file will later be used to edit the referenced location of the Product files.
Changing the Product Locations
Prior to making any changes, please make a backup copy of your original Project file set.
For the following steps, the three existing Product file sets shown in the first illustration of this article will be moved from C:\Engineering Project\Composer Files to C:\Engineering Project\Composer Files\Composer Products. In order to function properly, all four files associated with each individual Product will need to be relocated to the same file path.
The illustration above shows that the location of the Product files has now been changed to C:\Engineering Project\Composer Files\Composer Products. Since the example Project references the original path of these three Products, function will not be restored until the Products are moved back to the original location, or the referenced file paths are manually changed. As mentioned earlier, these file paths can be changed by editing the Project .smgXml file with any standard text editor.
For this example, Notepad++ with the Xml Tools add-in will be used. Notepad++ can be obtained here: http://notepad-plus-plus.org/
Once the Project .smgXml file has been opened with a text editor, the first step is to find where the Project is pointing to when looking for the Product files. The easiest way to do this is to search for the name of a Product. In the illustration shown below, the Product named "ExampleProduct1" is searched for. This will find the file named "ExampleProduct1.smgXml", which is the only file that will be referenced.
The line item containing "IsInstanceOf" will indicate that this is where the Product .smgXml is looking for the Project file. Typically, the file path will be represented by ..\..\ProductName.smgXml, as shown above.
Within the quotation marks, the existing file path can be replaced with the new, full path. As shown below, the new path of C:\Users\jesseh\Desktop\Engineering Project\Composer Files\Composer Products\ExampleProduct1.smgXml replaces the old path.
The same steps can be performed for each Product file that was moved. In this case, all three file paths for the three Product file sets have been changed.
After these changes have been made, save the file using the File > Save workflow of whichever text editor is being used, and exit the program. The primary .smgProj file should now be fully functional, with all data the same as it was before the relocation of the Products.