Driving Global Variables with an External Text File

Driving Global Variables with an External Text File

Table of Contents


If you are a fairly advanced SOLIDWORKS user, you have probably used Global
Variables at some point. Global Variables are the easiest way allow certain
dimensions to change quickly without having to go in and modify them
individually. Here I have a block that is being driven by 5 Global Variables.

Block

 

chart

If I open the Equation Manger by going to
Tools > Equations, I can see and control the table of
Global Variables. This is where you can change the value of each Global
Variable to create a whole new model variation. However, there is an
underutilized option from the Equations Manager which will let you take Global
Variables one step further, Link to External File. This will
give you the ability to control Global Variables or equations from a text or
database file.

Equations, global variables and dimensions menu

When you turn this option on, you can choose to create the file from scratch
or link to an existing file. Creating a new file will let you choose where to
save it, and which of the Global Variable or equations you want to control
with the text file. Once you have that set, click Link to
establish the relationship.

link equations menu

If you create a new file, the current values will automatically populate the
new file. The format for the text file is simple, “Global Variable Name” = Value, each one gets its own row. It will look something like
this…

equations - notepad menu

Now you will control the selected items from the text file instead of the
Equations Manager. In fact if you look at the Equations Manager, you will see
that those items are now locked out and show the linked to file icon.

global variables menu

Testing it out, I will change some of the values on the text file. Make sure
to save the text file once you have made your changes. Then switch back to
SOLIDWORKS, if the Equations Manager is still open, just close it down. Your
model should automatically rebuild and reflect the changes, if not you can
force a rebuild with Ctrl+B.

block

So why would you want to control your Global Variables from an external file?
Often times, manipulating the values can be easier on a text file instead of
in the Equations Manager. Also the text file can be modified by a non
SOLIDWORKS user and the model will update the next time it is opened, and this
can free up a license on crowded networks. Another use case is automatically
generated text files from sources like Excel. An Excel workbook or other tool
could be used to handle complex equations to determine the Global Variable
values and then exported to a text file that can be used to control a model.
With the easy linking of Global Variables to an external text file, the
possibilities of what you will model are endless.

Tyler Braginton

Tyler Braginton

Applications Engineer Tyler Braginton hails from our Reno, NV office, and is a Certified SolidWorks Professional who teaches a variety of introductory and advanced classes across Northern California and Nevada. Tyler holds a B.S. in Mechanical Engineering from the University of Nevada-Reno, and is an expert in SolidWorks, SolidWorks Electrical, and CAMWorks. When he isn't modeling parts or teaching classes, you can probably find Tyler at a Tough Mudder competition or on his snowboard in Tahoe.
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments