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?
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 = []
a.push mesh.add_point l.edges[0].start.position
a.push mesh.add_point l.edges[0].start.position+[0,0,-@height]
l.edges.each {|e|
a.push mesh.add_point e.end.position
mesh.add_polygon a.reverse
a.shift
a.push mesh.add_point e.end.position+[0,0,-@height]
mesh.add_polygon a
a.shift
}
end
#add the mesh to the group
g3.entities.add_faces_from_mesh mesh
}
I guess this is pretty close to a pushpull in the Z_Axis except for the outside surface.
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
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