Select to view content in your preferred language

Batch import and export to multiple heightmaps (.tif) using cityengine python API.

736
3
04-25-2022 09:55 PM
leehwichan
Emerging Contributor

I want to batch import and export batches of multiple heightmaps (.tif) using cityengine python API. Has anyone encountered this problem? I'd appreciate it if anyone could point me to how to do this.

leehwichan_0-1650948767722.png

 

0 Kudos
3 Replies
JonasObertuefer
Esri Contributor

hi there,

I don't have a complete solution, but I suggest having a look at this links in the python docs:

hope this points you into the right direction!

Cheers
Jonas

leehwichan
Emerging Contributor

Created scrapbook for fbx batch export of all terrain in 3D view. But it doesn't work. What's the problem?

 

'''
Created on 2022. 4. 29.

@author: user
'''
from scripting import *

# get a CityEngine instance
ce = CE()

from scripting import *
ce = CE()

if __name__ == '__main__':
layers = ce.getObjectsFrom(ce.scene(), ce.isLayer)
for layer in layers:
objects = ce.getObjectsFrom(layer, ce.isShape)
ems = FBXExportModelSettings()
ems.setOutputPath(ce.toFSPath(r"filepath"))
#set other options
ce.setSelection(objects)
ce.export(objects, ems)


if __name__ == '__main__':
pass

0 Kudos
JonasObertuefer
Esri Contributor

hi again,

First, you should clean up your script:

  • 2x ce = CE()
  • 2x if __name__ == '__main__':

Then you need also to define how you want to  export terrains in your FBXExportModelSettings() e.g. if you want to export all:

ems.setTerrainLayers(ems.TERRAIN_ALL)

 

 

0 Kudos