Squaring List For Rectangular Blocks - Any Ideas?

Discussion in 'SolidWorks' started by Sean-Michael Adams, Oct 10, 2004.

  1. 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.
     
    Malcolm_Tempt, Oct 13, 2004
    #21
  2. (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


     
    Wayne Tiffany, Oct 13, 2004
    #22
  3. 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
     
    Rob Rodriguez, Oct 14, 2004
    #23
  4. 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
     
    Richard Doyle, Oct 14, 2004
    #24
  5. http://www.kcswug.com/programs/macros/BoundingBox.swp

    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
     
    Wayne Tiffany, Oct 14, 2004
    #25
  6. 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.
     
    Malcolm_Tempt, Oct 15, 2004
    #26
  7. http://www.kcswug.com/programs/macros/BoundingBox.swp

    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
     
    Wayne Tiffany, Oct 15, 2004
    #27
  8. 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
     
    Wayne Tiffany, Oct 15, 2004
    #28
  9. Sean-Michael Adams

    Turk Guest

    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
     
    Turk, Oct 16, 2004
    #29
  10. Perfect Wayne!! Great job. This is going to make my life a whole lot
    easier. THANK YOU.
     
    Rob Rodriguez, Oct 16, 2004
    #30
  11. 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
     
    Wayne Tiffany, Oct 18, 2004
    #31
  12. Wayne,

    I opened the macro in the editor and recompiled it. I unchecked (2) SWX2005 libraries and now it works!

    Thanks again,

    M.T.

     
    Malcolm_Tempt, Oct 18, 2004
    #32
  13. 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!
     
    Wayne Tiffany, Oct 18, 2004
    #33
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.