7 Replies Latest reply on Oct 31, 2006 7:50 PM by

    Making an integer out of a rational number

      I got this thread from AndersH in the API Groop

      This syntax works for me:
      "D2@sketch2";= IIF ("D1@sketch1"; LIKE 50, 2, 4)

      Meaning that if "D1@sketch1"; equals 50 then set "D2@sketch2"; to 2.
      Else set "D2@sketch2"; to 4.

        • Making an integer out of a rational number
          Don't think i've ever used conditional (if, iif, etc) statements in a SW equation. It should just be "=" but that doesn't seem to work, and my ">" was functioning like a ">=" Normally, if I have something that takes that kind of logic...there's multiple configs which I drive with equations in the design table.

          Sorry, but I'm going to have to punt on this one.
          • Making an integer out of a rational number
            It is strange i will add a post in the API forum to see if I can get some kind of resolution.
            Thanks for the try though.
            • Making an integer out of a rational number
              Jared,
              I can get the iif function to work for less then, greater, and anything else but i cant get the right syntax for equal to, please help thanks
              • Making an integer out of a rational number
                Equations use Visual Basic functions and syntax. Open the macro editor, and go to the help there to look up functions and their arguments.

                Obviously, there are limitations having to do with functions that can be evaluated within an equation. For example, you can't make a loop or select case structure in an equation. IF and IIF have been explored and used in the past with good results. There is also a variety of functions that can be used for rounding. I even launched a shell application from within an equation, just to see if I could.
                • Making an integer out of a rational number
                  Thanks
                  Do you know how to format if and statements as well.
                  • Making an integer out of a rational number
                    "int" will round down to the nearest whole number (just like in Excel.) So if you want to automatically create a pattern that is XLength long with hole spacing of no more than Z inches.

                    X_instances = int((X_Length+Z-.000001)/Z) + 1
                    X_spacing = XLength/(X_instances-1)


                    on 2006 31 16:50 Chris V wrote:
                    > The real question is if you have a square with x and y linear pattern of holes
                    > how can i make the equation for the linear patttern amount change to a whole
                    > number using the equation tool. Simply saying if the square is twenty by twenty
                    > and i want the holes in 2 inch increments what equation would i use so that i
                    > could change the square to 23 x 23 and have the number of holes change
                    > parametrically using the equation tool. (what would that equation be)
                    >
                    > Thanks in advance
                    • Making an integer out of a rational number
                      The real question is if you have a square with x and y linear pattern of holes how can i make the equation for the linear patttern amount change to a whole number using the equation tool. Simply saying if the square is twenty by twenty and i want the holes in 2 inch increments what equation would i use so that i could change the square to 23 x 23 and have the number of holes change parametrically using the equation tool. (what would that equation be)

                      Thanks in advance