Making a face
-
I'm trying to make a half circle and then pushpull it into a half cylinder.
The way I went about it was making an arccurve and then putting a line at the base of this curve. However reading through the the api it seems like it isn't possible to make a face from a curve and an edge. Is this the case? If so, what would you recommend for making a half cylinder?
@unknownuser said:
Entities.add_faceSketchUp 6.0+
The add_face method is used to create a face. You can call this method a number of ways: entities.add_face(edge1, edge2, edge3, ...) entities.add_face(edgearray) entities.add_face(pt1, pt2, pt3, ...) entities.add_face([pt1, pt2, pt3,...]) entities.add_face(curve) For the last form that takes a Curve, the curve must be closed - like a circle. Arguments: some_entities Either a series of Edge or Point3d objects, an array of Point3d objects, or a closed Curve. Returns: face a Face object if successfuldepth = 100 > width = 100 > model = Sketchup.active_model > entities = model.active_entities > pts = [] > pts[0] = [0, 0, 0] > pts[1] = [width, 0, 0] > pts[2] = [width, depth, 0] > pts[3] = [0, depth, 0] > # Add the face to the entities in the model > face = entities.add_face pts > if (face) > UI.messagebox face > else > UI.messagebox "Failure" > end -
Make the Arc.
It returns an array of its Edges.
edges=entities.add_arc(...)
You then have several ways of adding a Face from those...
For example make an array of the vertices and use those...
verts=[] edges.each{|e|verts << e.vertices} verts.flatten.uniq!
Then use
entities.add_face(verts)
There are also other ways, for example add the missing edge
ed=entities.add_line(edges[0].curve.first_edge.start.position, edges[0].curve.last_edge.end.position) edges << ed
Then use
entities.add_face(edges)
...............
etc... -
Thanks a bunch TIG, I forgot you could get the arcs edges! Still organizing all this information
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register LoginAdvertisement