Simpler Extruding with Python

Hello wonderfull Blenderpeople,

i’ve started coding in Python, after i used the visual language of the UE4 for quite some time now.

I’m working on a script in Blender, that reads a csv which contains xyz coordinats of points. These points shall become vertices and be connect by lines. First point to the second, second to the third, and so on.

I already got a plane, with all vertices merged at the center to a vertex. Now i wanted to extrude the first vertex created with the Merge op, but when i copy paste the command i get a huge line of code with a lot of settings. Is there a way to shorten this? i mean i dont need to set all these things up. I just want a line from vertex to vertex…

And recently i came across the extrude repeat function. Would this be usefull for my usecase? In my mind i would have the code read out how many points are in the csv, extrude this amount, and then get the coordinats of the individual vertices. Is this possible?

I would be thankfull if someone could nudge me in a direction so i know where to lock at, or what functions and ops i should take a look at…

thanks for your time!

Hi. Could you clarify again what you exactly are trying to achieve?

You say here that you want to extrude a vertex.

But then here you say that you want to F / connect two vertices together to form an edge. Which are you trying to do?

Are you trying to do both, extrude a point then connect it to another vertex?

Hey RPaladin,

sorry for my unprecise description.

i think i need to extrude the vertex, would be more efficient because it would be connected to the first vertex (i guess? if it works the same as i would do it by hand…)

You may look at the mesh.from_pydata explained here :
the tutorial is a bit outdated but that should work.

if you give a list of vertices and edge it should do what you want IIRC.

Good Luck !

Going with extrude is possible but a bit more complicated,
You’ll have to mimic edit mode, like selecting points, extruding and setting the right coordinates for the endpoints.

In that case it’s much simpler to generate the correct mesh, if I understand correctly what you want, you already have the point position and you only need to link them with an edge. Seem simpler to generate that mesh in one go.

Thanks i’m going to take a look at it during the weekend!!!

this really helped me!!! Thank you!!!

now i need to figure out how to do this with a csv :smiling_face_with_tear:

1 Like