# Easy way to extrude line?

Is there an easy programmatical way to extrude a curve? I can iterate over all the edges and then create faces from the edges in the desired direction but it seems like there might be an easy way to do this that I am unaware of and without the extensive programming.

for example if I created a spline and then wanted to extrude that line in the Z direction 5", is there an easy way to do this?

Iâ€™m guessing this is a developer question rather than an extension one. Are you asking for how to code it within your extension?

yes, looking for a programming solution. sorry if this is the wrong category!

from looking at that plugin it is quite useful but looks like there is no easy way to create lines.

You mean create surfaces. You need to write the method to do it. Once the method is written (with the appropriate arguments,) you can reuse it to extrude any curve or set of edges.

It is a simple coding exercise to iterate the vertices in the objects passed into the method, and transform each vertexâ€™s position (a `Geom::Point3d`) by a vector (in your example case, a vector parallel to `Z_AXIS` with a length of 5 inches.) This transforming of the vertices positions give you the end points for each of the vertical edges that your method must draw.
Your method will need to keep these end points in an array, as this array will need to be iterated to draw closing edges across the top of the surface.
The last step would be to soften / smooth the interior vertical edges leaving only the outside end edges â€śhardâ€ť.

So yes pretty easy, with the number of them I decided to try using a polygonmesh. Which I have all the faces, the problem is that it would appear that all the edges are soft and smooth. Is there a way to control that on the creation of the polygon face? My code looks like this:

`````` #for all the inside loops
face.loops.each {|l|
#create a mesh for each loop
mesh = Geom::PolygonMesh.new
if !l.outer?
a = []
l.edges.each {|e|
a.shift
a.shift
}
end
#add the mesh to the group
}
``````

I guess this is pretty close to a pushpull in the Z_Axis except for the outside surface.

1 Like

Nevermind I found the documentation here
add_faces_from_mesh and it shows how to handle the soft/smooth and the indexesâ€¦

1 Like

Thereâ€™s already an free extension called Pushline on the Extension Warehouse. Would that do what you want?

someone mentioned that earlier, I was looking for a programmatic way to do it, hoping that there was some built in function that mostly did it. Not so, so I just iterate the curve and add to a mesh with appropriate edge params

The pushline pluginâ€™s .rb files arenâ€™t encrypted. You could look to see how the author did it, if that might be helpful.

There was nothing special in his code. For my use case it is very simple, (Z_Axis) so it is just iterating on the loops transforming the points, adding to a polygonmess and then adding the mesh to the group. Done