Tag Archives: tips

solidworks: variable global to assembly

lately i’ve taken to the “make rough sketch of parts on paper, then in solidworks, make solidworks assembly, then add all the features at the correct location with the help of CAD” method of making things. With the lasercutter especially, something you want is that if you decide to change your stock (or you measure incorrectly), you can change the thickness of  your features all at once.

This puzzled me a while back, because if you try to enter an “equals” sign into the extrude feature to create a variable like you would when dimensioning a sketch, you get an error:
error to the left
Uh, so…? What? You can’t use equations in features? That’s dumb.
Thankfully that’s not the case. Turns out you input whatever for the feature and click the check mark. Then you go back and double-click on that feature (in this case boss-extrude) in the feature tree,
 which pops up the “extrude” feature dimension on your model, 
which you can then double-click to edit. And insert an “=” sign to create a variable.
Okay, so that’s great. But this variable only exists within this one file. How do I get it into other files?
I thought there would be some assembly feature, but instead solidworks does this with good ol’ fashioned text files.
Tools > Equations > Export
There’s the “material_thickness” variable I created as = 12.5, and then there’s the “first extrude = material_thickness” which is sort of optional for exporting. All my features are meant for lasercutting so I may as well export the fact that the first extrude-boss should be of “material_thickness” thickness.

(That is, when I import in the future, I have to make sure the new file has an extrude already, or else the “equation is invalid” error will pop up because it’s like “wtf there is no extrude thickness dimension to link to in this file”. So probably best actually not to export that extrude thickness dimension, or else un-check that equation when importing).

This saves it as equations.txt
Then I create a new part (for demo purposes) and import the equations file:
And voila, everything has carried over.

NOTE: Watch your units! As you can see, the equations file doesn’t have units. So if you export as 12.5 mm in one document and then import in a document that is set to work in inches, you get a 12.5 in part.

If I want to edit the variable, I have to do so externally. At the bottom of Tools > Equations, there’s an “open file” button that I use and it pops open the equations.txt file in the default text editor (in this case notepad)
Voila, I can now edit that thickness and just hit “rebuild” (ctrl-b) 
and the new dimension is propagated in all the files.
If you want, going through this post as a slideshow may be flow better:
https://picasaweb.google.com/113942194695013581888/SolidworksGlobalVariable

I made a video about hexapods.

I made a video about hexapods! yay. I’d estimate it was a full 4 or 5 days working on it, learning final cut pro along the way. It basically covers my journey through 2.007 two years ago, and is meant to be a resource for students in the class.

Note to self: shortcuts: < > ctrl-= alt-w

Meanwhile, I think an instructable a week sounds like an excellent plan for Spring semester senior year.

bulk add users to moira lists

I always forget how to do this, but if you ever need to populate an email list at MIT, you can do it through blanche.

http://kb.mit.edu/confluence/pages/viewpage.action?pageId=3907064

If you want to add a long list of names to a list, you can put them all in a text file and do ‘blanche listname -al filename‘, or if you want a list to contain only the names in a text file, you can type ‘blanche listname -f filename’ and the appropriate members will be both added and removed

Thus, at a terminal, I would go

narw@ubuntu:~$ ssh nouyang@linux.mit.edu [remote login to athena]
nouyang@dr-wily:~$ vi 2.007ua [make a file with a list of athena usernames. it will accept the @mit.edu but it’s happier without. You can do this with gedit if you want.]
nouyang@dr-wily:~$ blanche 2.007-2013uas -al 2.007ua

voila! done. If you want to double-check they’ve been added, just do

nouyang@dr-wily:~$ blanche 2.007-2013uas


and everyone should pop up. or check online at https://groups.mit.edu/webmoira/

yay!

Additionally, if you’re copy-pasting a lot of stuff (e.g. from stellar) and only want the lines containing emails, you can do
http://lglinux.blogspot.com/2009/08/vim-keep-or-delete-lines-matching.html
:v/@/d
and that keeps only the lines with @ signs. Blanche doesn’t much care about whitespace so don’t worry about it.

e.g.
Nancy Ouyang
    nouyang@blah.edu
    Office: EAST CAMPUS # H208 
    Phone: 2256223  

gets reduced to

    nouyang@mit.edu

and blanche -al just says

Warning: “nouyang@mit.edu” converted to “nouyang” because it is a local name.

and works perfectly fine.