Is there any way to drive a tolerance on a drawing. Example: the dimension * .01 = value for tolerance.
This would be a HUGE time saver for me..Ive found nothing on the subject searching...Any ideas??
SolidworksDrawings And Detailing
Is there any way to drive a tolerance on a drawing. Example: the dimension * .01 = value for tolerance.
This would be a HUGE time saver for me..Ive found nothing on the subject searching...Any ideas??
SolidworksDrawings And Detailing
I don't think there is any way but might be someone can make a macro that can do the calculation and add the tolerance.macro
Joel,
Are you talking about something other then setting up yout tolerances in your model?
yes im talking about driving the tolerance value from the dimension value.
Example
10.00 +/- 1.00
5.00 +/- 0.50
1.00 +/- 0.10
The tolerance is 0.10 x the dimension. This occurs frequently for me. I guess first i must explain i start with a premade template part / drawing. I update the dimensions as i need in the part and the drawing updates automatically. Problem is my tolerances dont update automatically. I must do that manually.
Hi Joel.
If you choose ''Fit with tolerance'' - and then chooses your tolerance - when you click on your dimension, the tolerance will automatic update when you change the size of your part.
like this:
You might want to think about possible building in equations into your
dimensions on the template parts that add this tolerance.
Im unsure how to accomplish either of your suggestions. The fit with tolerance is shaft and hole tolerances??
Some more detail would be a big help. How would i go about assigning my example above to a dimension ...ie tolerance = (dim x 0.10) ?
Want to push this topic back up...I really could use some help in this...anyone?
Joel,
I will try and explain. It sounded like there were certain numbers that had specific
tolerances on specific repeated type parts. What I am saying is if it is possible to
take these dimensions and add them to an equation adding the tolerance to it.
Maybe needing an IF statement. I hope this makes some sense.
EQUATIONS
If the tolerance is always some procedurally derived value (always 10%), then most folks add a note on the drawing saying something like "all tolerances +/- 10% unless otherwise specified". There is no other mechanism to support this other than writing a macro.
Yes i have multiple tolerance that are procedurally derived as you put it. different % for different dimensions however...so a macro is the only way? Ive no experience with macros.
Scott. can you give me an example of what your talking about. im not clear on what your thought process is. I am familiar with equations and tables but i have never driven a tolerance in either.
As of right now, there is no way to place equations inside of tolerence fields in the PropertyManager (PM). This is really what your request seems to be. Am I right in that interpretation?
You can drive model dimension tolerances in a design table using IF statement in Excel. Then you can insert model items onto drawing.
Wow that's a cool trick Wayne.. Thanks for sharing it
I am having some issues with it in 2011 sp4 Excel 2007 that I will report to my VAR on Monday. For some strange reason, it no longer works for me. This is an old file. The D1@Sketch1 dimension works, but I cannot do the same thing with D2 dimension. I also cannot do this on a new part.
Try doing it in an external excel file and then link that to DT.
What I was talking about is basically what Wayne outlined in his
excel table.
If a dimensional value is = to or less then this value, then this tolerance
If a dimensional value is = to or greater then this value, then this tolerance
Wayne,
That's what I'm looking for thanks. Unfortunately you still can not make the tolerance equal a simple formula can you.? The cell that's populates the tolerance must contain the type and the value and therefore can not contain a formula. Am I right? I can work with this either way.
You should be able to do that. Simply put the values in different cells and concatenate the values.
Almost there...Thats great Deepak !!, now here is another issue i runto...the formula in the design table does not update unless i open the table...ive run into this before...????
Its true i can not get formulas to update in the DT if i change a driving dimension in the model (and push it to the DT) any ideas?
I do this by using formulas in an Excel design table to define different properties ($prp@property) for multiple configurations. Then in the drawing I insert an annotation note using Link To Property - select the "Component to which the annotation is attached" - select the property defined in the design table from the pop down menu. Then I drag the note to attach it to the dimension. SW places the note below the dimension instead of to the right but other than that it works for me. Some of my tolerances have either "MM" or "INCH" appended to them in Excel depending on the configuration.
About the best you can do is set the design table so that it blocks model edits that would update the design table and also add the driving dimension to the table if it is not already there. This will force you to open the design table to change the dimension and would prevent you from forgetting to open the design table after changing the value of the dimension.
Wayne,
If you toggle in and out of the design table on the second try the tolerance will show up in the model (im running 2011 sp3, excel 2010)
M.B.,
That sounded promising and simple (i love simple), Not sure this will work for me as i need. I gave it a quick try and once i attached the note to the dimension the tolerance did not seem to update anymore...im sure i was doing something wrong. Any way you could attach an example?
Ive pretty much accoplished what i need to do and i have a very slick template assembly & fabrication drawing package. The only obstacle im left with is i need to toggle in/out of parts and design table to ensure all parts, and dimensions update properly. Im wondering if there is a way to "automate" this. I no nothing of macros...perhaps it time to learn?
im still open to any insight that can be provided. This has been a great learning experience!
Just for completeness, here's the way to do it with VBA in equations rather than the design table. It's a bit more cumbersome to set up for each dimension, but it recalculates the tolerance values with every rebuild rather than having to open the design table.
This is the equation to set the symmetric tolerance value of D1@Sketch1 to 10% of its value.
"dummy"= Part.Parameter("D1" & Chr(64) & "Sketch1").Tolerance.SetValues(0,"D1@Sketch1"*0.1/1000)
Just to break it down a bit:
"dummy" is nothing. It's just a dummy variable that's required to make this code fit the syntax of a SolidWorks equation. The equation has to have something on the left side of the "=". It could be anything.
Part.Parameter("D1" & Chr(64) & "Sketch1") specifies to SolidWorks which dimension whose tolerance we want to control. In this case, we are working on D1@Sketch1 . In order for the code to work, you have to break up the name of the dimension and replace each @ sign with Chr(64). The & is the string concatenation operator.
.Tolerance.SetValues tells SW that we want to set the values of the tolerance of the dimension.
(0, is the lower tolerance limit value followed by a comma to separate it from the upper tolerance value. In the case of symmetric tolerance, the lower value is ignored. However, if you wanted to set a bilateral tolerance value, you would specify the lower limit here.
"D1@Sketch1"*0.1/1000) is the upper tolerance value. Remember when we had to break up the dimension name and replace @ signs with Chr(64)? That's because before SW sends this code to VBA for evaluation, it looks through the code for special strings. Dimension names inside of quotes are one those special strings. Whenever SW finds the special strings, it substitutes the numerical value before passing the code on to VBA. So, if the value of D1@Sketch1 is 864mm, VBA will see 864*0.1/1000. The *0.1 gets us 10% of that value. The /1000 is a scale factor to go from mm (my document units) to meters (SolidWorks system units). No matter what your document units are, SetValues requires input in meters.
Josh,
Awesome...cant wait to try this...it keeps getting better!!!
Josh,
Finally got to try this tonight. It works so sweet. Can you recommend a source to reference VBA for a VBA ignorant person like me...so powerful and i know nothing about it!!
BTW for inch users:
"dummy"= Part.Parameter("D1" & Chr(64) & "Sketch1").Tolerance.SetValues(0,"D1@Sketch1"*0.1/.0254)
Josh,
im trying to use this in an assembly. Is that possible?
Yes it should work in assembly too but make sure you add "D1@Sketch1@AssemblyName" (haven't checked it but there is no harm in a try)
This is great stuff. I am extreemly new to using the macro functions in SW and my VBA skills are very minimal. Can I get a screenshot of this code in VBA so I can see what I am doing wrong? Thanks.
Get yourself familiar with any programming language like VB, .Net, C, C++ and then you can start making your programs/macro and test them.
If you looking for books, check the books by Luke Malpass and Mike Spens
If you looking for examples/website for macro example, then the forum itself is full of tons of examples. Some of the other sites to look at are:
Lorono's SolidWorks Resources
Lenny's SolidWorks Resources
Angelsix SolidWorks Macros
3DCC Free SolidWorks Macros
SolidWorks Tips
SolidWorks API
In order for this to work in an assembly, you have to change that very first "Part" to "Assembly".
"dummy"= Assembly.Parameter("RD1" & Chr(64) & "Annotations").Tolerance.SetValues(-0.01*"RD1@Annotations"/1000,0.02*"RD1@Annotations"/1000)
This example equation will set the lower tolerance of reference dimension "RD1" to -1% and the upper value to +2%.
The easiest way to figure out the string for the dimension ("RD1@Annotations" in this example) is just to click on the dimension while editing the equation. SolidWorks will dump the dimension name into the equation, and then all you have to do is replace the "@" with Chr(64).
This kind of application (using VBA and SW API in equations) is actually a bit more advanced of a topic than most people ever get into.
If you want to learn, though, and you've never used VBA or other object-oriented languages, you probably want to start in Excel rather than SW. The Excel object model is a bit simpler, and there are loads of free tutorials you can find online to get started. The next step would be SolidWorks API, which Deepak gave you some good links for. Finally, just about everything I've found out about VBA in equations (which is almost completely undocumented in SW) is contained in the SW World presentation I gave last year. You can find all the presentations online.
I cant tell you how much this has helped...Thanks to all,.,, Josh i ultimately went with your method and it works perfect.. next im off to try to find a macro to rebuid parts from an assembly without the need to "edit part"
Thanks Again!!
Josh,
I hope you read this. This wonderful tool you gave me seems to no longer work with the "upgraded" equation manager. Tells me the syntax is wrong. Any ideas anyone?
Josh,
Wayne,
I saw your method of driving the tolerance using a design table. I was able to replicate what you show in the screenshot using a "SYMMETRIC" tolerance. Any idea what the syntax is for a "HOLE FIT"?
Thanks.
Steve