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

    [Plugin] Material_Maintenance v2.2 - 2013-01-13

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

      @myhand said:

      ... CMD, if I add some debug code to the script would you mind running it and sending me the output?

      No problem 😄

      CMD

      • CMD
      1 條回覆 最後回覆 回覆 引用 0
      • M 離線
        Myhand
        最後由 編輯

        @cmd said:

        @myhand said:

        ... CMD, if I add some debug code to the script would you mind running it and sending me the output?

        No problem 😄

        CMD

        Hi CMD,

        here is the file

        Debug version

        You can replace the Material_Maintenance.rb file in your ../Plugins/Material_Maintenance folder, restart sketchup, open the console window and launch the plugin. The script will output some debug to the console. Can you send me the whole console output please.

        Cheers,

        myhand

        http://www.keepingmyhandin.com/

        1 條回覆 最後回覆 回覆 引用 0
        • cmdC 離線
          cmd
          最後由 編輯

          Here is the output from the ruby console after replacing with your posted Material_Maintenance.rb and launching the tool.

          CMD


          ruby console output.txt

          • CMD
          1 條回覆 最後回覆 回覆 引用 0
          • J 離線
            Jim
            最後由 編輯

            You may need to move the method definition of fromUIHandler to after the definition of refreshMaterials. Ruby might be trying to call refreshMaterials

              ` results = self.send(targetFunction.to_sym, *params)`
            

            before it is defined.

            I sent a PM.

            Hi

            1 條回覆 最後回覆 回覆 引用 0
            • M 離線
              Myhand
              最後由 編輯

              @cmd said:

              Here is the output from the ruby console after replacing with your posted Material_Maintenance.rb and launching the tool.

              CMD

              Thanks CMD.

              Unfortunately the attached output implies that the debug version of the Material_Maintenance.rb script did not run but rather the old version.

              the error says:

              
              Error; #<NoMethodError; undefined method `refreshMaterials' for #<MH_KeepingMyHandIn;;MaterialMaintenance;0x1383e920>>
              /Library/Application Support/Google SketchUp 8/SketchUp/Plugins/Material_Maintenance/Material_Maintenance.rb;106;in `send'
              
              

              and indicates the send method call is on line 106, while it is actually on line 122 in the debug version.

              Have you restarted Sketchup after copying the new file in?

              A few ways to check that the debug script is running are:

              • You should see this message in the console: "calling function >>refreshMaterials<<"; There might also be the same message but with other function names
              • The the above error appears again, it should be on line 122 not line 106.

              Cheers,

              myhand

              http://www.keepingmyhandin.com/

              1 條回覆 最後回覆 回覆 引用 0
              • cmdC 離線
                cmd
                最後由 編輯

                sorry about that.

                Unfortunately, here is what I get with your debug .rb


                Screen Shot 2012-11-29 at 3.26.15 PM.png

                • CMD
                1 條回覆 最後回覆 回覆 引用 0
                • D 離線
                  driven
                  最後由 編輯

                  I get this with ruby 1.8.5 or ruby 1.8.7

                  Error: #<NoMethodError: undefined methodto_sym' for nil:NilClass>
                  /Users/johns_iMac/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/Material_Maintenance/Material_Maintenance.rb:106:in fromUIHandler' /Users/johns_iMac/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/Material_Maintenance/Material_Maintenance.rb:66:in initialise'
                  /Users/johns_iMac/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/Material_Maintenance/Material_Maintenance.rb:106:in call' /Users/johns_iMac/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/Material_Maintenance/Material_Maintenance.rb:106
                  john

                  learn from the mistakes of others, you may not live long enough to make them all yourself...

                  1 條回覆 最後回覆 回覆 引用 0
                  • cmdC 離線
                    cmd
                    最後由 編輯

                    Myhand,

                    Sorry.. I replaced the wrong file. Here is what I get in the Ruby console with your debug script after I launch the tool.

                    @unknownuser said:

                    calling function >>refreshMaterialsÂ<<
                    !!!!! - IN refreshMaterials !!!!!
                    String Time = 3.0e-06
                    Total Entities = 0

                    I hope this helps

                    CMD

                    • CMD
                    1 條回覆 最後回覆 回覆 引用 0
                    • D 離線
                      driven
                      最後由 編輯

                      @CMD

                      @unknownuser said:

                      calling function >>refreshMaterialsÂ<<

                      what version of ruby are you running?

                      I only see that encoded  if I run 1.8.7 on the original file...

                      I was actually wondering if it was an encoding issue as the script is not UFT8 out of the box. and uses chars that maybe misrepresented on macs
                      john

                      learn from the mistakes of others, you may not live long enough to make them all yourself...

                      1 條回覆 最後回覆 回覆 引用 0
                      • M 離線
                        Myhand
                        最後由 編輯

                        @cmd said:

                        Myhand,

                        Sorry.. I replaced the wrong file. Here is what I get in the Ruby console with your debug script after I launch the tool.

                        @unknownuser said:

                        calling function >>refreshMaterialsÂ<<
                        !!!!! - IN refreshMaterials !!!!!
                        String Time = 3.0e-06
                        Total Entities = 0

                        I hope this helps

                        CMD

                        Excellent this helps a lot. It tells us that somewhere the function name gets corrupted between where it is hardcoded in the javascript to where it enters the Ruby environment.

                        Was that the whole output? Were there no other lines following the below patterns? I would have expected at least one more set, probably before the above lines.

                        calling function >>xxxx<<
                        !!!!! - IN xxxx !!!!!

                        Where xxxx is any name.

                        I suspect driven might be correct. Let me give this some thought.

                        http://www.keepingmyhandin.com/

                        1 條回覆 最後回覆 回覆 引用 0
                        • Mistro11M 離線
                          Mistro11
                          最後由 編輯

                          I'm having such a great month upgrading my Sketchup! Artisan, SketchUV, ProfileBuilder Pro, 1001Bits, and now this VERY useful plugin.

                          Managing materials was always a major headache for me, especially when building multi-story houses with downloaded furniture. I tend to forget the fact that the downloaded furniture may have some of the same materials I assigned to what I already have in the model. I once waited for a long KT render to find out the pillows on one of the beds were made of chrome. This looks like it will save me a lot of material scanning time before export.

                          Your first Ruby is a shiner 😎

                          i7-4930k @3.4/3.7GHz, 32Gb RAM, NVidia GTX 980Ti 6Gb, Windows 7 Pro 64bit
                          Structural Integrity is Not Just Physical...It's in the Design and Purpose

                          1 條回覆 最後回覆 回覆 引用 0
                          • M 離線
                            Myhand
                            最後由 編輯

                            CMD, here is the next iteration of the debug script. It might fix the problem as I have changed the way I specify the special characters I use from literals to providing the actual character codes. Even though they are special they are extended ascii so should work fine. As the .js file is UTF8 encoded I have not changed how I specify the chars there yet, but again it might just work.

                            Either way I have also added extra trace code, so if it does not work it will give us further info to help pin down the problem.

                            Do you mind trying it out and sending me the output again? Same procedure as before, just replace the .rb file with the attached version.

                            Debug version

                            http://www.keepingmyhandin.com/

                            1 條回覆 最後回覆 回覆 引用 0
                            • M 離線
                              Myhand
                              最後由 編輯

                              @mistro11 said:

                              I'm having such a great month upgrading my Sketchup! Artisan, SketchUV, ProfileBuilder Pro, 1001Bits, and now this VERY useful plugin.

                              Managing materials was always a major headache for me, especially when building multi-story houses with downloaded furniture. I tend to forget the fact that the downloaded furniture may have some of the same materials I assigned to what I already have in the model. I once waited for a long KT render to find out the pillows on one of the beds were made of chrome. This looks like it will save me a lot of material scanning time before export.

                              Your first Ruby is a shiner 😎

                              Thanks Mistro11! 😄

                              http://www.keepingmyhandin.com/

                              1 條回覆 最後回覆 回覆 引用 0
                              • D 離線
                                driven
                                最後由 編輯

                                !!!=> fromUIHandler: parameter string = 73-0¶__vz¶refreshMaterials¶true¶false¶false p1 = >>73-0Â<< p1 = >>__vzÂ<< p1 = >>refreshMaterialsÂ<< p1 = >>trueÂ<< p1 = >>falseÂ<< p1 = >>false<< calling function >>refreshMaterialsÂ<< Error: #<NoMethodError: undefined methodrefreshMaterials' for #<MH_KeepingMyHandIn::MaterialMaintenance:0x11f904b4>>
                                /Users/johns_iMac/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/Material_Maintenance/Material_Maintenance.rb:122:in send' /Users/johns_iMac/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/Material_Maintenance/Material_Maintenance.rb:122:in fromUIHandler'
                                /Users/johns_iMac/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/Material_Maintenance/Material_Maintenance.rb:69:in initialise'

                                learn from the mistakes of others, you may not live long enough to make them all yourself...

                                1 條回覆 最後回覆 回覆 引用 0
                                • D 離線
                                  driven
                                  最後由 編輯

                                  ` > 183.chr
                                  ·

                                  182.chr
                                  ¶`
                                  they are not the same as the original chars, I was seeing in my script editor, and the script is now saying it's encoded uft8, which it wasn't
                                  john

                                  learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                                    You are returning a string divided up with some unique character.
                                    You then parse that string into bits, splitting it with that character.
                                    Unfortunately that character seems not to be a simple 1 bit ASCII character when passed over, so the split ends with the weird extra character that's left over at the end.
                                    This causes the issue.
                                    MAC and PC Ruby are different in the way they handle text-encoding...
                                    Are your various files encoded as ' UTF-8 without BOM' ?
                                    If you have Notepad++ it's a simple setting.
                                    This makes files 'cross-platform' [hopefully!].
                                    AND/or can you use a less 'exotic' dividing character - perhaps '|' ?

                                    TIG

                                    1 條回覆 最後回覆 回覆 引用 0
                                    • M 離線
                                      Myhand
                                      最後由 編輯

                                      @tig said:

                                      You are returning a string divided up with some unique character.
                                      You then parse that string into bits, splitting it with that character.
                                      Unfortunately that character seems not to be a simple 1 bit ASCII character when passed over, so the split ends with the weird extra character that's left over at the end.
                                      This causes the issue.
                                      MAC and PC Ruby are different in the way they handle text-encoding...
                                      Are your various files encoded as ' UTF-8 without BOM' ?
                                      If you have Notepad++ it's a simple setting.
                                      This makes files 'cross-platform' [hopefully!].
                                      AND/or can you use a less 'exotic' dividing character - perhaps '|' ?

                                      TIG, I think your description is spot-on. I have now encoded the attached version of the file with UTF-8 without BOM (yes I use Notepad++ 😄) The JS file is already was already encoded in the that format.

                                      I would not have thought that the ruby file encoding should make a difference anymore as I am now explicitly setting the character codes (which are in the ascii range) I suspect JS is passing the character in as UTF-8. The reason for the exotic chars is that Sketchup does not seem to constrain chars users can enter in material names so in theory you can get conflict in the lower ascii range.

                                      I should probably write the simple JSON parser to complement my simple JSON serializer and get rid of the current char token approach in my bridge.

                                      driven, cmd, can you test again please?

                                      Debug version

                                      http://www.keepingmyhandin.com/

                                      1 條回覆 最後回覆 回覆 引用 0
                                      • M 離線
                                        Myhand
                                        最後由 編輯

                                        @driven said:

                                        ` > 183.chr
                                        ·

                                        182.chr
                                        ¶`
                                        they are not the same as the original chars, I was seeing in my script editor, and the script is now saying it's encoded uft8, which it wasn't
                                        john

                                        Hi John, these are the actual char codes, I have not changed the JS side and these codes still work for me on windows.

                                        I will now also change them in JS to explicit ASCII values. Unfortunately I have to repackage the whole plugin then, so will take me a bit of time, but then again it is likely to work.

                                        http://www.keepingmyhandin.com/

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

                                          SketchUp return strings in UTF-8. Anything above the ASCII character range will be multi-byte characters - which is easily mangled by Ruby 1.8's string manipulation methods as it treats 'characters' as single bytes.

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

                                          1 條回覆 最後回覆 回覆 引用 0
                                          • M 離線
                                            Myhand
                                            最後由 編輯

                                            @thomthom said:

                                            SketchUp return strings in UTF-8. Anything above the ASCII character range will be multi-byte characters - which is easily mangled by Ruby 1.8's string manipulation methods as it treats 'characters' as single bytes.

                                            But my characters are well within the ASCII range...? i.e. they still fit within a byte. from which value does it convert them to multi byte?

                                            http://www.keepingmyhandin.com/

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

                                            Advertisement