sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Pushpull scripting. need HELP plz

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 4 Posters 303 Views 4 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.
    • W Offline
      walid
      last edited by

      hello folks, i need ur help plz
      i was trying to script the pushpull command on sketchup ruby, just immitating the tutorial ( http://www.youtube.com/watch?v=Aq1YEaI2XlA&feature=related ) but unfortunately it didnt work, so i guess ther is a step missing or something going wrong...if u can help it ll be soooo cooool,,,

      thanxxxx

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        Well, its hard to say if your doing something wrong, without seeing anything you've done πŸ˜„

        But I will say that I'm pretty sure that the video is accurate, as it is written and tested in real time in the video - no Hollywood magic pushpulling the faces or anything.

        So why not post a snippet of your code you are working on we'll see how it looks!

        Chris

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

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

          hey i m walid s friend
          wr r working together on this project
          and here is the code we tried to enter yesterday
          but unfortunately it didnt work

          the basic of our work is to find out how to make a plugin that digs a cube randomly into different multi geometrial shapes with different sizes and so on...

          thank uuuu

          
          model = Sketchup.active_model
          sel = model.selection
          model.start_operation "mult. pushpull"
          
          faces = []
          
          sel.each do |e|
          faces << e if e.is_a? sketchup;;face
          end
          
          faces.each do |face|
          face.pushpull [ 100 ]
          end
          
          
          model.commit_operation
          
          
          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            face.pushpull [ 100 ]
            NO

            face.pushpull(100)
            or even
            face.pushpull 100
            YES

            [] encloses an 'array' - e.g. a 'list' of things like [0,0,1] - the three points x,y,z
            () or <space> simply separate the arguments from the method...

            pushpull takes a distance not an array

            Here you are pushpulling every face 100 units (inches) in the direction of the face's normal (front face)
            To use other units use a suffix like 100.mm for millimeters

            TIG

            1 Reply Last reply Reply Quote 0
            • W Offline
              walid
              last edited by

              hi TIG i have tried the script in the way u told me 2 but no result..
              i hav noticed that on the u tube tutorial the command was EXECUTE
              on my sketchup it is EVALUATE so does that mak difference ?
              if yes ... how can i download the execute command...
              thanx

              1 Reply Last reply Reply Quote 0
              • Chris FullmerC Offline
                Chris Fullmer
                last edited by

                Hi guys, the " execute" versus " evaluate" difference is nothing. It is just a different version of the same tool. They work exactly the same.

                Fix what TIG suggested and then fix this line:

                faces << e if e.is_a? sketchup::face

                the word sketchup is a class and needs to be capitalized, and so should the word face (I think). So it should read like this:

                faces << e if e.is_a? Sketchup::Face

                Try changing that too and see if it works. Ruby is case very sensitive! πŸ˜„

                Chris

                PS Sorry I have been slow to respond here, and I just got your PM also. My computer broke and I have been without internet at home for a few days. But all hard drives are replaced, new motherboard in, new RAID card up and running and I think I might have a useable computer again. Good luck!

                Lately you've been tan, suspicious for the winter.
                All my Plugins I've written

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  OK, just got Sketchup and the web console installed on my system so I could test this out. Sure enough, making TIG's changes, plus the ones I showed above, and it all works. This is the final code:

                  model = Sketchup.active_model
                  sel = model.selection
                  model.start_operation "mult. pushpull"
                  
                  faces = []
                  
                  sel.each do |e|
                  faces << e if e.is_a? Sketchup;;Face
                  end
                  
                  faces.each do |face|
                  face.pushpull 100
                  end
                  
                  model.commit_operation
                  
                  

                  There you go! Let me know how the other tutorials go also!,

                  Chris

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  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