sketchucation logo sketchucation
    • Login
    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!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Advanced polar array

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    14 Posts 2 Posters 571 Views 2 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      Work on a saved SKP [v8].
      Choose your desired image-view and Select the components to be processed.
      Copy+paste this new one-liner in the Ruby Console +<enter> and a set of Images is made in an 'Images' folder with the SKP.

      require('sketchup.rb');m=Sketchup.active_model;a=m.selection.to_a;m.selection.clear;v=m.active_view;w=v.vpwidth;h=v.vpheight;t=m.title;f=File.dirname(m.path);f=File.join(f,"Images");Dir.mkdir(d)unless(File.exist?(f));m.start_operation('x');j='000';a.dup.each{|o|;j.next!;g=m.active_entities.add_group();e=g.entities;(a-[o]).each{|i|;e.add_line(o.bounds.center, i.bounds.center);};x=File.join(f,t+"_Image_"+j+'.png');Sketchup.status_text=x;v.refresh;v.write_image(x,w,h,true);g.erase!;};UI.openURL('file;///'+f);m.commit_operation
      

      It makes no changes to the model, but exports a set of images, then opens the folder 'Images'.

      TIG

      1 Reply Last reply Reply Quote 0
      • N Offline
        ninehundred
        last edited by

        that is amazing. thank you so much! however, i am working on version 7 im afraid so its not working 😞

        thanks anyway!

        1 Reply Last reply Reply Quote 0
        • N Offline
          ninehundred
          last edited by

          hey again,

          I was wondering if there's any way to make the code that exports the images one by one(as well taking out the background so only the lines remained)into a desired folder for version sketchup version7? just that ive also just worked out that ill have 61009 images.

          I know this is a lot to ask but if its possible or there's maybe some other way to do it any help would be of great importance!

          ninehundred

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            Let me get this right...
            You want only the 'ray' lines in the images ?
            Everything else is to be 'hidden'...

            TIG

            1 Reply Last reply Reply Quote 0
            • N Offline
              ninehundred
              last edited by

              Yes, just the ray lines. the idea basically is that ill take these lines later and overlay them onto a map so i can create a sort of time lapse of the lines building up until i have such a crowd of lines that the image area appears black. thing is though that if they all have a background then you wont see the build-up of the lines but rather a stream of individual images.
              another thing is that since there will be a map below which will need to be seen underneath the lines. so in regards to this it would be useful to be able to put the images into a line editor and put them to scale 1:1000 at a size of 0.25. maybe it would be easier to have the images exported at a scale of 1:1000, each of them with the map underneith. i suppose that would mean it would be consistently exporting the map layer along with the lines at 1:1000 (again with no background)

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                This images lines only.

                require('sketchup.rb');m=Sketchup.active_model;a=m.selection.to_a;p=[];a.each{|e|p<<e.bounds.center};m.selection.clear;v=m.active_view;w=v.vpwidth;h=v.vpheight;t=m.title;f=File.dirname(m.path);f=File.join(f,"Images");Dir.mkdir(f)unless(File.exist?(f));m.start_operation('x');k=m.entities.to_a;m.entities.erase_entities(k);j='000';p.each{|o|; j.next!; g=m.active_entities.add_group(); (p-[o]).each{|i|;  g.entities.add_line(o,i); }; x=File.join(f,t+"_Image_"+j+'.png'); Sketchup.status_text=x; v.refresh; v.write_image(x,w,h,true); g.erase!;};m.abort_operation;Sketchup.status_text='';UI.openURL('file;///'+f);
                

                The 'scaling' of the images is another issue entirely - perhaps best left to a batch process in Photoshop or Gimp ? You might be better scaling the map to match the image overlays [they are all the same size] - then that's only one operation...

                TIG

                1 Reply Last reply Reply Quote 0
                • N Offline
                  ninehundred
                  last edited by

                  #<NameError: (eval):131: undefined local variable or method `d' for main:Object

                  this is what came up when i put the code in :S

                  also, am i to replace "images" with the address to the folder id like them sent to?

                  1 Reply Last reply Reply Quote 0
                  • TIGT Offline
                    TIG Moderator
                    last edited by

                    Sorry! 😳
                    Stupid typo in the code... corrected now, I have edited my previous post...
                    Please retry it...

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • N Offline
                      ninehundred
                      last edited by

                      Error: #<NoMethodError: (eval):131: undefined method `refresh' for #Sketchup::View:0xa4d50c0>
                      (eval):131

                      Ok, so I put all the ray groups on one layer and basically started again. while a new folder called images was created there was still nothing in it and further to that all of the line groups except one was deleted. 😞

                      1 Reply Last reply Reply Quote 0
                      • TIGT Offline
                        TIG Moderator
                        last edited by

                        IF you completed your user-profile in the control panel I might have realized you weren't using v8! view.refresh was introduced in v8 so v7 will fall over !
                        This code avoids that

                        require('sketchup.rb');m=Sketchup.active_model;a=m.selection.to_a;p=[];a.each{|e|p<<e.bounds.center};m.selection.clear;v=m.active_view;w=v.vpwidth;h=v.vpheight;t=m.title;f=File.dirname(m.path);f=File.join(f,"Images");Dir.mkdir(f)unless(File.exist?(f));m.start_operation('x');k=m.entities.to_a;m.entities.erase_entities(k);j='000';p.each{|o|; j.next!; g=m.active_entities.add_group(); (p-[o]).each{|i|;  g.entities.add_line(o,i); }; x=File.join(f,t+"_Image_"+j+'.png'); Sketchup.status_text=x; v.write_image(x,w,h,true); g.erase!;};m.abort_operation;Sketchup.status_text='';UI.openURL('file;///'+f);
                        

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • N Offline
                          ninehundred
                          last edited by

                          thank you so much, this is great!

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

                          Advertisement