Sometimes you may want to have a simple input form to drive a document In SOLIDWORKS and there are a few ways in which you can do this inside the software. In this video Elite Applications Engineer, Adam Rose, shows you how to use a text file to update your SOLIDWORKS parts and Assemblies.
[Video transcript]
How to update SOLIDWORKS files from a text document
My recommended first step is to create a set of Global variables within your SOLIDWORKS files. We can do this by going to Tools and then Equations.
Global variables are used in SOLIDWORKS to create links between several of the same dimension. Alternatively, they could be used to within Equations in our models as driving values.
I will create two global variables, one called Bottle Height, the other one I am going to call Bottle Base Dim. We can fill in some values for these as we create them.
Now we can use these variable values inside our design. This can be done in a few different ways. In this example I’m going to double click on the features in the design tree to find the dimensions associated with that item. You can then edit the dimensions and start to use the global variables by typing them in the modify box – you should see the variable appear as you start to type. Alternatively, you will also find this will work for many features by typing in the property manager as you edit a feature.
We can link in both the Bottle Height dimension, and the base dimension, which can be used twice to define both overall base dimensions. We can rebuild our design once this is done, making any additional changes as we see fit.
Once the model is nicely linked with the Global variables we can navigate back to the equations dialogue. This time you will notice it is accessible from the design tree on a right click.
Within this dialogue box you will notice two options on the right: Import and Export. These are the options we can use to link our model to a text file. We will choose the option to export and we can set a file location and name for this document. A dialogue will then appear, with our list of equations in this model. There are two columns of tick boxes here; The first column shows those items which will be exported to the text file, the second shows those items which will be linked – and driven – by the text file. You will usually want both, but on some occasions you may want to export the value, without driving it using an external file.
If we click Export here the file will be created. You will notice those items exported and linked are now greyed out. They can be accessed by clicking the button at the bottom, to open file. Once opened, we can edit the values here to update our document. We just need to ensure we click on the save option in the text file first.
So, it’s reasonably easy to create the link to a text file. What’s more, we can now use this file within another document and have two files updating from a single text file.
In this example, I have the plastic packaging, which is used for this bottle file as another part. Although these files may not always need to be in an assembly together, it’s still useful to have them both updating when design changes are made. So, I’m going to use my text file to do this.
To link the text file into our plastic packaging file, we first of all need to go to Tools, and then Equations, and choose the Import option, selecting the same text file that we created before.
You will notice that the global variables we created are now available to use within this model. We can go through the process we did before, linking these into our model by editing the dimension values.
Once the files are linked, we can open our text file, make a quick change, and have both designs update together. What’s worth noting here, is we could give this file to someone who doesn’t have SOLIDWORKS, so they can update our designs. The next time the model was loaded, the changes would automatically come through on a rebuild.
There are a few different ways to link designs with SOLIDWORKS, but this one is possibly the simplest one to manage and it works really well.
About the author: Adam Rose is an Elite Applications Engineer and has been with Innova Systems since December 2010. Read our interview with Adam to find out more.