Notifications
Clear all

[Closed] create surface / poly's

Hello scripterz

i’m working on something and have a question on how to create a surface/polys

what i have now is a script that reads a txt file and create a empty poly filled with vertex points.

from the top view is something like this:



… …
… …
… …

now i want create a surface or create polys for my object and well i’m a bit stuck.
the reference : polyop.createPolygon <poly> <vertex array>

But how do i get a vertex array?
i would like to do something like this:
for each vert in obj:
get surrounding vert points
make poly

perhaps any of you have done this or has some pointers. i searched this forum and on scriptspot but i could not find anything helpfull…
is a bit in the direction of pointcloud meshing/visualizing…

oh yeah in this particular case the vertex are 1m for each other in x and y. the z changes.
but a sollution that is more general is better

Well hope any1 has some ideas!

Thx in advance

1 Reply

Well, what you want to do is not particularly easy. If your mesh is regular, ie, if the verts are paired in columns and rows, or the distance between the verts is similar, then there are some ways to achieve it with a high degree of precision. If the grid of vertex points is not regular, then it becomes more difficult, and the chance of errors is increased. The z component of the points are not important, providing that the x and y components are similar. I would probably approach this as a 2.5D solution.

If the data is in a grid then you could simply start at the vert at (row1, column1) and walk through the points shifting down one, then over one, then up one, then back to the first position, collecting the vert IDs as you go, then move to the next cluster. This will then give you an array that you can pass into the polyOp.createPolygon method. Note that polys must be defined in counter-clockwise order if you want the normals to be in the correct direction.

If the data is not in rows and columns(which I will assume is true) then you have an n-squared problem(which can be slow when working with large data sets). That is, you will have to check each vertex against each other vertex to determine which is closest in a given axis in order to traverse the point cloud. With a little more information, I may be able to offer some better assistance. Screen shots always help.

-Dave