Equation Question

Discussion in 'SolidWorks' started by Seth Renigar, Aug 2, 2004.

  1. Seth Renigar

    Seth Renigar Guest

    I have a sketch that contains a fully defined circle. I would like to draw
    another circle, concentric with this circle, but make it larger to the next
    closest 1/16 of an inch so that we can use standard drills.

    Does anyone know of a way to control the diameter of the second circle to
    meet my criteria by using equations or something? It will need to update
    properly if the first circle ever changes also.

    TIA
     
    Seth Renigar, Aug 2, 2004
    #1
  2. Seth Renigar

    Arlin Guest

    This equation should do the trick:

    new_dim = INT((old_dim+1/16)*16)/16
     
    Arlin, Aug 2, 2004
    #2
  3. Just a stab in the dark but can you just offset by 1/32"?

    Matt B.
     
    Matthew A. Bush, Aug 2, 2004
    #3
  4. try this
    "D2@Sketch1" = (int("D1@Sketch1"/(1/16))+1)*(1/16)

    devide the number by 1/16 to figure exactly how many 1/16s it is
    Then use int to round it down to the nearest integer.
    Add one to make sure it is rounded up.
    multiply by 1/16 for the nearest 1/16

    Regards,
    Corey
     
    Corey Scheich, Aug 2, 2004
    #4
  5. Actually what Arlin and I posted will evaluate to the next 1/16 even if you
    are at an even 1/16 so .1875 would evaluate to .25
    if you use this equation
    "D2@Sketch1" = iif("D1@Sketch1" >
    (int("D1@Sketch1")),"D1@Sketch1",(int("D1@Sketch1"/(1/16))+1)*(1/16))
    ..1875 will evaluate to .1875
    but .1876 would evaluate to .25

    Corey
     
    Corey Scheich, Aug 2, 2004
    #5
  6. Seth Renigar

    Seth Renigar Guest

    Corey,

    Both your solution and Arlin's solution are great. I could understand
    Arlin's equation a little easier though. I use equations all the time, but
    didn't know about the INT command. I guess I need to do some more reading
    on equations.

    The only problem I ran into is that no equation will update until you exit
    the sketch if the referring dimension for the equation is a driven
    dimension. This has nothing to do with these specific equations though. It
    is like that with any equation. That is OK as long as it does update while
    exiting a sketch or rebuilding.

    Anyway, thank you both.

    P.S. Matthew - I needed it to update to a standard 1/16 size even if the
    inner hole was non-standard....
     
    Seth Renigar, Aug 2, 2004
    #6
  7. Seth Renigar

    Arlin Guest

    I use equations all the time, but didn't know about the INT command.

    FYI:
    The INT operator rounds a number down to the nearest integer. It is a
    common operator used in VB, Excel, and other places.

    Corey's equation is really the exact same thing as mine, but in a little
    different form. Corey's form is really a bit more useful as if you want
    to instead round up to the nearest 1/32, you just replace all 1/16s with
    1/32s. Thus,

    "D2@Sketch1" = (int("D1@Sketch1"/(X))+1)*(X)
    where X is the amount you wish to increment by (1/16 in your case)

    OKAY, done typing now...guess I just like to see myself type.
     
    Arlin, Aug 2, 2004
    #7
  8. Seth Renigar

    Seth Renigar Guest

    Thanks Arlin for that bit of info.

    Maybe one day I will actually have a chance to start trying to learn VB. My
    biggest problem is that I don't know where to begin...
     
    Seth Renigar, Aug 3, 2004
    #8
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.