Squaring List For Rectangular Blocks - Any Ideas?

IIRC, VB has some number formatting functions similar to the TEXT function in Excel. After that it should be possible to concatenate the string version of the numbers without reverting to decimals.
Reply to
Dale Dunn
Loading thread data ...
I did a search through the VB Help for "fraction" and didn't come up with anything useful. I hate fractions. Tell me quickly - what is the order - largest to smallest - 47/64, 5/8, 17/32. Unless you recognize the values from using them all the time, you can't look at them and know. Yes, you can convert to common denominators and then do it, but why not use decimal to start with. Then they are real numbers. And,,,, don't get me started on rounded off fractions - you don't have any idea what the number really is - merely a close guess. Stupid!
WT
Reply to
Wayne Tiffany
Wayne,
The property I use is named "Size". What do I need to change to post this to the config specific tab?
Thanks,
M.T.
Reply to
Malcolm_Tempt
(Watch the wrap of the lines).
retval = Part.DeleteCustomInfo2("", "BoundingSize") retval = Part.AddCustomInfo3("", "BoundingSize", swCustomInfoText, Height & " x " & Width & " x " & Length)
These are probably your current lines. Add the name of the config between the first set of quotes, and then change the BoundingSize to your desired "Size".
As I work on this, part of what I will add is the routine that picks up the name of the current config, so it's not dependent on always being "Default" or whatever.
WT
to the config specific tab?
Reply to
Wayne Tiffany
I agree toatlly that fractions are dain brammaged. I have a similar rant on numbered and lettered drill sizes.
I had a quick look at the macro editor help. Search for format function and format expression, and I think you'll find the tool you need. In Excel, I've used format expressions like "##/##" and "#-##/##" for fractions and mixed numbers.
Reply to
Dale Dunn
Wayne,
I really appreciate all your hard work. Please do not feel as though you have to do this. I saw your macro in earlier post and wondered if it were possible to display the feet and inches format. I really didn't intend on causing this much work for you. If you can pull it off it would be great. If it's simply to much work that's ok too. Either way I owe you at SW World. I'm trying to get a user group started and thought I would attend the Swug meeting to get some ideas. See you there.
Rob
Reply to
Rob Rodriguez
Rob, Where are you located? I can help with the ideas for a user group (why wait until January). Please contact me off line at richard dot doyle at cox dash (not hyphen) internet another dot com
Richard Doyle
Reply to
Richard Doyle
formatting link
About midnight last night I got to thinking that I should put this out as it is. Basically, it all works except the FT-IN thing gives strange results. Other than that, it appears to be useful.
Here are the major features of it.
1. This macro gets the bounding box dimensions for the config specific model and adds a small amount to it. This amount can be changed by modifying the "AddFactor" value in the code. Right now it's set to .015, which means .015", .015mm, .015m, etc., which is marginally useful except for inches. If people want it, I could put in a user input box to ask how much you want to add.
2. It checks to make sure you have a proper document open, and works on a part or assy.
3. It checks & utilizes the user units as set in that document, so it puts out the proper values, whether you are in mm, inches, or angstroms.
4. It will add 3 separate properties or combine them all into one property (your choice each time,) all of which are config specific, so you can run it on every config.
5. It will optionally draw a 3D sketch for you, which is handy to visualize where it thinks the boundaries are.
Here is what SW tells you about the GetBox function, so use it wisely.
The resulting box encloses the object, but it might not be the tightest box. The X, Y, Z points returned by SolidWorks are the lower- and upper-diagonal corners that bound the component with the box sides parallel to the X, Y and Z axes. SolidWorks returns box dimensions that enclose the component and are typically close to the minimum possible size.
The user interface behavior is the same. When the user selects a subassembly that is not loaded, there is no selection box around the subassembly. However, once the subassembly is loaded, there is a selection box.
IMPORTANT: The values returned are approximate and should not be used for comparison or calculation purposes. Furthermore, the bounding box may vary after rebuilding the model.
So, try it, use it, beat on it. Let me know what you see. I will continue to work on the Ft-In issue and will let you know when it's up.
WT
Reply to
Wayne Tiffany
Wayne,
Wow!!! thanks for taking the time to write this. It doesn't work in SWX2004 but in a couple of weeks we should be running 2005 and I will certainly appreciate you every time I run it.
Thanks again,
M.T.
Reply to
Malcolm_Tempt
formatting link
It's back out there. I fixed the fraction malfunction so that it properly checks for opportunities to simplify, rather than being so stupid. If you choose (Ft-In OR Inches) AND have fractions turned on, you will get Ft-In output. Otherwise regular numbers.
Let me know if it does what you want it to do.
WT
upper-diagonal
Reply to
Wayne Tiffany
It should - I've been using it in 2004 & 2005. Talk to me on Monday if you can't get it to work. I'm late to leave - need to pick up my son & take him to a Boy Scout overnight.
WT
2005 and I will certainly appreciate you every
upper-diagonal
Reply to
Wayne Tiffany
Thanks Wayne this macro will save me a bundle of time - but I can't get it to run in SW2004 SP4.1
I am a neophyte with macros but I created a simple 1X2X3 block and tried to run it - i got nothing. I then tried to run it on no part, and it did not notify me to open a part and/or assembly.
Does the macro have to be in a certain folder?
Turk
Reply to
Turk
It should run, and the fact that it tells you that you have to have a part or assy open first is evidence that it is running. Why don't you step through it and let me know where it fails.
1. Open your part or assy. 2. Open the macro with Tools/Macro/Edit 3. Find the line that says Sub Main() and click somewhere to the right and below it. This ensures that when you tell it to run, it starts at the beginning. 4. Press F8. This will step the program through 1 step at a time. Take the time to read each line. You may not understand it all, but you will get a feel for what is happening. Let me know what you see.
You can also call me and I will step through it with you.
WT 816-356-0660
Reply to
Wayne Tiffany
Wayne,
I opened the macro in the editor and recompiled it. I unchecked (2) SWX2005 libraries and now it works!
Thanks again,
M.T.
Reply to
Malcolm_Tempt
Sure - makes sense. I had been writing it in 2005, but testing in 2004. But, it would still find my 2005 references. Sorry about that - good job. Let me know what else you see after using it a while.
WT
SWX2005 libraries and now it works!
Denominator
Reply to
Wayne Tiffany

Site Timeline

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.