What do you do when you need to find a quick answer to a SolidWorks related question?
I, for one, go first to the help file, then to the SolidWorks Knowledgebase and in the end to one of my more experienced colleagues (you know them: Wayne, Rob, Joe, Chris, Andrew, Scott, Matt, Adam). This approach insures a 99.9% success rate.
You can ask the world, that’s who. The SolidWorks community, to be more precise. The citizens of these fora never go to the beach and I suspect they never sleep. You will always find somebody ready to answer your questions and to provide solutions – in less time it took me to write this post. Most of the times, a question generates a whole brainstorming session which results in multiple solutions.
Only last week-end, one of the forum’s gurus, Deepak Gupta, asked a very interesting question. Now you should know that Deepak is usually the one providing solutions to other people’s problems, so whenever he asks a question, you can bet is a tough one.
He asked this question Saturday afternoon and by the end of the week-end, no less than 3 solutions were suggested. What makes this outcome even more interesting, is the fact that (to the best of my knowledge) none of these solutions can be found anywhere in the SolidWorks documentation.
Deepak also came with the perfect example for when such a “rounding” might be needed. Let’s say your file units are set to imperial (the mass is expressed in pounds) and you need to list the mass in kilograms in a drawing.
The equation would be:
You will notice that the result of the SolidWorks equation is 454.545. What if you need a 2 digits precision? Changing the settings in the Tools/Options/Document Properties/Units/Decimals does not affect the precision of the equation result.
Solution #1 from Bill Hamze :
You can use the Round function in the equation body. For 2 digits precision the equation would be:
Solution #2 from WayneMatus :
You can use the Format command from VBA in the equation body. For 2 digits precision the equation would be:
Write your own rounding function. To make things easier to understand, 2 equations were created:
“Mass_in_lb”= Int(“SW-Mass”/2.2*10 ^ “Precision”+.5)/10^”Precision”
What do you think? Can you suggest a fourth solution?
Get Certified SOLIDWORKS Services from Javelin
Javelin Experts can help you to: