Equations in SW2005

Discussion in 'SolidWorks' started by Wayne Tiffany, Jan 12, 2005.

  1. Mike Wilson's Curve Drive Animation
    http://www.mikejwilson.com/solidworks/solidworks_files-02.htm

    If you run it (CTRL-Q) in SW2005, it works fine. If you edit the equations,
    it tells you this:

    "The following sets of equations define the same parameters

    "Angle@Wheel Rotation "=IIF("Angle@Wheel Rotation
    ">360,9,"Angle@Wheel Rotation ")
    "Angle@Wheel Rotation "="Angle@Wheel Rotation
    "+5

    "Distance@"="Distance@"+.05
    "Distance@"=IIF("Distance@">12.65,.003,"Distance@")

    Only the last equation in each set will be applied."

    Ok, fine, but it disables some of the equations so it doesn't function any
    more. I tried the same thing in SW2004, got the same message, but it didn't
    disable any of the equations. Any thoughts out there? Anyone else try this
    and see the same thing?

    WT
     
    Wayne Tiffany, Jan 12, 2005
    #1
  2. Wayne Tiffany

    Blair Sutton Guest

    I experienced the same problem with equations.

    After defining 2 equations with the same dependent variable (left side
    of equation), an error message appeared. The error message said that
    the last two equations defined the same variable and only the last one
    would be applied. When going back to edit/display the equations, the
    first equation defining the dependent variable was suppressed. The two
    equations used if statments(iff), so that only one would be true at any
    time. I was looking at the ship-in-a-bottle wave equations trying to
    recreate my own waves.

    I wanted to rewrite the equations with a nested in one line in the
    equation box, but am unsure how. I observed the unaltered equations to
    work on rebuild as well. So I believe that the error comes from an
    error check routine that has been added and runs when leaving the
    equation routine. I wasn't able to think of a solution.

    Does anyone have a way to do a nested if in the equations?
    Should this be done in a macro?
    Is there a way to do a switch statement? (a=1;do x,a=2;do y;...)
    Is there a good list or reference for the VB functions to be used in
    equations?

    Should we just ask SW to make this error check a warning? or ask user
    before suppressing?

    Wayne, I wish I had more answers than questions.
    SW 2005 sp0.0

    Blair
     
    Blair Sutton, Jan 12, 2005
    #2
  3. Wayne Tiffany

    Tin Man Guest

    I saved the below post a while back. Not sure if the author was Mike J.
    Wilson or Philippe Guglielmetti. Personally, I use Design Tables
    instead of Equations.

    Hope this helps,
    Ken
    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)

    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...

    not -> not sure what it does? logical negation
    eqv -> not sure what it does? logical equivalence operator (very
    seldom used)
    imp -> not sure what it does? logical implication operator (very
    seldom used)
    mod -> not sure what it does? modulus, or remainder of a division
    xor -> not sure what it does? exclusive OR

    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 ?
    <<<
     
    Tin Man, Jan 14, 2005
    #3
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.