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

    Scrambler issue

    Scheduled Pinned Locked Moved Developers' Forum
    31 Posts 3 Posters 4.0k Views 3 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.
    • WhyDiW Offline
      WhyDi
      last edited by

      Your version is near mine. Does it come from Trimble or Google? Google I think.
      I use Sketchup::require, not Sketchup.require
      I haven't submitted the crash yet and don't think I do. It looks so strange!

      Edit...
      from your code i modified this way the main file

      
      require 'sketchup.rb'
      Sketchup;;require "C;/Users/uName/SketchUp/Ruby/testSC"
      module Cie_qwerty
      	module Ext_azerty
      		puts "------------------------------------------start"
      		print_test()
      		puts "------------------------------------------ready"
      
      	end
      end
      
      

      This time it works!
      Sketchup::require or Sketchup.require doesn't matter
      keepgoing tests...

      Here are the files not modified


      test.zip

      the devil is in the detail

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        @whydi said:

        Your version is near mine. Does it come from Trimble or Google? Google I think.
        I use Sketchup::require, not Sketchup.require
        I haven't submitted the crash yet and don't think I do. It looks so strange!

        Here are the files

        I did not see a crash when loading your files.
        But I did get a load error, you where still having the Sketchup::require statement within your module:
        2016-02-24_16h03_12.png

        Move it to the global namespace, like so:
        2016-02-24_16h03_24.png

        Then it loads fine.

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

        1 Reply Last reply Reply Quote 0
        • WhyDiW Offline
          WhyDi
          last edited by

          I edited my previous post with result after reading your code. It works!

          Sketchup::require needs to appear before any module.

          I go ahead testing line length...

          the devil is in the detail

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            @whydi said:

            Sketchup::require needs to appear before any module.

            At least in SketchUp versions earlier than SU2014. From then on it was fixed.

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

            1 Reply Last reply Reply Quote 0
            • WhyDiW Offline
              WhyDi
              last edited by

              I found information about line length here
              https://groups.google.com/forum/#!topic/sketchupruby/EV5KDgh6C0M
              where ChuckVali in the last post wrote :

              @unknownuser said:

              ...I noticed something else about the scrambler. If there are more than around 1000 characters in any line the resulting .rbs file can't be read by SU. Not a problem though: I just use shorter lines and concat them...

              the longest line in our script is over 1500 chars and I won't be able to cut these lines under 503 chars due to if statement with and and and and and so forth.
              Are 512 chars OK?

              in the same thread I read something that I don't clearly understand. Jim wrote :

              @unknownuser said:

              ...This may be related to a bug when scrambling Ruby files. If you are
              loading the .rbs from a SketchupExtension, the loaded files may be put
              under the SketchupExtension namespace. Maybe there are conflicting
              names if these other plugins are also loading scrambled files using
              SketchupExtension...

              Is it what we have just done ? I believe but who knows

              the devil is in the detail

              1 Reply Last reply Reply Quote 0
              • D Offline
                driven
                last edited by

                @whydi said:

                ...I won't be able to cut these lines under 503 chars due to if statement with and and and and and so forth....

                the ruby 'style guide' recommends 70 chars per line, so 503 is a'little' longer than that...

                you can break **and, &&, or, ||** in statements by escaping a newline...

                I leave a space so before the escape \ as I find it easier to read...

                if (Sketchup.active_model.tools.active_tool_name == 'ScaleTool' || \
                   Sketchup.active_model.tools.active_tool_name == 'CameraOrbitTool' || \
                   Sketchup.active_model.tools.active_tool_name == 'MoveTool' || \
                   Sketchup.active_model.tools.active_tool_name == 'RotateTool' )
                   p "waiting for #{Sketchup.active_model.tools.active_tool_name}"
                else
                   # whatever
                end
                

                john

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

                1 Reply Last reply Reply Quote 0
                • WhyDiW Offline
                  WhyDi
                  last edited by

                  Hi driven
                  70 chars per line are very small but I'm making my best for reducing more an more. Fortunately we are speaking about Sketchup Scrambler not ruby. Using your way I think a might be able to decrease the numbers of characters per line down to 250 even 125 but no more.
                  Result in some hours...
                  Have a good day

                  the devil is in the detail

                  1 Reply Last reply Reply Quote 0
                  • WhyDiW Offline
                    WhyDi
                    last edited by

                    Hi all
                    I also learnt here http://sketchucation.com/forums/viewtopic.php?t=39094 that FILE and LINE do not work with 2014 previous versions but none of these keywords in the script.

                    Sketchup 8.0.16846 installed on another PC and test on both.
                    Max line length is 1276 and reduced to 1000 gives BugSplat at start time. 750 then 500 the same and finally 250 with no change. BugSplat as ever. I give up decreasing! It doesn't make any sense.

                    So I've reached the dead end!

                    After hours and hours of labour to preserve backward compatibility down to SU8 and just before releasing our extension the baby blows out! we are now unable to reach our purpose. I will send the bug plast but the answer will come to late if any.

                    From one hand the scrambler does not allow for 8 and 2013 version.
                    On the other hand using C doesn't look enough secure. Although I need to know more on C extension I think it's very probably all about dlls which means call from the main script and some bad eval() has to appear at some point in the ruby script. This also means that anyone can 'puts' the return of the dll call into the sketchup console easily. No more sense than above!

                    It's clear that without some ongoing miracle : Really the dead end.

                    I almost forgot to thank you for your time
                    Best Regards

                    the devil is in the detail

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      Have you identified the file that crashes?

                      I would load them manually, or put a tracing puts statement in them. To find which one crashes. Then strip away half the file until you find the section that crashes.

                      Just to be sure that this is a long-line crash - have you tried removing lines that are longer than a couple of hounded characters?

                      I'm still puzzled by your line length - what isn't that cannot be broken down? I don't think I ever have seen a line of code that had to be 1000+ chars long.

                      Can you post one of these lines - just as an example so we can fully understand what is going on?

                      But the key point here is the need to identify what file/line crashes.

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

                      1 Reply Last reply Reply Quote 0
                      • WhyDiW Offline
                        WhyDi
                        last edited by

                        Unfortunately they all and each crash.
                        under development we use 8 files encompassing roughly 50 classes, 500 functions, 7500 lines and 300k ruby only code out of of comment.
                        Each of these scrambled file loaded separately - meaning the others loaded as .rb - ends up with the BugSplat
                        After gathering them I got the same outcome
                        No doubt there is something wrong somewhere but what and where ?
                        I don't have time to read what a 'puts' can yield! running the scrambled script pauses about one second then close SU8 and finally shows the bug splat window. Nothing else than that. I'm never at hand to do anything!
                        What may I do? nothing!
                        the file with shortest (longest)line is 120. no html string into .rbs they are in the main module.rb

                        here is one of these numerous lines we have. delivered as is!

                        
                        if (@keep_prj_skp_file_last != Mdl;;prj_skp_file_last) or
                          (@keep_olt_user_filter != str_flt_cmp) or
                          (@keep_olt_user_filter_layer != Mdl;;olt_user_filter_layer) or
                          (@keep_fps_make != Mdl;;fps_make) or
                          (@keep_anim_wait != Mdl;;anim_wait) or
                          (@keep_dialog_collapse_at_runtime != @dialog_collapse_at_runtime) or
                          (@keep_do_mode != Mdl;;do_mode) or
                          (@keep_anim_restore_shot != Mdl;;anim_restore_shot) or
                          (@keep_anim_save_shot != Mdl;;anim_save_shot) or
                          (@keep_anim_save_model != Mdl;;anim_save_model) or
                          (@keep_anim_restore_cam != Mdl;;anim_restore_cam) or
                          (@keep_anim_save_cam != Mdl;;anim_save_cam) or
                          (@keep_anim_restore_lay != Mdl;;anim_restore_lay)
                            return true
                        end
                        
                        

                        What's wrong in such code?
                        Remember that all works perfectly without scrambling, even the gathered file with LineFeed or Semicolon at each end of line. All that works.
                        Is it worth to decrease line length under 256 chars? I have my doubts in such context

                        the devil is in the detail

                        1 Reply Last reply Reply Quote 0
                        • WhyDiW Offline
                          WhyDi
                          last edited by

                          You know what? today we have made a decision founded on

                          • Either our way of writing ruby script doesn't please SketchUp Scrambler
                          • Or the scrambler is not suitable for us.

                          Binary choice as any developer knows in its life and I'm inclined to think that the first one is likely to prove. My team doesn't like that but it's now the only way to go out this dead end. This may turn out as most of us have a strong MS background with c# or VB.net as I do. For who knows a bit about VB I like that 'redim preserve' and always works with OptionExplict and OptionStrict and OptionInfer. The compiler doesn't tolerate anything but nearly no error at runtime and intelliSense makes the remaining. This could lead to bad habits with ruby script - I never feel easy with its syntax and its way to auto-type variables as instance.

                          But let's get back to the point. So some times ago a script developer asked us to integrate our group. I've just called him. He comes tomorrow with a clear purpose. His mission is to rewrite one of our file its own way. If his way succeeds - meaning the file can go through the scrambler and works - he integrates.
                          Outcomes tomorrow

                          the devil is in the detail

                          1 Reply Last reply Reply Quote 0
                          • thomthomT Offline
                            thomthom
                            last edited by

                            Is the crash also happening on SU2013 as well?
                            Is your extension already available in some form? (I was wondering if I could run it on my SU8 version which is the latest. You mentioned you where using an older version - maybe that has a particular bug in it...)
                            (Or if you could provide even just one of these RBS files for testing - you can PM it to me if you want.)

                            The way the Ruby is written shouldn't really matter - it's only that old bug with long lines that I know of. (Though we're talking about SU8 here - might be some old bug that I never ran into. I no longer write for these old versions.)

                            Oh, and just to be sure it's not an issue with an old version of the scrambler - have you tried using this page to scramble? https://extensions.sketchup.com/en/developer_center/extension_signature

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

                            1 Reply Last reply Reply Quote 0
                            • WhyDiW Offline
                              WhyDi
                              last edited by

                              Hi all
                              You're right one more time thomthom writing style doesn't matter. Only my mistake!
                              Right now I've only focused SU8 both version and SU16. You anticipate my post as regard tests!
                              Please tell me what means 'PM' in ...you can PM it...?

                              So following my previous post. He integrates!
                              not because of his way of coding but he instantly pointed out my mistake. He doesn't start to write the first word of code. Indeed there was three lines of code I missed to check in our files. attr_reader and attr_writer and attr_accessor. In each file one of these lines is too long leading to crash.
                              Aiming to please you I spent some time to determinate the exact number of characters sketchUp.Scrambler can deal with.
                              the following assumes the start line right against the left edge and the cursor at the end of the line.
                              1016 characters are ok
                              1017 characters runs the bug splat window

                              once more thanks you very much. You are very nice guys.
                              I really hope to meet you soon once more. In fact I'm wondering about three beta versions some smart guys like you might run on their computer. but I'm afraid to ask for too much!
                              I guess thomthom is Windows user but as far as I remember driven likes OSX.
                              Am I right?

                              have a good week end

                              the devil is in the detail

                              1 Reply Last reply Reply Quote 0
                              • thomthomT Offline
                                thomthom
                                last edited by

                                PM = Private Message (in case you wanted to share files you didn't want to run publicly.)

                                So your extension runs under SU8 now?

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

                                1 Reply Last reply Reply Quote 0
                                • D Offline
                                  driven
                                  last edited by

                                  you can PM like this...
                                  scf_pm.gif

                                  and yes I use mac's, but I don't work for Trimble like Thomas does...

                                  are you registered as a developer?

                                  john

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

                                  1 Reply Last reply Reply Quote 0
                                  • WhyDiW Offline
                                    WhyDi
                                    last edited by

                                    Hi all,
                                    Thanks both for the meaning of PM.

                                    Hopefully each and the gathered scripts work correctly under SU8 and SU16. I feel relieved after that previous week of stress. I can tell you now that despite the scrambler limits I'm fully aware of we had made the decision to publish nothing if we were not able to overcome that first issue. There is another one making me ill at ease which is all about license key but I won't talk about on public thread. If any of you have experience to share with me I will appreciate. PM contact please.
                                    So it's very likely we release the free version after going through beta tests of course. At the time there is still more work.
                                    As for the two others and as ever said the release is related to acceptable license key making.

                                    But it may be time you to know a bit more about the (futur) extension itself. You may find the whole thing here www.SUalive.com
                                    Please let me know. What do you think about the concept and our way to look at animation in sketchUp? Feel free to ask any question.

                                    I've just filled the register form about developer. The way you ask me let me think that's an essential thing.
                                    I suspected you thomthom to work for Trimble as along my searches I noticed your 'sketchup team' status right underneath your login in some posts. I have no problem with that and think that Trimble made a great SketchUp version 2016 with its LayOut-style tray. There is a very annoying bug but I hope it to quickly disappear. So I'm a SU2016 pro user.

                                    @unknownuser said:

                                    ...I no longer write for these old versions...

                                    If you want to know why we develop for this old version I can explain and your team might take benefit from. Don't worry. As you may have understood I like Trimble work and the story can be public. It's all about 'the devil is in the detail'. This only explains my current signature. As you wish...

                                    Have a good week
                                    WhyDi

                                    the devil is in the detail

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      driven
                                      last edited by

                                      that's looking promising...

                                      have you got mac version working yet?

                                      there may be less mac SU users, but most will pay for a useful plugin...

                                      john

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

                                      1 Reply Last reply Reply Quote 0
                                      • WhyDiW Offline
                                        WhyDi
                                        last edited by

                                        Hi Driven
                                        Mac version has always been in the tube but at the very bottom of the stack. Each time we talk about we decrease its rank. what a shame!
                                        As you said the user number led us at first but you've just added an argument that might change our mind. On the other hand I would have liked to make you pleased. My thought also goes to slbaumgartner who helped me in the past (I think he also is Mac user). Mac users are so kind to help us and we haven't done much four you. So I'm ready to get even more involved although I know hardly anything about OSX.
                                        We meet next Friday evening and If you wish I may fight a bit so that Mac version raises at the top of the pile.
                                        Would you?
                                        I think I could achieve to persuade from these two arguments.

                                        the devil is in the detail

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

                                        Advertisement