sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    DC - 6² isn't written 6^2?

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    14 Posts 8 Posters 2.4k Views 8 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thomthomT Offline
      thomthom
      last edited by

      I tried to write 6² as 6^2 as in most other scripting languages I've used. But that caused an error. What syntax do you use in DC formulas?

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        Ya know, I haven't figured it out yet. I keep faking it with x*x. There is this function:

        EXP(number)
        The EXP function returns e raised to the power of number.

        But I don't understand the explanation. I'm intereted in the answer too.

        Chris

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • M Offline
          matthew.robert
          last edited by

          That is strange that ^ doesn't work. I believe this will accomplish the same thing:

          EXP(a*LN(b))

          Where b is being taken to the power of a.

          Instead of =4^3, you can use =EXP(3*LN(4))

          ...it might only work for positive numbers.

          Matt

          1 Reply Last reply Reply Quote 0
          • scottliningerS Offline
            scottlininger
            last edited by

            Hey guys,

            Support for the ^ operator is on our feature request list, but for now you have to do the math yourself. Let me know if you find any other "standard" spreadsheet operators that should be added to DCs.

            • Scott Lininger
              SketchUp Software Engineer
              Have you visited the Ruby API Docs?
            1 Reply Last reply Reply Quote 0
            • J Offline
              James Fraser
              last edited by

              @Matt you are correct, that will give you the right answer and it will work for only positive values.

              If b is negative and a is odd, then you can multiply by -1 to get the correct answer. If a is negative then you want 1/x at the end, instead of x.

              So a general formula might be:

              b^a = IF(SIGN(a)=1, IF((SIGN(b)=-1) AND (ISODD(a)), -1, 1)*EXP(a*LN(b)), 1/(IF((SIGN(b)=-1) AND (ISODD(a)), -1, 1)*EXP(a*LN(b)))
              

              Yeah, it would be nice if ^ worked.

              It is late here, so you may want to check that formula before relying on it.

              @Chris, there is no e in the example because e is a mathematical constant and the basis for exponentials (ie ^). It is the value where e^x = d/dx e^x and e^πi=-1

              It's a very important number, but one you will only come across if you do a fair amount of calculus, probably. It makes sense that if you only have one exponential function available that it should be that one, but I would like ^ all the same.

              http://www.FormFonts.com

              1 Reply Last reply Reply Quote 0
              • R Offline
                REGIS
                last edited by

                Hi

                Just an idea but I'm not sure it's that you want.
                When I open my terminal and turn on irb, If I type 6**2 and return, I get 36.

                cheers.

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  Good idea, but doesn't work in DC's. 6**2 just returns 12.

                  Chris

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    REGIS
                    last edited by

                    😢
                    A ruby plugin who doesn't understand ruby language 👍

                    cheers

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      stillife
                      last edited by

                      I'm really sorry to revive this old post, but I'm wondering if the ^ operator has been implimented yet. I've tried to use it using the latest sketchup update (7.1.6087) and it seems to still be missing. It would be nice if Google created a quick fix or patch for this, since it is a very useful operator right next to the four basic operators (+-*/).

                      Thanks in advance for your help.

                      Still

                      1 Reply Last reply Reply Quote 0
                      • Chris FullmerC Offline
                        Chris Fullmer
                        last edited by

                        It has not been implemented yet. I'm sure they've forgotten about it 😞

                        Chris

                        Lately you've been tan, suspicious for the winter.
                        All my Plugins I've written

                        1 Reply Last reply Reply Quote 0
                        • scottliningerS Offline
                          scottlininger
                          last edited by

                          Hey guys,

                          We haven't forgotten about this. It's a surprisingly non trivial thing to fix. The actual coding is easy, but then we're introducing a new "version" of DCs that won't work on older Sketchup installs. Your DC that uses ^ would work great in SU 7.1, for example, but not work in 7.0.

                          If your reply to that is "who cares! people can get a free upgrade!", then let me know and I'll add that to the feature request. In general, we lean toward backwards compatibility.

                          Cheers,

                          • Scott Lininger
                            SketchUp Software Engineer
                            Have you visited the Ruby API Docs?
                          1 Reply Last reply Reply Quote 0
                          • thomthomT Offline
                            thomthom
                            last edited by

                            who cares! people can get a free upgrade! 😄

                            Thomas Thomassen — SketchUp Monkey & Coding addict
                            List of my plugins and link to the CookieWare fund

                            1 Reply Last reply Reply Quote 0
                            • plot-parisP Offline
                              plot-paris
                              last edited by

                              uuuh. tricky one. never would have thought about that. but its true, compatibility is a good thing.
                              although its probably more important for SU 7.1 to read a SU 7 DC properly than for SU 7 to read a SU 7.1 DC properly...

                              therefore in that particular case, I, too, would say: "who cares! people can get a free upgrade!" 😉

                              1 Reply Last reply Reply Quote 0
                              • Chris FullmerC Offline
                                Chris Fullmer
                                last edited by

                                +1

                                I'd hate to think that the feature never gets added just to try and keep backwards compatibility. By time we get to verion 10, I think people will be more upset if DC's haven't been improved since v7.0 than if they don't have great backwards compatibility.

                                Chris

                                Lately you've been tan, suspicious for the winter.
                                All my Plugins I've written

                                1 Reply Last reply Reply Quote 0
                                • 1 / 1
                                • First post
                                  Last post
                                Buy SketchPlus
                                Buy SUbD
                                Buy WrapR
                                Buy eBook
                                Buy Modelur
                                Buy Vertex Tools
                                Buy SketchCuisine
                                Buy FormFonts

                                Advertisement