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

    Always face center-line/ Magnetic tool

    Scheduled Pinned Locked Moved Plugins
    56 Posts 9 Posters 2.2k Views 9 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.
    • jeff hammondJ Offline
      jeff hammond
      last edited by

      here's possibly the most basic dynamic component ever made πŸ˜„

      DC_pointer.skp


      it's a one liner:
      Screen Shot 2014-12-10 at 11.52.25 PM.png

      just use the regular Move tool to move it around and make copies (though doesn't seem to work with copy/array)?.. it will always point at the origin.
      (as is, you have to stay on the positive side of the red axis or it will point backwards)

      Screen Shot 2014-12-10 at 11.51.58 PM.png

      dotdotdot

      1 Reply Last reply Reply Quote 0
      • Flippie123F Offline
        Flippie123
        last edited by

        @jeff hammond said:

        here's possibly the most basic dynamic component ever made πŸ˜„

        haha...yes it always point to the center line but it is not magnetic. I tried to use the sketchyphysics tool but it only works for Sketchup7. And it is not easy to use. πŸŽ‰

        1 Reply Last reply Reply Quote 0
        • jeff hammondJ Offline
          jeff hammond
          last edited by

          @flippie123 said:

          haha...yes it always point to the center line but it is not magnetic.

          hmm.. it was meant as proof of concept.. the origin in this case is "magnetic"..

          copy a bunch of them around:

          Screen Shot 2014-12-11 at 3.00.49 AM.png

          then select them all and move them at once:

          Screen Shot 2014-12-11 at 3.01.19 AM.png

          Screen Shot 2014-12-11 at 3.01.37 AM.png

          with a less simple DC, you could make it the other way.. the objects stay put and you move the attractor around (though probably moving the the attractor via numerical input).

          dotdotdot

          1 Reply Last reply Reply Quote 0
          • BoxB Online
            Box
            last edited by

            @flippie123 said:

            I tried to use the sketchyphysics tool but it only works for Sketchup7. And it is not easy to use. πŸŽ‰

            My model up there was done in 2015 32bit, the only version it doesn't work in at the moment is 2015 64bit. Make sure you are using the latest version.

            Yes it can be difficult to use, it isn't the most easily understood plugin and the documentation is limited.

            But mostly I don't think it would work for you as it doesn't really work for positioning stuff then placing it. It is more of an animation tool.

            1 Reply Last reply Reply Quote 0
            • cottyC Offline
              cotty
              last edited by

              @flippie123 said:

              ... but it only works for Sketchup7. And it is not easy to use. πŸŽ‰

              That's wrong...
              http://sketchucation.com/pluginstore?pln=SketchyPhysics

              my SketchUp gallery

              1 Reply Last reply Reply Quote 0
              • jeff hammondJ Offline
                jeff hammond
                last edited by

                .

                here's a dynamic component which does the thing in the original post..

                DC_Magnet.skp

                to use it:
                β€’ double-click the outer component (main) to enter it.. (there are two more components inside: box & attractor)
                β€’ Move the attractor component with the move tool
                β€’ exit the main component then right-click on it --> Dynamic Components-> Redraw.

                dotdotdot

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

                  @jeff
                  that's really good...

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

                  1 Reply Last reply Reply Quote 0
                  • jeff hammondJ Offline
                    jeff hammond
                    last edited by

                    @driven said:

                    @jeff
                    that's really good...

                    thanks.


                    a few more additions (right-click--> dynamic components -> component options)

                    β€’ pick the number of boxes (square array)
                    β€’ how many beers? (straightness of rows and columns waver)

                    DC_Magnet_Beer.skp

                    Screen Shot 2014-12-11 at 11.16.14 PM.png

                    dotdotdot

                    1 Reply Last reply Reply Quote 0
                    • jeff hammondJ Offline
                      jeff hammond
                      last edited by

                      .

                      1024 boxes, a 12-pack, and change the shape of the box component

                      beermag.jpg

                      dotdotdot

                      1 Reply Last reply Reply Quote 0
                      • Flippie123F Offline
                        Flippie123
                        last edited by

                        @Jeff

                        I just made this and gave it a twist. Very awesome! πŸŽ‰ πŸ‘


                        Capture4.JPG

                        1 Reply Last reply Reply Quote 0
                        • jeff hammondJ Offline
                          jeff hammond
                          last edited by

                          @flippie123 said:

                          I just made this and gave it a twist.

                          yeah, it's something to do with replacing the box component with one on a different axis.. haven't quite figured out how to control it properly.. i made it this far:

                          beermag2.jpg

                          dotdotdot

                          1 Reply Last reply Reply Quote 0
                          • jeff hammondJ Offline
                            jeff hammond
                            last edited by

                            sweet!
                            (i'm not sure how to use the code but the gif looks cool πŸ˜‰ πŸ‘ )

                            dotdotdot

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

                              @jeff hammond said:

                              ...i'm not sure how to use the code ...

                              just paste into 'Ruby Console' hit return, will run till end of session...
                              it's only active when inside the DC so you can do other modelling...

                              I can put it in a rbz with the DC if you want...

                              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
                              • jeff hammondJ Offline
                                jeff hammond
                                last edited by

                                @driven said:

                                @jeff hammond said:

                                ...i'm not sure how to use the code ...

                                just paste into 'Ruby Console' hit return, will run till end of session...
                                it's only active when inside the DC so you can do other modelling...

                                I can put it in a rbz with the DC if you want...

                                john

                                oh nice. i see now.
                                it works along with the dynamic component i posted.. i didn't realize things like that were possible.

                                but yeah, that's a lot better than manually triggering the redraw πŸ‘

                                dotdotdot

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

                                  @jeff hammond said:

                                  ... i didn't realize things like that were possible.

                                  nor did I...

                                  I improved the script to only do one redraw after the move [was trigging twice]...

                                  there are probably other ways to do this, but it seams to work...

                                  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
                                  • D Offline
                                    driven
                                    last edited by

                                    updated working version...

                                    class JcB_MoveToolObserver < Sketchup;;ToolsObserver
                                        def onToolStateChanged(tools, tool_name, tool_id, tool_state)
                                          attractor = Sketchup.active_model.selection[0].definition.name == 'attractor'
                                          moved = tool_state.to_s == '0' && tool_name.to_s == 'MoveTool'
                                          @count = 0 unless @count == 1
                                          
                                          update = attractor && moved
                                            if update
                                              selection = Sketchup.active_model.selection[0].parent.instances[0]
                                              @count = @count + 1
                                              puts(" first click of " + tool_name.to_s ) if @count == 1
                                              if @count == 2
                                                puts(" second click of " + tool_name.to_s )
                                                $dc_observers.get_latest_class.redraw_with_undo(selection)
                                                @count = 0
                                              end
                                            end
                                        end
                                     end
                                    
                                     Sketchup.active_model.tools.add_observer(JcB_MoveToolObserver.new) if not defined? JcB_MoveToolObserver
                                     
                                    

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

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

                                      here's a fun bit of code...
                                      now it does what the OP asked...
                                      auto update, slows a bit over 64 items...

                                       look below...
                                      

                                      john
                                      EDIT: changed back to original as my counter was failing

                                      BETTER CODE BELOW...

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

                                      1 Reply Last reply Reply Quote 0
                                      • J Offline
                                        Jim
                                        last edited by

                                        @unknownuser said:

                                        the other thing I was wondering if arrow keys can be used to move the dc's 'attractor'

                                        You need a Tool to get the key-presses, then read-update-write the position values depending on which key was pressed, then redraw the DC.


                                        This file was made specifically for Jeff's DC Magnet Beer model.

                                        Hi

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

                                          cheers Jim,
                                          that works and is much cleaner than i was attempting...

                                          what other thing can we do with ruby to manipulate DC's?

                                          I'll see if I can turn this into a pick point version...

                                          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
                                          • sdmitchS Offline
                                            sdmitch
                                            last edited by

                                            Hey, I want in on the fun too.

                                            Nothing is worthless, it can always be used as a bad example.

                                            http://sdmitch.blogspot.com/

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

                                            Advertisement