15 Replies Latest reply on Apr 17, 2018 12:25 PM by Bjorn Sorenson

# Global variables

Hello all, I am new to Solid works and am struggling to figure something out.

How do I create global variables from part dimensions. Currently I am trying to figure out how to get a bend radius from a sheet metal part into an assembly to drive other things including an assembly plane position. If I copy the variable name to the assembly equations, it does not understand to link it, I assume because the dimensions name is from the part not the assembly. How do I overcome this issue?

• ###### Re: Global variables

I don't use global variables very often, so there may be a simpler way, but you could always insert a sketch in the Assembly, use the Convert Entities tool to create an arc on the edge of the sheet metal part, and insert a driven dimension that calls out the radius.  Link to this dimension with a global variable in the Assembly.  If that dimension changes in the Part it should feed up to the Assembly.

• ###### Re: Global variables

Let me ask this another way. Can a global variable in a part be use in an assembly? If yes, how. The two most common ones will be thickness and bend radius from a sheet metal part. Then a "setback" = "T+R" can be used in the assembly's design.

• ###### Re: Global variables

Maybe some of these will work for you?

Sometimes the simplest way is to create a sketch at the assembly level with 1 line in it.  Create a dimension for the length of that line, then link it to the dimension at the part level of whatever dimension you want.  Now you have a dimension at the assembly level that is controlled by the part level.

Then create  global variable and make it equal to that dimension from the sketch with the 1 line.

• ###### Re: Global variables

S. Leacox wrote:

Let me ask this another way. Can a global variable in a part be use in an assembly? If yes, how. The two most common ones will be thickness and bend radius from a sheet metal part. Then a "setback" = "T+R" can be used in the assembly's design.

Hello,

Yes, this can be done. Thickness already is a gv.

But the reason I'm posting is that the bend radius can be bend specific.

It doesn't have to be (and for me it's usually one), but if it happens, then the original T+R gv won't apply correctly and you'll have create new gvs and track them.

I don't know if this has already been mentioned, but in your assembly, you can create a gv using the Measure option.

This creates a driven dimension you can reference for your setback.

Cheers,

Kevin

• ###### Re: Global variables

Hello,

Here are some screen shots on the Measure option method I posted earlier.

Create a reference plane at the form line, parallel to the outer face:

(This is needed because the Measure isn't restricted to a plane, so the measurement will be on a diagonal to the desired goal.)

Create a new global variable (gv) and select the Measure option.

Move the equations dialog out of your way for a moment (don't close it) and select the plane above and the outer face.

The Measure gv is created (it's exact, this assy's units are two places):

Equate the distance mate's value to the gv and click OK:

The second part moves to the form line:

Hide the reference plane if you wish.

To test, change the bend rad on the first part to an obviously different amount:

(ignore the red plane below, it's not for this post)

If you want an additional offset, say 1/32", you can add "+ 1/32" (w/o quotes) to the end of the gv equation.

Or you can create another gv that references the first one plus the offset, which allows you to add several different setbacks w/o altering the baseline T+R value.

I hope this helps.

Cheers,

Kevin

• ###### Re: Global variables

Take a look at this technique:

• ###### Re: Global variables

Thanks all for your help so far.

Yes the radius can be specific, but I work with gauge tables and let them do the work for bend radius and thickness (I wish I could also use for K, but that one is broken). I was hoping for a way to link the radius from the gauge table or from the part file so as to not clutter up the assembly with sketches that are a work around to link variables.

The step I am having a difficult time with is: I have a global variable inside a part. How to I set a global variable inside the assembly = to it?

So yes, the thickness is in the part, how do I set an assembly variable to be "=" to it?

Down the road, I will need to figure out how to display the same variables in draft inside a table and or a set of notes.

Adding sketches to the assembly to re-capture information that is already in the system does not make sense to me. Sure it can be done, but why if there is a better way of working. Is there? The file I am working on is a template that will be used to create 100's of files. If things take a while to set up, that's ok. I want the results to be stable and clean to use in the long run.

• ###### Re: Global variables

Thanks Vlad, but like every other help I find, that's about using a global variable inside a part.

I want to find out how to use a part variable inside an assembly. And specifically without measuring the part in the assembly. IE I have variable inside a part. How do I set a variable inside the assembly = to the variable inside the part?

• ###### Re: Global variables

OK. Currently I don't have an access to SW from home, but tomorrow morning I'll send you step-by-step scenario.

• ###### Re: Global variables

Let on the part level Global Variable LG=4" and linked to dimension D2@Sketch1:

Assembly:

Now we need to link GV LENGTH_BOX on assembly level to Global Variable LG on part level.

RMB on part -> Edit in assembly.

Clock on Equations -> Manage Equations:

Delete number (4 in this case) and click on the Global Variable we need to link on the assembly level:

Updated view:

Good luck!

• ###### Re: Global variables

Within a part, bend radius is usually called "D1@Sheet-Metal".  To reference the bend radius of a part in an assembly, you just need to reference the part file name and instance number with an @ symbol.  For example, if the sheet metal part is called "Test_Sheet Metal 1" and it is the first one of its kind that you've inserted into the assembly, the global variable would read:  ="D1@Sheet-Metal@Test_Sheet Metal 1<1>.Part"

This worked for me... or am I missing something?

• ###### Re: Global variables

I figured it out, Thank all.

The missing key information was that I need to make global variables inside the part, then I can set global variables in the assembly to the part global variables.

• ###### Re: Global variables

I probably should have solved the general case first, then the specific case.  The easy way to get a variable of any kind in SolidWorks is to go into the part, right-click on the Annotations folder->Details->Display all types, then right-click Annotations folder->Display Annotations (and make sure View->Hide/Show->Hide all types is not selected, and annotations are set to visible in the same menu).  All component dimensions should now be visible (sometimes you have to hunt for the one you want), and with the Equations editor open, you can now just select them from the graphics area.  If you have annotations set to visible in your assembly, all your parts' dimensions will now be visible, and you can just select them from the graphics area for your equations in the same manner.