|
NHCAD
Fun Projects in Mechanical Design & Custom Programming Lebanon, NH
CAD(Computer Design)
CNC / Steppers
J2ME Mobile Programs
1964 Oday Javelin
|
SolidWorks Custom Properties
I just wanted to take a moment to explain to you what Custom Properties are and what they can do for you. Custom Properties are bits of information that you can save with your SolidWorks file. They exist in parts, assembiles, and drawings. They can be very useful when used with Annotations, BOMs (Bill Of Materials), and Drawing Templates. You can access the custom properties of any SolidWorks file by using the SolidWorks menus FILE, PROPERTIES (see Figure 1).
Figure 1 – Starting Summary Info dialog After which you will see a dialog box called "Summary Info" (see Figure 2).
Figure 2 – Summary Info dialog box For part files and assembly files the Summary Info dialog has three sections to it accessed by the three tabs at the top; Summary, Custom, Configuration Specific. Drawings cannot be saved with different configurations, so only Summary and Custom properties can be assigned to drawing files.
Summary Properites Summary Properties are simply text boxes that you can store useful information. Author, Keywords, Comments, Title, and Subject can take any text you feel like typing in. The comments field is multiline so you can simply keep typing along and it will automatically wrap to the next line. You can also use the <Enter> key to start a new line. The fields Created, Last Saved, and Last Saved By are read only. They are properties of the file. You may see them, but you cannot edit them. In Figure 3 I have entered some sample data. You may want to enter some data too, we’re going to take a closer look at this information.
Figure 3 – entering data The Summary properties have some unique abilities in Windows too. They are recognized by Windows. If you have entered some information as I have in Figure 3, press OK and save the SolidWorks part file (mine is called Part1.SLDPRT). Now using Windows Explorer, find the same part file right-click on it. You will get a pop-up menu with the last option being "Properites" – Figure 4. This takes you straight to the Summary Properties of this file – Figure 5.
Figure 4 – Windows Properties
Figure 5 – Windows Summary Properties While I haven’t found a great use for this feature myself – such as global edit/replace ability. It is a unique feature of the Summary Properties and I felft it worth mentioning. Perhaps there are some utilities out there that can exploit this feature more for finding files or automating file changes. Enough of this… on to the Custom Properties!
Custom Properties As I said before, Custom Properties exist in all three file types; parts, assemblies, and drawings. They can be pretty useful too. Custom Properties can contain more than just text. When creating a custom property you have to specify a Name, Type, and Value – see Figure 6.
Figure 6 – Custom Properties
You’ll notice that the "ADD" button will change between "ADD" and "Modify" as you enter or edit these properties. One small annoyance is that if you don’t press the Add/Modify button before pressing OK, you will lose the property. It’s the same as hitting Cancel. At the top of the dialog is the Name text box. You can type in any name you want, or you can choose from the list right below it. The list doesn’t do anything for you except standardize on spelling. "Client" is the same as "client" so case doesn’t seem to effect it. There are special cases when you don’t want to use spaces in the Custom Property name. If the property is going to be used in a Bill Of Material (BOM) then you DO NOT want to have a space in the property’s name. You should use an underscore "_" instead or come up with something else ( customer_name or customerName ). The Type of property can be Text, Date, Number, Yes/No as shown in Figure 7. Not much more to say, just pick one of the four options.
Figure 7 – Custom Property Type The Value of the property must match the Type of the property. The Text type is wide open. Just about anything can be entered as a text value. Dates should be enterd in "mm/dd/yy" format. You can enter "Jan 3, 2000" and it will be converted to "1/3/00". Its pretty smart that way. Numbers can be any POSITIVE real number. For Yes/No value you MUST enter "yes" (case does not matter) if you want the value to be "Yes". ANYTHING else will return the value of "No" (1, 0, Y, true, false etc.) – see Figure 8.
Figure 8 – Properties Grid At the bottom of this dialog, is a Grid, showing the current list of properties, their value, and their type. It also allows you to select an existing property so you can Modify or Delete it. If you are modifying the value of a property, don’t forget to press the Modify Button before pressing the OK Button. I know I’m repeating myself, but I’ve made this mistake numerouse times. The Configuration Specific Properties operate in exactly the same way as Custom Properties. As you change the current configuration of you part or assembly, only the properties created for the current configuration will be shown. In contrast, Custom Properties will always be available regardless of the current configuration. For more information on creating and using configurationas you should refer to the SolidWorks help or manuals.
Using Properties So now you can create all these fabulous properties but you don’t know what to do with them. Well they can be used in annotations (notes), in the BOM of a drawing, or in a drawing template. Annotations If you still have the Part1.SLDPRT file open you can create a simple demo right now. Well almost right now. You see, annotations can only be applied to the a part’s body (face, vertex, edge) so you’ll need to create a cube or something. I will create a new sketch (Sketch1) and make a square with sides D1=2.9428 and D2=2.3441 – see Figure 9. I know this seems rudimentary but I am headed somewhere with this.
Figure 9 – D1 & D2 in Sketch1
Figure 10 – Inserting a Note Extrude Sketch1 to make a square. Now you can apply an annotation to this solid body. Select a face on the cube (or edge or vertex) and use the SolidWorks menus Insert, Annotations, Note – see Figure 10. When you do you will get the standard SolidWorks dialog for entering notes. Perhaps you never noticed it but there is a "Link to Property" icon here. This is where you can insert a link to a custom property – see Figure 11.
Figure 11 – SolidWorks Note Dialog
Figure 12 – Link To Property Dialog
When you do press the "Link To Property" icon, you will get a list of existing properties. If you need to do some maintenance on your properties and can also do it right here right now by pressing the Edit Properties button – see Figure 12. Notice there is a check box called "External model reference". Now it is grayed out, but we will be able to use it when we get to drawings. Here’s another trick you can do with notes. Turn on the feature dimensions by right-clicking the Annotations feature. Check on all the options as shown in Figure 13. This will turn on the dimensions of your sketch and all other featues. While I don’t normally work in this mode, it is handy in making my point.
Figure 13 – Show Feature Dimensions
Now select a face on the solid body and insert another note. This time, when the note dialog box comes up, select a dimension from your model. I have selected D2 which is the height of the box. Notice that you have created a link to the dimension this time. The note’s actual content is "D2@Sketch1@Part1.SLDPRT" – see Figure 14.
Figure 14 – Link to a Dimension When you press the OK Button you will get a note attached to the solid body that reflects the value of D2. It is parametric too. If you change the value of D2 it will change the value of the note too. It doesn’t work the other way though. Note that the note has double quotes before and after it. If you were to forget the double qoutes it does not work. So here is what we are going to do. Edit the note (right-click on the note and then choose properties) and COPY the entire text "D2@Sketch1@Part1.SLDPRT" . If you didn’t know you can hold down the left mouse button and drag it across the whole text it will have a blue background showing you what you have selected. Then place the mouse over the text (with the blue background) and press the right mouse button. You should get a menu with COPY as one of the choices – see Figure 15.
Figure 15 – Copy the Dimension Link Now I want you to create a new Custom Property as follows: Name = Height Type = Text Value = "D2@Sketch1@Part1.SLDPRT" (you can paste this in – right click – paste) The reason I had you copy it was to avoid having to type it. Believe me, one little typo and it will be hard to trace. Also, as your models get complex and you change the names of your sketches or features, copy/paste is a pretty fool-proof method to get the job done. So what is the point of creating this Custom Property called height? Well you have created a generic custom property called height. You could create this property in 20 different parts and assign the correct dimension to it in each part. Remember it won’t always be "D1@Sketch1@Part1.SLDPRT" every time. But height can be there every time and you will assign the correct dimension to it. It seems like a round-about way to do things, but it will help automate things down the road when we get to drawings. So where’s the drawings?
Drawings Well placing notes in drawings works the same way as placing notes onto a part face. Drawing notes can be placed anywhere on the drawing sheet. They can, but don’t have to, include leader lines. When placing a note into a drawing, you can also get tricky by selecting a dimension and it will create a link from the note to the value of the dimension. For the next example I will create a new drawing. I will also use the A-Landscape template that SolidWorks provides. I have also placed 3 views of the cube I created in Part1.
Figure 16 – Part1 in Drawing Insert a new note now by right-clicking the mouse anywhere in the drawing. Select Annotations Note from the pop-up menu. You will be prompted to enter some text for your note. Instead I will select the 2.934 dimension from by front view. The note is automatically filled in with "D1@Sketch1@Part1-1@Drawing View1" . Pretty slick huh? When you press the OK Button now, you will get a note that shows the VALUE 2.943. Lets do it again, this time using the custom properties we created in the part. This time use the "Link to Properties" icon in the note dialog box. Now you will be able to check the box for External Model Reference and then you will get a list of Custom Properties that belong to Part1.SLDPRT. I have selected the Custom Property called height which was created earler in this tutorial – see Figure 17.
Figure 17 – External Model Reference
I know what you’re thinking. Why bother creating custom properties if I can simply create links right to the dimension itself? Why go through the extra hassle of creating this Custom Property called height? Drawing Templates is why.
Drawing Templates If you haven’t experimented with drawing templates much you should. They are pretty handy things. I’ve seen people trying to write macros and other utilities to help them fill in their title blocks, when really SolidWorks has already design a feature so you don’t have to. Of course you do have to enter the information somewhere. Hence, Custom Properties. If you right-click anywhere on your drawing you get a pop-up menu. Besides entering annotations there is another choice to Edit Template. When you edit the template, you will be able to make changes to the drawing template – the A-borders that I imported when I started the drawing. The idea behind drawing templates is that you can spend some time creating and setting them up once, and then use them over and over again. This way you can create a few drawing templates to be used in ALL your drawings. When you edit the template you can drag lines around and enter text and create a happy company style border. You can also enter notes… the notes can also make reference to Custom Properties. The Custom Properties you use can belong to the drawing OR to the external model. This is where the height property will really come in handy. Create a note in your template. Press the "Link to Properties" button Check the box for "External model reference" Select the height property Press the OK button to close the dialog and create your new note. Now you have a note IN your template that will always try to point to the external reference called height. This is very handy because if you were to assign the note to "D2@Sketch1@Part1.SLDPRT" it would work here, in this part. It would not work when you re-use this drawing template with another part file (Part23.SLDPRT). When the designer is creating a part, he/she can create the custom property called height and give it a value that will reference the correct dimension knowing that this information will be properly displayed when the part is used with your drawing template. So far I have concentrated on the external model property called height. There are many properties of the drawing that are very handy too. Things like the filename, currrent sheet number, total sheet numbers, etc. should all be given consideration for addition to your drawing templates. I have created custom properties (not external) that belong to my drawing template. I use things like Name (Joe Jones), Date (2/2/00), Material (aluminum) etc. What I have discovered is that when I bring in a template, the custom properties get created and they will have the default values that I was using when I saved the template. When I don’t want to see a custom property in the template, I set the value of the property to a <space>, but I don’t delete it. Chances are I will want to fill in the information eventually. For more information on using drawing templates you should refer to the SolidWorks help file and manuals. I made a point to show you the height property using external reference because it is a bit more advanced and unlikely that you would stumble across it yourself.
Bill Of Material (BOM) Creating BOMs can be tricky. I know I’ve had a few rounds with them. Of course a good place to start again is with the SolidWorks help files and manuals. SolidWorks actually did a good documenting this. I will try to repeat the instructions here to be complete. It is possible to make additional columns in your BOM using custom properties. I won’t bore you with creating a standard BOM. I want to jump straight into modifying one. Frist things, make a copy of your standard BOM template (its really an Excel spreadsheet) and call it something else. I found the standard one called "C:\Program Files\SolidWorks\lang\english\bomtemp.xls" and made a copy of it called "bomdemo.xls"
Figure 18 – Inserting a New Column
Open the new file "bomdemo.xls" with Excel. Right-click in the cell E1 ($$END) and select Insert from the popup menu. Select the radio button "Shif cells right" and then press the OK button – see Figure 18. This will insert an empty column into the spreasheet. Type some text into the new cell D1 which will become the heading displayed in the BOM. It does not have to match the name of the property that you intend to put here. It is merely a label for this column. I called my colomn "tutorial". You’ll want to press <Enter> or click onto a different cell to stop editing D1. Now you need to select cell D1 again. I know, we just came from there. You need to select it now, not edit it. Single click only. If you double click the cell you will go into edit mode again and you don’t want to do that. You could also arrow back to cell D1, which will select it.
Figure 19 – Creating a Named Range
Now using the menus at the top of Excel, use Insert, Name, Define – see Figure 19. This is where it gets tricky. You will get a doalog asking for you to define a new range name.
Figure 20 – Define Name
Figure 21 – Showing the Tutorial Column
Now create a new drawing, bring in a view of Part1.SLDPRT, and then create a BOM. You should get a BOM that resembles Figure 21. Well that’s about it folks. Its an awful lot of information I know. Practice it a bit and you will feel more at home with it. Things that you might want to include in your BOM might be overall length, width, and height. Or you may focus on the part’s physical properties like density, weight, and volume. These are all great things to put into your BOM. What about the dimension called height? If you put the Custom Property height into your BOM you will get the literal string value back. Your BOM will say "D2@Sketch1@Part1.SLDPRT" which is much less useful than the dimension value 2.344. You could always set the value of height to be "2.344" which would break the link to the dimension. In the same sense you can create a Custom Property called density with the value 0.036 lb/cu in (of type Text). That would work as well. Realize that these practices require close attention by the designer to keep the Custom Property information accurate. |