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!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    SketchUp RUBY API Wishlist [way of coding wishes, please]

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

      Being able to set Layer colour.

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

      1 條回覆 最後回覆 回覆 引用 0
      • thomthomT 離線
        thomthom
        最後由 編輯

        • Being able to set Material name.
        • Being able to delete materials.
        • Being able to delete ComponentDefinitions

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

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

          You can delete a definition's instances and then that individual definition from the component-browser thus:

          model.start_operation("Delete Instances and Definition")
            definition.instances.each{|instance|instance.erase! if instance.valid?}
            # this 1st step is optional since all instance become nil anyway when the definition is emptied
            definition.entities.erase_entities(definition.entities.to_a)
          model.commit_operation
          

          Assumes you have set model and definition... It empties a definition and therefore it disappears off the browser listing. It must be inside an operation to work.

          PS: You can delete a material BUT it's pretty convoluted. I'll publish a script for it shortly...

          TIG

          1 條回覆 最後回覆 回覆 引用 0
          • thomthomT 離線
            thomthom
            最後由 編輯

            I've not had 100% success with deleting definitions like that. I seemed to run into bugsplats. But I'll do new tests.

            As for materials, I seen how V-Ray for Sketchup renames and deletes materials:
            Deleting: iterate the whole model and remove the material - then apply unused materials to dummy groups and purge.

            Rename: Create new material identical to old with new name - iterate and replace the old material with new. Then run the Delete method.

            Ugly hacks which I'd rather not use. When model grows in size this just bogs down.

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

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

              I've also made the equivalent layer.delete method here http://forums.sketchucation.com/viewtopic.php?p=166985#p166985 ...

              TIG

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

                http://forums.sketchucation.com/viewtopic.php?p=166978#p166978 has material.delete method - I've streamlined it as much as possible ???

                TIG

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

                  I've also made a material.name="new_name" method here http://forums.sketchucation.com/viewtopic.php?p=167219#p167219 ...

                  TIG

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

                    material.name="new_name" method now v1.1 - here http://forums.sketchucation.com/viewtopic.php?p=167219#p167219
                    Temp folder fixed for Mac users...

                    TIG

                    1 條回覆 最後回覆 回覆 引用 0
                    • N 離線
                      narongwit12
                      最後由 編輯

                      Be able to track the shadow area on each face. This could make the calculation of shading possible for energy simulation.

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

                        • to have the 5th (optional) argument for write_image as 'Transparent Background' if the file type is .png

                        1 條回覆 最後回覆 回覆 引用 0
                        • Dan RathbunD 離線
                          Dan Rathbun
                          最後由 編輯

                          Sketchup::load

                          The Sketchup::load method does NOT expose the wrap argument, so we can specify wrap=true for rbs scripts.

                          For some unknown reason, the Google team defeated, or just didn't pass the 2nd argument (wrap) on to the aliased standard load, when they overrode it to handle rbs decrypting.

                          Please fix this!
                          _

                          I'm not here much anymore.

                          1 條回覆 最後回覆 回覆 引用 0
                          • P 離線
                            Pout
                            最後由 編輯

                            Here is my list:

                            • Tig, although your solutions on material.name=, layer.delete, material.delete are good, it seems to me it would be much easier to just have them in the API. So i second the proposals of ThomThom

                            • Also i second the proposal of Morisdov concerning the add_framechange_observer not firing when creating movies or when working in layout. It should fire there to.

                            • make the entity.id consistent throughout different SU sessions (it changes now from time to time)

                            • it would be great if you could just select an entity based on a parameter (eg. entity.id) without looping all the entities in the model

                            • being able to access the font/size and other parameters of a text

                            • make a difference between the execution of scripts and the interface so it is possible to incorporate a 'stop script' button for example. Now the interface freezes as long as scripts are running. This makes users believe the execution of the script has halted and Sketchup has stopped working.

                            • ...more to come

                            1 條回覆 最後回覆 回覆 引用 0
                            • thomthomT 離線
                              thomthom
                              最後由 編輯

                              @pout said:

                              • Tig, although your solutions on material.name=, layer.delete, material.delete are good, it seems to me it would be much easier to just have them in the API.

                              And it would be faster.

                              @pout said:

                              • make the entity.id consistent throughout different SU sessions (it changes now from time to time)

                              Ditto!

                              @pout said:

                              • it would be great if you could just select an entity based on a parameter (eg. entity.id) without looping all the entities in the model

                              Ditto. If you have a script that requires observers attached to some objects one want these to be reattached when the model is loaded. Currently one has to iterate the whole model to find the entities, and one has to attach an attribute to be able to find the correct one - which means string comparisons which are really slow.
                              So a better way to directly reference entities across sessions would be a great addition.

                              @pout said:

                              • make a difference between the execution of scripts and the interface so it is possible to incorporate a 'stop script' button for example. Now the interface freezes as long as scripts are running. This makes users believe the execution of the script has halted and Sketchup has stopped working.

                              while true puts 'Ditto!' end

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

                              1 條回覆 最後回覆 回覆 引用 0
                              • P 離線
                                Pout
                                最後由 編輯

                                does anyone know if any of the remarks here will be taken into consideration in a new version?

                                1 條回覆 最後回覆 回覆 引用 0
                                • Dan RathbunD 離線
                                  Dan Rathbun
                                  最後由 編輯

                                  @dan rathbun said:

                                  Sketchup::load

                                  The Sketchup::load method does NOT expose the wrap argument, so we can specify wrap=true for rbs scripts.

                                  For some unknown reason, the Google team defeated, or just didn't pass the 2nd argument (wrap) on to the aliased standard load, when they overrode it to handle rbs decrypting.

                                  Please fix this!_

                                  Taking this a step further.

                                  Since the rbs code blocks are eval'd, and Sketchup.load is an override (redefinition,) just pass the 2nd argument to Sketchup.load (if given,) on as the 2nd argument to the eval method.

                                  That way developers can instantiate a binding() to their custom namespace(s), and have the code evaluated within that scope.

                                  This can also give the GSUT the opportunity to protect some Google namespaces, within the argument validation block of the Sketchup.load method (ie: raise a custom "NotAllowedError" exception.)

                                  I'm not here much anymore.

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • Dan RathbunD 離線
                                    Dan Rathbun
                                    最後由 編輯


                                    EDITED:Get||Set Layer Material & Color


                                    Added missing "wish" statement to set Layer color in the example I gave (the last statement.)


                                    I'm not here much anymore.

                                    1 條回覆 最後回覆 回覆 引用 0
                                    • Dan RathbunD 離線
                                      Dan Rathbun
                                      最後由 編輯

                                      @thomthom said:

                                      Being able to set Layer colour.

                                      ..and also a "getter" method to read the color.

                                      Actually when you manually click the color button in the Layers dialog, the Edit Material dialog appears. If you choose 'Use texture image' and assign a texture file, the layer will be displayed with that texture over the layer color, when 'Color by Layer' is true, and rendering mode is 'Shaded with Textues'.

                                      Issues:
                                      (1) Technically, Layers have a material attribute that holds a Sketchup::Material object.
                                      (2) These material objects ARE saved with the model, but NOT accessible thru the API.
                                      (3) When a layer is assigned a texture, it does not appear in the "In Model" Materials Collection, and it shouldas well as allow us to assign a name (thru the layer's material object.)
                                      In the UI manual mode the new material could be given a temporary name equal to the Layer name, so the user could manually rename it thru the Materials Browser, or we could name it in a subsequent ruby statment like:
                                      model.materials['Layer3'].name='PolishedWood'
                                      We should also then be able to go totally automatic thru the API, thus:
                                      mat = model.materials.add('PolishedWood') mat.texture = 'wood/polished.png' mat.color = [195,144,86] model.layers['Layer3'].name = 'Surface' model.layers['Surface'].material = 'PolishedWood' model.rendering_options['DisplayColorByLayer'] = true
                                      Later on getting a layer's color, we could do:
                                      surfaceColor = model.layers['Surface'].material.color
                                      and setting it to some other color:
                                      surfaceColor = [127,127,200] model.layers['Surface'].material.color = surfaceColor [*]

                                      ****** So what we really need is the Sketchup::Layer object's material attribute getter and setter methods exposed in the API, along with the manual UI naming hack.


                                      EDIT: [* (2010AUG05) Added missing "wish" statement to set layer color.]

                                      I'm not here much anymore.

                                      1 條回覆 最後回覆 回覆 引用 0
                                      • K 離線
                                        kwalkerman
                                        最後由 編輯

                                        Seconded on the Layers usability, also, it would be great to be able to do:

                                        Layers.active_layer
                                        Layers[layer] = active

                                        A consistent entityID would be awesome. The entity should maintain the ID if it is deleted, and then undeleted as well.

                                        Pages:

                                        In addition to retaining information on which layers are on and off, should also be able to retain the active layer for each page.

                                        --
                                        Karen

                                        1 條回覆 最後回覆 回覆 引用 0
                                        • thomthomT 離線
                                          thomthom
                                          最後由 編輯

                                          hm... never thought of that inconsistency before...
                                          model.materials.current vs model.active_layer

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

                                          1 條回覆 最後回覆 回覆 引用 0
                                          • Dan RathbunD 離線
                                            Dan Rathbun
                                            最後由 編輯

                                            @thomthom said:

                                            hm... never thought of that inconsistency before...
                                            model.materials.current vs model.active_layer

                                            "current and "active" should aliases for each other.

                                            I'm not here much anymore.

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

                                            Advertisement