sketchucation logo sketchucation
    • Login
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Script request -- drop to touch

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 5 Posters 1.2k Views 5 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.
    • A Offline
      agamemnus
      last edited by

      Sometimes, I can't find an anchor point. I want to position objects such that their lines touch, not anchor points. For instance, consider a square positioned just to the left and top of a triangle with a right angle on the bottom-right. Say I want to position the square so that it just touches the diagonal line of the triangle. To do it in Sketchup manually I need to group the square, draw a line from the square to the triangle, position the square on the intersection point of the line and the triangle, then delete the line. With more complex positionings it gets very tricky and difficult. I would love a way to do this with a Ruby script.

      I'm thinking simple here-- just specify Z+/-, X+/- or Y+/- as well as the two objects (groups) in question and then the script would move one group to the other group so that their closest lines or planes juuuust touch. A script that can take X/Y/Z angles would be even better.

      1 Reply Last reply Reply Quote 0
      • M Offline
        MartinRinehart
        last edited by

        I'm thinking that a picture of what you want would help.

        Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

        1 Reply Last reply Reply Quote 0
        • A Offline
          agamemnus
          last edited by

          Hi, sure. Just pretend these circles are complex 3d polygons and the blue circle doesn't necessarily hit any anchor point on the green circles such that no other geometry.

          The object is for the lowest relative point (not anchor point) on the green circle to just touch the highest relative point on the blue circle.

          To do this manually i'd need to find the lowest point on the blue circle, draw a line down, intersect the line with the bottom geometry and get an anchor point at the intersection of the line and the green circles, while hoping that the blue circle geometry does not intersect any other green circle geometry on the way down.


          example.JPG

          1 Reply Last reply Reply Quote 0
          • pilouP Offline
            pilou
            last edited by

            Sketchyphysics3 makes that automatically ๐Ÿ˜‰
            Just set your volume as "Sphere" or "Convex" (so "surface" must have minimum thick)
            Run animation
            Save / Exit
            Reload you have your result! (here with SPh 2.1 )

            PS Look if maybe my little thread about drop can help don't make that?


            cylinder.jpg


            Cylinder.skp

            Frenchy Pilou
            Is beautiful that please without concept!
            My Little site :)

            1 Reply Last reply Reply Quote 0
            • A Offline
              agamemnus
              last edited by

              Thanks for the idea. Sketchyphysics 3 might do the trick. Might not work for complex objects, though, and it is a bit of a clumsy method...

              The undrop multiple sounds fun, but I can't find a link to the final version.

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

                Sketchyphysics is the closest thing out there to what you want. Its seriously complicated to write a script like that IMO.

                Chris

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

                1 Reply Last reply Reply Quote 0
                • X Offline
                  xrok1
                  last edited by

                  wouldn't it work to draw a construction line from blue center to green center, then move from intersection point blue to intersection point green? ๐Ÿ’ญ

                  โ€œThere are three classes of people: those who see. Those who see when they are shown. Those who do not see.โ€

                  http://www.Twilightrender.com try it!

                  1 Reply Last reply Reply Quote 0
                  • X Offline
                    xrok1
                    last edited by

                    example:


                    Capture.JPG


                    Capture1.JPG

                    โ€œThere are three classes of people: those who see. Those who see when they are shown. Those who do not see.โ€

                    http://www.Twilightrender.com try it!

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

                      That won't work on complex shapes though.

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

                      1 Reply Last reply Reply Quote 0
                      • X Offline
                        xrok1
                        last edited by

                        WELL... if you want to get picky! ๐Ÿคฃ

                        โ€œThere are three classes of people: those who see. Those who see when they are shown. Those who do not see.โ€

                        http://www.Twilightrender.com try it!

                        1 Reply Last reply Reply Quote 0
                        • pilouP Offline
                          pilou
                          last edited by

                          About Sketchyphysics
                          A little trick if you want that your objets are still straight fall down at the end
                          Just put 2 big boxes (one in front of, one behind) so objects are jamed in! ๐Ÿ’š
                          trick.jpg

                          About undrop
                          just copy/past that in the Web console
                          Select yours groups and press "Eval" ๐Ÿ˜„
                          Change z = z + 100.cm as you want ๐Ÿ˜„
                          (for copy all Code follow click blue "Select All" ๐Ÿ˜„

                              model = Sketchup.active_model
                              model.start_operation("Move in Z")
                              entities = model.entities
                              selection = model.selection
                          
                              zeds=[]
                              index=0
                              sorted_groups=[]
                          
                              groups=[];selection.each{|entity|groups.push(entity) if entity.kind_of?(Sketchup;;Group)}
                          
                              groups.each{|group|zeds.push([group.bounds.min.z, index])
                                 index+=1
                              }
                              zeds.sort!
                              zeds.each{|z|sorted_groups.push(groups[z[1]]) }
                              ### sorted_groups is now groups sorted by z
                          
                              z = 0.0
                              sorted_groups.each do |e| # update!
                                # Now we process the groups
                                t = Geom;;Transformation.new(Geom;;Point3d.new(0,0,z))
                                # Apply the transformation
                                e.transform!(t)
                                z = z + 100.cm
                              end
                             
                            model.commit_operation
                            return nil
                          

                          Frenchy Pilou
                          Is beautiful that please without concept!
                          My Little site :)

                          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