Need help - move object to point

Hello hello,

I can’t find a way to make a simple thing with only few comand, that would take me hours if I have to do it one by one.

I have a point network created from projection on a surface (precisly a city model). I just want to place solid cubes by the midle of their up face on each point to create a cubic simplification of the city volume.
I hope I’m clear enough (and excuse my writing I’m french) but maybe this exemple can help :

This is an exemple of the aspect I want ti create.

Thanks you for yout time !

This can be done with Grasshopper. There are many tutorials online and I suggest to study the Modelab Primer:

Foundations | The Grasshopper Primer Third Edition (

you can use a simple script:

! _-Runscript (
Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version lundi 18 décembre 2017 08:52:03

Call Main()
Sub Main()
	Dim arrsurf, origine, arrpt,strpt,endpt
	arrsurf = rhino.GetObjects("selectionne les objets à copier!")
	origine = rhino.Getpoint("Selectionne le points d'origine!")
	arrpt = rhino.GetObjects("selectionne les points d'arrivés!", 1)
	For Each strpt In arrpt
		endpt = Rhino.PointCoordinates(strpt)
		Rhino.copyobjects arrsurf, origine, endpt

End Sub)

Oh that’s a good news ! thank you
Only problem now is that error message when I try to run it :

SyntaxError: Non-ASCII character ‘\xc3’

I never used python language so I tried but not very effectively

The above is not a python script, it’s a VB Rhinoscript. You can run it with Runscript, not RunPythonScript. Or, you can try this python script “CopyObjectToPoints” (540 Bytes)

1 Like

Okay thanks I would have not found it myself

“CopyIbjectToPoints” is a solution but only for one object at a time. I need to do the same for many objects at the same time, each of them having their own point to move to. Maybe the VB Rhinoscript can be a solution but unfortunatly I can’t run it, when I try there is a message “Command: -_NoEcho”

The question is how are you establishing the relationship between each ‘cube’ object and the point it has to move to? That is to say, how do you tell Rhino which cube goes to which point?

Your right excuse my imprecision. Each cube have to move vertically, to a point above him. Each cube have his own point above him. Maybe a picture can help. (when there is no point, the cube don’t have to move and I will not select it when I execute the command)

An other view from above :

I think you have to learn python scrippting…
it’s a simple script to do, but it take time, and when you start to script, you can’t stop…
en français: lance toi dans le python, ça marche fort, et ça ouvre pas mal de possibilité!!!

1 Like

Aha… that’s a totally different problem. There are several ways to approach this, for example project the points downward and see if they intersect with a cube and if so move the cube from the bottom most or top most intersection point back up to the original point. Grasshopper seems ideal for this, but a script can do the same. I don’t have time this afternoon unfortunately.

I know and it’s a thing I wanted to do, I began for other projects on other platform but like you said it take time. I’m wanted to see if someone had the same problem before but don’t worry , I’ll dive myself in it one day. Merci pour le conseil ! :wink:

I see, I’m gonna try to find a project similar to adapt a solution. Thanks a lot for your time !

@Absent try this: (698 Bytes)

the top of cubes must be on Z=0, and all translation must be on Z direction…

i’ll be curious to see the @Helvetosaur correction of my script… if you have time…

1 Like

This might be one way…

import rhinoscriptsyntax as rs

def TestMoveBoxes():
    boxes=rs.GetObjects("Select boxes to move",16,preselect=True)
    if not boxes: return
    pt_ids=rs.GetObjects("Select points to move to",1)
    if not pt_ids: return
    #create list of 3d point objects
    pts=[rs.coerce3dpoint(pt_id) for pt_id in pt_ids]
    for box in boxes:
        for i in range(len(pts)):
            if bb[0].X<=pts[i].X<=bb[6].X:
                if bb[0].Y<=pts[i].Y<=bb[6].Y:
                    #point is inside box xy bounds, move top of box to point Z
                    ##point used once, remove from list - faster if many pts
                    #jump out as point has been found
1 Like

Thank you so much both ! Each one of your code work, but I have to say that @Helvetosaur made one that is instantaneous and all my volumes in one command. You made my day ! :grin: