sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🔌 Smart Spline | Fluid way to handle splines for furniture design and complex structures. Download

    How do you make plug-ins for sketchup

    已排程 已置頂 已鎖定 已移動 Developers' Forum
    103 貼文 25 Posters 11.6k 瀏覽 25 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Chris FullmerC 離線
      Chris Fullmer
      最後由 編輯

      You looked in both your plugins folders? It also might be in the tools folder.

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

      1 條回覆 最後回覆 回覆 引用 0
      • jeff hammondJ 離線
        jeff hammond
        最後由 編輯

        it's in there BTM

        utilitiestools.rb is the file name.. inside a folder called utilites which is in the plugins folder.

        when i get some more time, i'll show you a neat little finder trick to search for anything (unless of course you already know this and the file really isn't there)

        dotdotdot

        1 條回覆 最後回覆 回覆 引用 0
        • B 離線
          BTM
          最後由 編輯

          Ah, found it. I whent right over the utilities folder, and never noticed it 😆

          1 條回覆 最後回覆 回覆 引用 0
          • jeff hammondJ 離線
            jeff hammond
            最後由 編輯

            a couple examples of using the finder to find things.. it doesn't really fit in this thread but it does show a few things i might use if learning ruby..

            first, i try to search for perpendicular_face .. a standard search doesn't show anything but you'll notice i go into my search field and allow for a system search which will look at Macintosh HD... if you check the box then that search field will always remain in the menu (though you still have to use the + then include) .. on top of that, there are all sort of weird things you can search for -- lens aperture, song tempo, used dates etc.. as a side note, system search will also include web history so i can use this to easily find things from web pages i've been to..

            after the perpendicular_face example, i do a search for a piece of code (Geom::Vector3d).. you'll notice that it searches inside the files as well and you can select either 'file name' or 'content' .. if i open a file that showed up in the search, i can commandF and the search item is transferred to the apps search field.. makes it easy to find what i'm looking for in the exact location of the file..

            after that, i use coverflow on the results (i fit the window to my monitor for this so you can't see everything i'm doing.. just trying to show that i can look at all the rubies full size without actually opening them in an editor)..

            mess around with it.. note you can add multiple criteria to narrow the search.. also note you can mix up your searches (for instance, i found the query tool by typing 'query tool sketchup' and utilitestools.rb show up even though that exact wording doesn't appear in the text..
            hope this helps.. (and i hope the youtube compression doesn't make this too impossible to understand 😄 )

            [flash=700,420:2yjy0fg6]http://www.youtube.com/v/iM2qMaAvNpQ&hl=en&fs=1&rel=0&color1=0x006699&color2=0x54abd6&border=1[/flash:2yjy0fg6]

            dotdotdot

            1 條回覆 最後回覆 回覆 引用 0
            • R 離線
              remus
              最後由 編輯

              A little script to draw the crudest catenary curve you've ever seen 👍

              require "sketchup.rb"
              
              def y (xpos)
              
              sag = 2
              x=xpos
              
              (Math.cosh ((x/sag)))*sag
              
              end
              
              def cat_curve
              
              model = Sketchup.active_model
              entities = model.entities
              
              pt1 = [10,0,(y (10))]
              pt2 = [(20/3),0,(y ((20/3)))]
              pt3 = [(10/3),0,(y ((10/3)))]
              pt4 = [0,0,(y (0))]
              pt5 = [(-10/3),0,(y ((-10/3)))]
              pt6 = [(-20/3),0,(y ((-20/3)))]
              pt7 = [-10,0,(y (-10))]
              
              points = [pt1,pt2,pt3,pt4,pt5,pt6,pt7]
              
              catcurve = entities.add_curve (points)
              
              end
              
              UI.menu("PlugIns").add_item("Catenary Curve") {
                
                cat_curve
              }
              
              

              http://remusrendering.wordpress.com/

              1 條回覆 最後回覆 回覆 引用 0
              • TIGT 離線
                TIG Moderator
                最後由 編輯

                @chris fullmer said:

                Jim, I'm a little confused. I thought you would be able to add a curve object to the selection set. But it returns this error:

                (eval);6;in ‘add’; wrong argument type (expected Sketchup;;Entity or Array of Sketchup;;Entity)
                

                But the API says that "Curve" is a subclass of the Entity class, just like DrawingElement. Why can't I add a curve object directly to the selection?
                Chris

                To test if a given edge is part of a curve and then add all of those to the selection use something like

                selection.add(e.curve.edges) if e.typename=="Edge" and e.curve
                

                assuming you have pre-defined some of those variables !
                To add all of a given curve's edges to a selection use something like

                ### assuming crv is known to be a 'curve'
                selection.add(crv.edges)
                

                edge.curve returns either a Curve or ArcCurve object curve or arc/circle, and edge.curve.edges returns all of the 'curve's' edges... Matt's recent 'real_typename' Ruby adds an extra method to DrawingElement Edge to return Curve, Arc or Circle for those types - otherwise 'normal' typename...
                It might be a useful tester ?

                TIG

                1 條回覆 最後回覆 回覆 引用 0
                • Chris FullmerC 離線
                  Chris Fullmer
                  最後由 編輯

                  Remus, that is in fact the crudest catenary curve I've ever seen! 😄 Good job.

                  @TIG - sure we can test an edge to see if its part of a curve. I'm specifically asking why you can't add a curveobjec to a selection. If you try, it returns that error I posted, stating it is expecting an Entity class object. But a curve is a subclass of Entity. So its error does not seem to be telling the truth or something. Does that mean they have specifically blocked the ability to add curve's and arccurves? OR did they really mean that it is expecting a DrawingElement?

                  Chris

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

                  1 條回覆 最後回覆 回覆 引用 0
                  • Chris FullmerC 離線
                    Chris Fullmer
                    最後由 編輯

                    Anyone have anything new to post about their Ruby scripts?!

                    I DO!

                    I made a tutorial for how to begin writing Ruby scripts. Its short and fast, but I tried to explain what software to install, what websites to go to for help, and then I go over a basic script that iterates over all the entities in a model and sorts the edges, faces, componentInstances, and groups into arrays and displays how many of each there are in a model. And of course, I give a few suggestions about what to do with those arrays once you have them.

                    But hopefully the next tutorial will go over how to actually do things with an array of faces, or edges, etc. But I felt like the first tutorial just needed to explain what to do to get ready to start writing code.

                    Check it out (though if you've followed this thread from start to finish, there won't be too much new infomration). But its a good, quick, read.

                    Link Preview Image
                    SketchUcation

                    3D SketchUp Community for Design and Engineering Professionals.

                    favicon

                    (www.sketchucation.com)

                    Chris

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

                    1 條回覆 最後回覆 回覆 引用 0
                    • L 離線
                      l.frisken
                      最後由 編輯

                      thanks chris! This will be perfect I imagine! 👍 😍

                      1 條回覆 最後回覆 回覆 引用 0
                      • T 離線
                        TANER TAN
                        最後由 編輯

                        @jeff hammond said:

                        @unknownuser said:

                        How do you make plug-ins for sketchup

                        me?
                        by begging 😎

                        I do not know, but maybe this can help you:
                        http://www.alexschreyer.net/projects/sketchup-ruby-code-editor/

                        1 條回覆 最後回覆 回覆 引用 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 5
                        • 6
                        • 1 / 6
                        • 第一個貼文
                          最後的貼文
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement