model object and port to script

Hey guys,

I have a few ideas for some scripts that i would like to work on personally but i dont really know where to start.

Also, is it possible to model and object and then somehow take that information and port it directly to a script without having to actually code each vertex etc.
I hope that makes sense :slight_smile:

Thanks for the help!

Yes it is possible. I tried it in Blender 2.49. You can save positions an connections of all vertexes. I never completed the script , it is lost somewhere on my pc.
The problem was to load the vertexes and create faces from them i never got it to work.

I think what you are asking is how to break the idea up into smaller bits that you can figure out first. Formally you might call setting up coding tasks like that ‘milestones’. If we take a top-down approach, we should first recognize two main points. Import and Export

Milestones that you will want to achieve in sequence are:
Deal with exporting Vertex data, Vertex indices and Face data
[ ] 1) print them to console
[ ] 2) instead of printing to console, write that data as similarly formatted lists to a (txt) file
[ ] 3) python/blender must read the txt file and display its content in a way that resembles
the list structure in the original output from console in milestone 1.

In other words, you should not be able to distinguish the data that blender initially provided in milestone 1 from the data that your txt-reader code prints to the console after ‘parsing’ your txt file. Milestone 3 might prove the most demanding if you have little python experience.

[ ] 4) Have a look at my ascii importer, it shows what to do with Faces = [] , Verts = [] and vertIndices=[]. once you can get a correct list imported from your file, pumping those 3 lists into a new object is the easiest step.

in the example below Faces is made up from a combination of VertIndices and Verts

 
# create new mesh structure
mesh = bpy.data.meshes.new("Relief")
mesh.from_pydata(Verts, [], Faces)
mesh.update()

# create an object from this mesh
new_object = bpy.data.objects.new("Ascii Data", mesh)
new_object.data = mesh

# adding object called "Ascii Data" to the scene
scene = bpy.context.scene
scene.objects.link(new_object)

# deals with selecting
scene.objects.active = new_object
new_object.select = True

Thanks for the fast replies guys :slight_smile:

@zeffii,
I will give it a run through!

Thanks again :slight_smile:

Hey guys,
Just wanted to make a quick post to show the first preview of one of the scripts i was thinking of

It creates a PolySphere (all quad sphere)

http://blenderartists.org/forum/showthread.php?t=205444

:slight_smile:

ahh yeah, you’ll get this worked out pretty soon.

Im hoping so :slight_smile:
Once i can get the bugs fixed everything will be fine :stuck_out_tongue:

Thanks again for the help :slight_smile: