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

    Layer Material

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

      OK thanks. So I'm not going mad!

      Adam

      Developer of LightUp Click for website

      1 條回覆 最後回覆 回覆 引用 0
      • AdamBA 離線
        AdamB
        最後由 編輯

        Just a little update.

        I've written an extension to extract the Layer material by adding an extra method to class Layer. Works great.

        The interesting thing is that the Layer Materials all have names too (starting with "Layer_") but they're invisible to the Ruby material list so I can't return a reference to the Ruby material. I have to return the color and/or texture.

        When I get a mo, I'll package it up and post it.

        Adam

        Developer of LightUp Click for website

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

          @adamb said:

          When I get a mo, I'll package it up and post it.

          Excellent!

          But I'm very curious to where to got the info from. the SDK?

          But how would different plugins wanting to implement this handle this? multiple plugins extending the layer class?

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

          1 條回覆 最後回覆 回覆 引用 0
          • AdamBA 離線
            AdamB
            最後由 編輯

            @thomthom said:

            But how would different plugins wanting to implement this handle this? multiple plugins extending the layer class?

            So I'm simply going to conditionally add some methods if they're not already there. Because I can't return the material in any useful way, I'll collapse the method calling sequence into 1 name. So:

            Sketchup.active_model.active_layer.material_color

            Sketchup.active_model.active_layer.material_texture

            Adam

            Developer of LightUp Click for website

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

              My layer-color=.rb used a convoluted work around to import a dxf with a new layer of the same name etc colored as required and the old layer deleted. It only copes with color NOT material.
              You could work this in reverse - export a dxf of a series of faces, each on a layer; then parse the dxf to find each layer and it's color - using a lookup-table you can at least then convert the colors to RGB values - you won't easily get any textures or the material's alpha though ???
              It shouldn't be that difficult to simply have a method layer.material or layer.material="red" !!! 😢

              TIG

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

                And what does the methods return? array of colour values? and for the texture?
                And is there a way to set the material?

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

                1 條回覆 最後回覆 回覆 引用 0
                • AdamBA 離線
                  AdamB
                  最後由 編輯

                  If thats what Sir wants. 😄

                  Developer of LightUp Click for website

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

                    neat'o!
                    Can I have fries with that?

                    So, is the voodoo you're using also able to rename materials? (instead of the current workaround of recreating the material with a new one with the new name and replace the material property for all entities in the model?)

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

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

                      What became of this great idea ???

                      TIG

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

                        @tig said:

                        What became of this great idea ???

                        Dittos!

                        Never saw this 3 year old thread.

                        Spent a while yesterday posting a request for this in the API Wishlist forum.
                        Did I cover everything? Any feature I left out?
                        http://forums.sketchucation.com/viewtopic.php?f=180&t=13666&p=253272

                        I'm not here much anymore.

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

                          bump ?

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

                          1 條回覆 最後回覆 回覆 引用 0
                          • AdamBA 離線
                            AdamB
                            最後由 編輯

                            Had another look at this, this morning.

                            There doesn't seem to be any way of setting the Layer properties, the COM API just doesn't offer that functionality.

                            Adam

                            Developer of LightUp Click for website

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

                              😞

                              But one can get?

                              The COM API - is it the SkpReader in the SDK?

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

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

                                re-bump

                                TIG

                                1 條回覆 最後回覆 回覆 引用 0
                                • jiminy-billy-bobJ 離線
                                  jiminy-billy-bob
                                  最後由 編輯

                                  So Adam never published this ?
                                  So sad 😞

                                  25% off Skatter for SketchUcation Premium Members

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • AdamBA 離線
                                    AdamB
                                    最後由 編輯

                                    I'm sitting in Provence and it is pissing down! So I pulled the code from the UK and it looks fine (don't even have to build for PowerPC anymore!) - I'll package it up for Mac and Windows next week.

                                    Adam

                                    Developer of LightUp Click for website

                                    1 條回覆 最後回覆 回覆 引用 0
                                    • jiminy-billy-bobJ 離線
                                      jiminy-billy-bob
                                      最後由 編輯

                                      @adamb said:

                                      So I pulled the code from the UK and it looks fine (don't even have to build for PowerPC anymore!) - I'll package it up for Mac and Windows next week.

                                      😍 Great News ! Thanks a lot !

                                      @adamb said:

                                      I'm sitting in Provence and it is pissing down!

                                      Too bad, the sun is shining here in Normandie 😄

                                      25% off Skatter for SketchUcation Premium Members

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

                                        @adamb said:

                                        I'm sitting in Provence and it is pissing down! So I pulled the code from the UK and it looks fine (don't even have to build for PowerPC anymore!) - I'll package it up for Mac and Windows next week.

                                        🎉 🎉

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

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

                                          @adamb said:

                                          I'm sitting in Provence and it is pissing down! So I pulled the code from the UK and it looks fine (don't even have to build for PowerPC anymore!) - I'll package it up for Mac and Windows next week.

                                          Will it be just the binaries or is there any chance we can see the source - making for a nice small tutorial? ...even though the old C++ SDK is deprecated...

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

                                          1 條回覆 最後回覆 回覆 引用 0
                                          • jiminy-billy-bobJ 離線
                                            jiminy-billy-bob
                                            最後由 編輯

                                            Up ?

                                            25% off Skatter for SketchUcation Premium Members

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

                                            Advertisement