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

    [Plugin][WIP] Layers Panel - Dev

    Scheduled Pinned Locked Moved Developers' Forum
    45 Posts 11 Posters 8.8k Views 11 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.
    • jiminy-billy-bobJ Offline
      jiminy-billy-bob
      last edited by

      Ok, here is a new version.

      • Added Toolbar and menu item (Window > Layers Panel), with toggle
      • Change things you TT told me : Undo, +operator, filename...
      • Deleting layers now work properly. The method is wrapped in my namespace. When a layer has geometry, you are promped to choose to delete the content or move it to the default layer.
      • Added a menu for some options. For now you can only purge layers.
      • I also don't have bugsplats anymore. Don't know why exactly... If people get some, please tell me.

      Still no saving, I'm getting used to ruby before attacking this big piece.

      Also, I can't get my WebDialog callbacks to work if the dialog is not in a global variable. I tried local, instance, and class variables, nothing works. What am I doing wrong ?


      Layers Panel 0.02.rbz

      25% off Skatter for SketchUcation Premium Members

      1 Reply Last reply Reply Quote 0
      • jiminy-billy-bobJ Offline
        jiminy-billy-bob
        last edited by

        Hmm, so a class variable in a class ? That makes sense ^^
        Thanks for the tip, I'll try that.

        25% off Skatter for SketchUcation Premium Members

        1 Reply Last reply Reply Quote 0
        • renderizaR Offline
          renderiza
          last edited by

          I hope that naming the Class "TEST" didn't confuse you since the class name doesn't have anything to do with the variables (var test = true) in html. 😕

          I guess what i am trying to say is that the "var test" in html has nothing to do with "Class TEST" in ruby.

          Not sure if you are confusing them both but just in case. 💚

          Note: Will edit the name of the class on my last post to "PLUG".

          [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

          1 Reply Last reply Reply Quote 0
          • renderizaR Offline
            renderiza
            last edited by

            Hi,

            @jiminy-billy-bob said:

            Also, I can't get my WebDialog callbacks to work if the dialog is not in a global variable. I tried local, instance, and class variables, nothing works. What am I doing wrong ?

            If you want to change something from ruby to web-dialog you can do this...

            In Html & Javascript:

            
            <html>
               <head>
                  <title>Example</title>	
               </head>
            
               <body onLoad="startup(), stopwatch(this.value);">
            
               </body>	
            </html>
            
            <script>
            var delay = 1000/5 ; #this will update 5 frames per second
            var timerID = false ; 
            
            var test = true ;  #this is the value you will change from ruby
            
            
            function startup() {
            nextFrame();
            }
            
            function stopwatch() {
            SD=window.setTimeout("stopwatch();", 100);
            }
            
            
            function nextFrame() {
            
               try {
            
                  test = test
            
            
                  setFrame() ;
            
                  top.timerID = self.setTimeout("nextFrame()", delay) ;
            
               } //try
            
               catch (e) { 
                  alert("push_frame; " + e) ; 
               }
            
            } //nextFrame()
            
            
            function setFrame() {
            url = 'skp;push_frame@' ;
            
               url += '&test=' + test;
            
            window.location.href = url ;
            }
            
            </script>
            

            In Ruby:

            
            module SU_PLUG
               class PLUG
            
                  @@model = Sketchup.active_model ;
                  @@dir = File.dirname(__FILE__) # this plugin's folder
                  @@path = File.join(@@dir, '/Folder/')
                  @@dlg = "test.html" ;
                  @@test_dlg = nil ;
            
            
                  def initialize()
                     @test_1_file =  File.join(@@path, @@dlg) 
            
                     if @@test_dlg == nil
                         @@test_dlg = UI;;WebDialog.new("Test", false, "Test", 300, 600, 70, 95, true) ;
            
                        @@test_dlg.add_action_callback("push_frame") do |d,p| 
                           push_frame(d,p) 
                        end
                     end
            
                     @@test_dlg.set_size(300, 600) ;
                     @@test_dlg.set_file(@test_1_file) ;
                     @@test_dlg.show() ;
            
                  end #def 
            
            
                  def push_frame(dialog,data)
                      params = query_to_hash(data) ;  # parse state information 
            
                      if params['test'].to_s == "true"  #Example of a  condition.
            
                         change = false
            
                         script = "top.test= " + change.to_s + ";"    #this sets test=true to test=false
                         dialog.execute_script(script);   #this execute it
                      end
                  end #def
            
            
                  def unescape(string)
                  if string != nil
                  string = string.gsub(/\+/, ' ').gsub(/((?;%[0-9a-fA-F]{2})+)/n) do
                  [$1.delete('%')].pack('H*')
                  end
                  end
                  return string
                  end #def
            
                  def query_to_hash(query)
                  param_pairs = query.split('&')
                  param_hash = {}
                  for param in param_pairs
                  name, value = param.split('=')
                  name = unescape(name)
                  value = unescape(value)
                  param_hash[name] = value
                  end
                  return param_hash
                  end #def
            
            
               end #class
            	
            end #module
            

            Hope this helps and again very good plugin!

            [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              Ruby uses 2 space indentation. HTML & Javascript 4 space indentation.
              NOTHING uses 3 or odd number spaced indents !

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                @jiminy-billy-bob said:

                Also, I can't get my WebDialog callbacks to work if the dialog is not in a global variable. I tried local, instance, and class variables, nothing works. What am I doing wrong ?

                See this other post: Re: Webdialog scripting issues

                Use local vars INSIDE methods as temporary variables. They get garbage collected when the method ends.

                Use @@vars INSIDE modules or for class-wide access.

                Use @vars in class instance methods (define and init them inside the initialize method.)

                💭

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • jiminy-billy-bobJ Offline
                  jiminy-billy-bob
                  last edited by

                  Thanks a lot, I'll try that.

                  25% off Skatter for SketchUcation Premium Members

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

                    @dan rathbun said:

                    Ruby uses 2 space indentation. HTML & Javascript 4 space indentation.
                    NOTHING uses 3 or odd number spaced indents !

                    Only Python require a certain indentation - Ruby, HTML and JS doesn't care. It's just coding convention within the team/project you're working with.

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

                    1 Reply Last reply Reply Quote 0
                    • I Offline
                      iannuzzi
                      last edited by

                      Please, don't ever give up on this plugin, it'd save my life! I wish I could help

                      1 Reply Last reply Reply Quote 0
                      • jiminy-billy-bobJ Offline
                        jiminy-billy-bob
                        last edited by

                        I won't give up ! 😄 I just don't have time curently. I will at the end of july.
                        No worries

                        25% off Skatter for SketchUcation Premium Members

                        1 Reply Last reply Reply Quote 0
                        • KrisidiousK Offline
                          Krisidious
                          last edited by

                          just posting so I'll get updates on this thread.

                          By: Kristoff Rand
                          Home DesignerUnique House Plans

                          1 Reply Last reply Reply Quote 0
                          • jiminy-billy-bobJ Offline
                            jiminy-billy-bob
                            last edited by

                            I made another thread to discuss the behaviour of the plugin : http://sketchucation.com/forums/viewtopic.php?f=323&t=52225

                            Feel free to participate 😄

                            25% off Skatter for SketchUcation Premium Members

                            1 Reply Last reply Reply Quote 0
                            • L Offline
                              Litchi
                              last edited by

                              Thanks for your present!This is a great plugin, but I have a problem,I created a layer group,which contains a number of layers,but when I restart the plugin Panel,everything was back to the way they were,the group disappeared, the new layer still exist。

                              1 Reply Last reply Reply Quote 0
                              • jiminy-billy-bobJ Offline
                                jiminy-billy-bob
                                last edited by

                                Yep, it doesn't save anything yet ^^
                                See the first post :

                                @jiminy-billy-bob said:

                                ToDo :

                                • **Saving ! For now, every time you refresh the webdialog, or exit SU, the sorting/nesting disappears.**So it's useless as is.

                                It will come. Just not now 😄
                                It's obviously at the top of my todo list.

                                25% off Skatter for SketchUcation Premium Members

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

                                  hi

                                  I just wondered if you had ever seen this, it has some nice ideas, to take forward

                                  http://sketchucation.com/forums/viewtopic.php?p=162487#p162487

                                  I did some work on the mac version, but Chris and Jim had already done the tricky bits...

                                  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
                                  • jiminy-billy-bobJ Offline
                                    jiminy-billy-bob
                                    last edited by

                                    Hey guys !

                                    I finally got a working version (See first post for download). It saves sorting/nesting (Except group hiding/collapsing)
                                    I still wouldn't recommand using it in production though, as it may produce bugsplats, and it still behave strangely with the undo stack.

                                    There are still a lot of bugs, so I need you guys to help me track them and getting methods to reproduce them.
                                    I updated the first post with what's working and what's not.

                                    I don't think it works on mac, though I'm not able to test...
                                    For now, I tested only on win7 SU2013 IE8-10, with no bugsplats so far.

                                    Feedback (about bugs or features) would be highly appriciated ! 😄

                                    Thanks

                                    25% off Skatter for SketchUcation Premium Members

                                    1 Reply Last reply Reply Quote 0
                                    • Rich O BrienR Offline
                                      Rich O Brien Moderator
                                      last edited by

                                      Once I hide a Layer I can't unhide it unless I nest it in a Layer Group

                                      Win8

                                      Great tool 👍

                                      Download the free D'oh Book for SketchUp 📖

                                      1 Reply Last reply Reply Quote 0
                                      • KrisidiousK Offline
                                        Krisidious
                                        last edited by

                                        woooot wooot!

                                        By: Kristoff Rand
                                        Home DesignerUnique House Plans

                                        1 Reply Last reply Reply Quote 0
                                        • jiminy-billy-bobJ Offline
                                          jiminy-billy-bob
                                          last edited by

                                          @rich o brien said:

                                          Once I hide a Layer I can't unhide it unless I nest it in a Layer Group

                                          Win8

                                          Great tool 👍

                                          Weird, it works for me on win8 with SU2013 and IE10.
                                          Which versions of SU and IE are you using ?

                                          25% off Skatter for SketchUcation Premium Members

                                          1 Reply Last reply Reply Quote 0
                                          • Rich O BrienR Offline
                                            Rich O Brien Moderator
                                            last edited by

                                            SU8 and IE10

                                            I'll try it on SU2013

                                            Download the free D'oh Book for SketchUp 📖

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

                                            Advertisement