How to create a pixeled landscape with contour option?

Many years ago I learned how to create a pixeled landscape from a surface using the contour option. Now time has passed and I totally forgot how to do this. I have a 50cm by 50cm wavey surface which i contoured 1cm on the y axis, and then contoured 1 cm on the z axis. Now Im stuck, i know im supposed to extrude something, or maybe contour again. Does any one know which steps i should take next?

LexArmen_Model.3dm (8.0 MB)

looking to create a similar pixel landscape

Hi Lex,

What I’d do is:
1: point array with points at the center of each cell
2: project the points on the surface
3: run the button-macro below to copy rods to those points
4: cut the bottom of the rods to length:

HTH
-Willem

Macro on a button to distribute one object to multiple points

! _NoEcho _-Runscript (

Sub main
Pts=rhino.selectedobjects
if isnull(Pts) then Pts=rhino.getobjects("Points ?",1)
obs=rhino.getobjects("Objects ?")
rp=rhino.getpoint("Reference point ?")
rhino.enableredraw vbfalse
for each pt in Pts
  if rhino.ispoint(pt) then
    xyz=rhino.pointcoordinates(pt)
    rhino.unselectallobjects
    rhino.selectobjects obs
    rhino.copyobjects obs,rp,xyz
End If
next
rhino.unselectallobjects
rhino.enableredraw vbtrue
end sub

main

)
4 Likes

looks like a job for… dun du du duuun… grasshopper!

1 Like

Actually the definition I just posted in this thread will do exactly this, if you supply it with an array of solid boxes with no spacing in between…

ProjBoxesToSrf.gh (25.6 KB)
ProjBoxesToSrf2.zip (334.5 KB)

1 Like

damn ADHD, i got sidetracked and you beat me to it!

Wow guys thank you for the amazing support, I use Rhino on Mac at home so grasshopper wasnt an option. Will try these options this weekend

Alex

It is… Now available as a WIP in the current MAC Rhino WIP. --Mitch

didnt know that, will check out. thank you

Ive gotten as far as projecting the points on landscape, but I dont understand the next steps. do i draw surfaces or rods, not familiar with scripting in rhino. how should i project these rods to the points next?

To run the macro I added to my previous post you can copy paste it from here into the macro editor:

1: command MacroEditor
2: copy paste the macro script
3: press RUN button and follow instructions on commandline.

Instructions are:

  • select the points then
  • select the object (a single rod anywhere)
  • set a point relative to the object where it will end up relative to the points.
    So in the case of the rod; the point needs to be in the center of the top surface (draw a point there in andvance to snap to if needed)

Does this make sense?
-Willem

seems that macroeditor desnt work on the new rhino 5 for mac, so i will be forced to find another option, is there a way to project the rod surfaces to the points manually?

import rhinoscriptsyntax as rs

PtArray = rs.GetObjects("Select points")
Objects = rs.GetObjects("Select objects to array")
RefPoint = rs.GetPoint("Select a reference point")

rs.EnableRedraw(False)

for point in PtArray:
    if rs.IsPoint(point):
        xyz = rs.PointCoordinates(point)
        rs.UnselectAllObjects()
        rs.SelectObjects(Objects)
        rs.CopyObjects(Objects, xyz-RefPoint)

rs.UnselectAllObjects()
rs.EnableRedraw(True)

That is in Python, you can try it.

Also the Paneling Tool should do it for you http://wiki.mcneel.com/labs/panelingtools.

Even though the MacroEditor is not available yet on Rhino for Mac, you might try @Willem’s macro with a workaround that @Helvetosaur described in this post.

My macro will not work on a mac, it’s a macro containing rhino-script that is not available on a Mac.
The python-script @0netech posted above should work though.

-Willem

I was able to get it to work on the PC at work, however selecting all the rods causes my computer to crash and about an hour for the operation to occur. I don’t want to do each rod separately, that would take forever. maybe if i divide the model into sections i can slow down the operation time. thanks again for the script

Someone will correct me if I’m wrong, but only select one rod with the macro. This one rod will be copied to each individual point. It sounds like you selected all your rods and the macro is trying to copy all your rods to all the points, hence why your computer crashed. The macro cycles through each point and copies the one rod to that point, then moves onto the next point until there are no points left.

Yep, you need just one rod. You can also make a block instance out of the rod; this will save you memory.

here’s a quick go at it with grasshopper on mac… there’s a slider to control the box amount… pretty sure this definition could be streamlined some but for proof of concept…

surfBox.gh (9.0 KB)


video:

Here is another one - Windows only (RhinoScript). Should be quite fast - processing here 30,000 pixel terrain in under 15 seconds. Not sure what your output needs are but this will give you a single joined mesh (possible to process further) - should work fast and not crash your machine unless you go into few millions of pixels…

Drag-and-drop the attached script into Rhino vport:
z_test_PixelLandscape.rvb (2.5 KB)

and follow the steps:

  • you can pick many objects (surfaces or polysurfaces for now - meshes can be added, if needed) as your base terrain - it will use top-most points as pixel tops
  • define pixel size
  • define ‘bottom’ offset - the depth of the terrain from the lowest point of your base

Looks like now you should have plenty of solutions to choose from.

hth,

–jarek