Forgot password?

Create an account!


« back

RhinoScript – Drop objects to surface


Please log in to write a message.

  • 16. ledisnomad (Oct 27, 2016 20.08):

    oxygenyuyu, I think you need to show an image of what you are trying to do before anybody can help.

  • 15. oxygenyuyu (Oct 27, 2016 16.18):

    Hi guys, the "Dropontosrf" script is amazing. But I'm not sure if my surface has problem, and some of the blocks do not drop to the surface but remain at its original position. Anyone would have a solution for this?

  • 14. palosanto (Sep 24, 2013 18.38):

    Hi guys, I just stumbled on this thread. I need something similar in a way to what you are doing. In my case, I would like to have a way to "drop objects to the floor", in other words, set the selected object(s) minimum z to zero. So It should find the minimum z of the extents of each object and move it to the same x-y coords but at z=0. How hard is to do this?. I use also Cinema 4D and it has a script that does exactly that and I find myself using it very often.

  • 13. Juan Expósito (May 24, 2012 00.38):

    don't worry, I have understood you well enough. Thank you very much. I tried it and is perfect, just what I needed it.

  • 12. ledisnomad (May 23, 2012 20.56):

    En realidad, tengo un script que se debe hacer lo que quiera. Prueba esto a ver si funciona para ti. (Sólo una nota:. Estoy usando Google Translate para leer / escribir en español, así que espero que no sea demasiado terrible)

    Option Explicit

    Call CopyToPoints()
    Sub CopyToPoints()
            Dim pts : pts = Rhino.GetPointCoordinates("Select points",True)
            If IsNull(pts) Then Exit Sub
            Dim     copyObj : copyObj = Rhino.GetObject("Select object to copy")
            If IsNull(copyObj) Then Exit Sub
            Dim copyObjOrigin : copyObjOrigin = Rhino.GetPointCoordinates("Select point at origin of object being copied")
            If IsNull(copyObjOrigin) Then Exit Sub
            Call Rhino.EnableRedraw(False)
            Dim arrPt
            If IsArray(pts) Then
                    For Each arrPt In pts
                            Call Rhino.CopyObject(copyObj,copyObjOrigin(0),arrPt)
            End If
            Call Rhino.EnableRedraw(True)

    End Sub
  • 11. ledisnomad (May 23, 2012 20.54):

    que debería ser bastante fácil. Voy a ver si me pueden ayudar y conseguir algo para poner a prueba en breve.

  • 10. Juan Expósito (May 23, 2012 20.34):

    un solo bloque en muchos puntos diferentes utilizando puntos como puntos de inserción. Aunque lo podría realizar fácilmente con grasshopper no me lo tendría en cuenta como instancias o eso creo. Estamos hablando de miles de instancias!

  • 9. ledisnomad (May 23, 2012 18.43):

    ¿Puedes ser más específico? ¿Usted desea insertar un bloque o bloques en muchas ocasiones diferentes?

  • 8. Juan Expósito (May 22, 2012 01.59):

    Hola a todos,

    necesito insertar varios bloques a la vez, ¿alguna sugerencia? ¿habría algún script para hacer esto?. Estoy utilizando Rhino 5

  • 7. scooterlord (Mar 05, 2012 01.17):

    a MILLION thanks, exactly what I needed! :)

  • 6. ledisnomad (Feb 01, 2012 15.00):

    Well, it took me a long time to check back in, so you may already have solved your problem. If not, here is a script I wrote awhile ago that drops objects onto a surface:

    Option Explicit
    'Script written by Damon Sidel
    'Script copyrighted by Damon Sidel
    'Script version Monday, May 09, 2011

    Call DropOntoSurface()
    Sub DropOntoSurface()

            'Get surface to populate
            Dim strSrf : strSrf = Rhino.GetObject("Select the surface to be populated")
            If IsNull(strSrf) Then Exit Sub
            'Get the points to drop
            Dim arrObj : arrObj = Rhino.GetObjects("Select the objects to drop")
            If IsNull(arrObj) Then Exit Sub
            Call Rhino.EnableRedraw(False)
            'Create jittery grid
            Dim obj, k, x, y, z, line, csX, BB, p1, p2
            For Each obj In arrObj
                    'Object information
                    BB = Rhino.BoundingBox(obj)
                    p1 = Array((BB(0)(0)+BB(2)(0))/2, (BB(0)(1)+BB(2)(1))/2, (BB(0)(2)+BB(2)(2))/2)
                    'Find point on surface to insert block
                    line = Rhino.AddLine(p1,Array(p1(0),p1(1),0))
                    csX = Rhino.CurveSurfaceIntersection(line,strSrf)
                    If IsArray(csX) Then
                            For k = 0 To UBound(csX)
                                    If csX(k,0) = 1 Then
                                            p2 = csX(k,3)
                                            Call Rhino.MoveObject(obj,p1,p2)
                                            Rhino.Print "Intersection is not a point"
                                    End If
                    End If
                    Call Rhino.DeleteObject(line)

            Call Rhino.EnableRedraw(True)
    End Sub
  • 5. Aleksandar (Jan 17, 2012 15.11):

    All I need to do is select an existing array of blocks (which are situated above the plane), and move them to the plane as shown in the image below.

  • 4. ledisnomad (Jan 17, 2012 14.24):

    Can you tell me what you are trying to accomplish? The script was rather specific for my personal needs at the time. It randomly distributes two blocks called "tree01" and "tree02" onto the surface. If you tell me what you want to do, I'd be happy to adjust the script so it works for you, but I need more info than just "It stops working..." Below is a more general purpose script a friend created that you can try, or feel free to let me know what functionality you are looking for and I'll try to help:

    Option Explicit
    'Script written by Trevor Patt
    'Script licensed under Creative Commons license
    'any use, alteration, or redistribution is permitted under the following
    'restrictions: derivative works must made open under an identical license
    'Script written for GSD RVB_Workshop_1.  (1106-08)

    Call CopyToSurface()
    Sub CopyToSurface()
            Dim objID, srfID, intNum, stPt, enPT, rndUV(1)
            Dim domU, domV
            objID = Rhino.GetObject("Select object to copy")
            If IsNull(objID) Then Exit Sub
            srfID = Rhino.GetObject("Select surface",8)
            If IsNull(srfID) Then Exit Sub
            intNum = Rhino.GetInteger("How many copies?",100)
            If IsNull(intNum) Then Exit Sub
            Call Rhino.HideObject(srfID)
            Call Rhino.EnableRedraw(False)
            stPt = Rhino.SurfaceVolumeCentroid(objID)
            domU = Rhino.SurfaceDomain(srfID,0)
            domV = Rhino.SurfaceDomain(srfID,1)
            Dim i
            For i=0 To intNum
                    rndUV(0) = Rnd*(domU(1)-domU(0)) + domU(0)
                    rndUV(1) = Rnd*(domV(1)-domV(0)) + domV(0)
                    enPT = Rhino.EvaluateSurface(srfID,rndUV)       
                    Call Rhino.CopyObject(objID,stPt(0),enPt)       
            Call Rhino.EnableRedraw(True)
    End Sub
  • 3. Aleksandar (Jan 17, 2012 10.36):

    Thanks for the help, but I have a problem
    It stops working afetr I enter number in U and V direction...

  • 2. ledisnomad (Jan 16, 2012 20.41):

    Hey Aleksandear, You could try my "Insert Block On Surface". Looks like you have an even grid of objects. Is that what you want? What is your ultimate goal?

  • 1. Aleksandar (Jan 12, 2012 19.32):


    I am trying to move many objects down to the deformed surface, but in a way that every object just touches it with one end; without intersection and keeping all faces without intersection with the bottom surface, or deformation (as in extrude to object command...)

    Sketchup already has a script like this (see picture)
    Is there anything like this in Rhinoscript?


    Drop objects to surface

Why are these buttons gray?