All-in-one script: importing 3d models and adjusting their properties

Hello,

Right now I am involved in a project which creates virtual forests (using World Viz software). I would like to explore the possibilities of creating these environments in Blender, and so I would like to start by writing a script which can emulate some of the features of Vizard so that I can reuse the code which I have already written. I am familiar with python but not familiar with writing scripts for blender.

I have tried searching for a suitable way to start online, but I haven’t found tutorial which has really helped me a lot. In addition, I predict that I will be able to borrow large amounts of code that have already been written and I want to make sure that I’m heading in the right direction before writing.

Perhaps, the easiest way to describe what I would like is to give some pseudo code and which methods I would like to create:

1 #############
2 ## myScript.py ##
3 #############
4
5 ##List containing file paths for 3DS objects and OBJ objects
6 objectnames = [ ‘./tree1.3ds’, ‘./tree2.obj’,…]
7
8
9 for ob in objectnames:
10 3D_obj = addObject( ob ) ##METHOD 1 for importing objects
11 3D_obj.setPosition( [x,y,z] ) ##METHOD 2 for translating objects
12 3D_obj.setOrientation( [yaw,pitch,roll]) ##METHOD 3 for translating objects
13 3D_obj.setScale( [scaleX,scaley,scalez] ) ##METHOD 4 for translating objects

I’ve noticed that a typical most 3D objects ( once imported inside blender ) are separated into multiple meshes and it can be difficult to manipulate them once they are inside blender, so maybe I would need another method which should follow line 10 which groups the meshes of the current object to one entity.

I already have large number of pre-made 3D objects and also scripts for generating positions, orientations, and scales in a text file. The point is, I need some way of using this information in Blender. Can someone give me some direction? What needs to be done? Or maybe someone has spotted scripts which already do this? Tutorials would be nice too. Any help is appreciated, thanks!

-Andy