Heightmap to brick converter?

RE: Heightmap to brick converter?
Thumbs Up 
(2018-06-18, 20:56)NRoland Melkert Wrote:
(2018-06-18, 20:14)Jaco van der Molen Wrote: No idea so far how to do that.
Any thoughts. Undecided Huh

If you can somehow generate a lua variable definition with excel.

Then you can do the actual generating of the model in LDCad using a macro. All you would need is the x/z values in an array.

For an 3x3 grid you would need something like this:

local depthMap={ {0, 1, 2}, {4, 5, 6}, {7, 8, 9} }

You use that in a macro run event like so:

function renDepthGen()

 local sf=ldc.subfile()
 if not sf:isLinked() then
   ldc.dialog.runMessage('No active session')
 local sel=ldc.selection()

 local depthMap={
   {0, 1, 2},
   {4, 5, 6},
   {7, 8, 9}
 local h=genTools.tableArrayCount(depthMap)
 local w=genTools.tableArrayCount(depthMap[1])
 for x=1,w do
   for z=1,h do
     local v=depthMap[z][x]
     local v1=v // 3
     local v2=v % 3
     local xx=(x-1)*20
     local zz=(z-1)*20
     local yy=0
     for b=1,v1  do
       sel:add(sf:addNewRef('3005.dat', 4, ldc.matrix(xx, yy, zz)))      
     for p=1,v2 do
       sel:add(sf:addNewRef('3024.dat', 4, ldc.matrix(xx, yy, zz)))

Which would give you:

Ah! Ok, I see. That is exactly what I meant!
My excel source can make the depth map, I understand how it works.
For a 16 by 16 baseplate you have 16 arrays with each 16 values.
Now if you can incorporate the color of the column too, I am there.
Jaco van der Molen
« Next Oldest | Next Newest »

Messages In This Thread
RE: Heightmap to brick converter? - by Jaco van der Molen - 2018-06-18, 21:10

Forum Jump:

Users browsing this thread: 1 Guest(s)