Equation Discoveries II

Discussion in 'SolidWorks' started by Mike J. Wilson, Nov 28, 2003.

  1. For those of you who missed part I, here's the
    original link...
    http://makeashorterlink.com/?S220129A6

    I found a few more operators, but I don't know
    how to utilize them or what they can be used for.

    Does anyone have any suggestions?

    Here's my list O' operators...

    like -> Used as an "equal to" (why can't I use "="!)
    <> -> Used as a "not equal to" (stopped working?)
    and -> Can be used
    or -> Can be used
    & -> Used to "Concatenate" (add two strings)
    not -> not sure what it does?
    eqv -> not sure what it does?
    imp -> not sure what it does?
    mod -> not sure what it does?
    xor -> not sure what it does?

    Here is an example (in SW2004) of a 'pendulum'
    type of motion. I used some equations to create
    momentum as the pendulum swings to simulate the
    effects of gravity...
    http://www.mikejwilson.com/misc/pendulum.zip

    Just open the file and hit rebuild to see it go
    or use my rebuild macro.

    Here is an AVI if you want to kick back and see
    it work without having to do anything...
    http://www.mikejwilson.com/misc/pendulum_animation.zip

    What can we do with these crazy operators?

    Mike Wilson
     
    Mike J. Wilson, Nov 28, 2003
    #1
  2. hey! but they're all Visual Basic keywords! This means SW equations use
    either VBA or what's called the "Script Control" (the one we use in
    www.soliplus.com/mathsurf/ to make programmable shapes)

    "like" compares strings in VB... strange...
    now, once you know that "true" = -1 in VB and "false" = 0, you can write
    equations like:
    "D3@Sketch1"=-("D1@Sketch1">"D2@Sketch1")*"D1@Sketch1"-(not
    "D1@Sketch1">"D2@Sketch1")*"D2@Sketch1"
    which sets D3 to the largest of the D1 and D2 values....

    Nice, isn't it ?
     
    Philippe Guglielmetti, Nov 28, 2003
    #2
  3. Me stupid C++ programmer... I didn't even knew "IIF" existed! :))
    Of course
    D3@Sketch1"=IIF("D1@Sketch1">"D2@Sketch1","D1@Sketch1","D2@Sketch1") is much
    simpler...
     
    Philippe Guglielmetti, Nov 29, 2003
    #3
  4. Is there a character limit to the length of an equation? I know MDT has a
    limit and the only work around was to rename the variables (dimensions) to
    shorter names which increased the power of the equation, but decreased the
    debugging, since one has to know what 2 or 3 letter names ment .

    Keith
     
    Keith Streich, Dec 2, 2003
    #4
  5. Is there a character limit to the length of an equation? I know MDT has a
    limit and the only work around was to rename the variables (dimensions) to
    shorter names which increased the power of the equation, but decreased the
    debugging, since one has to know what 2 or 3 letter names ment .

    Keith
     
    Keith Streich, Dec 2, 2003
    #5
  6. Is there a character limit to the length of an equation? I know MDT has a
    limit and the only work around was to rename the variables (dimensions) to
    shorter names which increased the power of the equation, but decreased the
    debugging, since one has to know what 2 or 3 letter names ment .

    Keith
     
    Keith Streich, Dec 2, 2003
    #6
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.