Create arbitrary shape from list of points
-
Hello all,
I have an un-ordered lists of points that represent a shape in 3d, both on the edge and inside the shape. I am trying to use the API to draw that shape, filled in, and ignoring the points on the inside.
I realise that this is no small task, but was hoping that you may be able to give me some pointers on where to start so i don't re-write parts of the API.
I have been playing with polygon mesh and seeing if i could get it to just draw a cube, but i'm not getting the result i hoped for...no faces, just lines joining the 8 points.
Thanks!
test = Geom;;PolygonMesh.new test.add_point([0,0,0]) test.add_point([0,0,1]) test.add_point([0,1,0]) test.add_point([0,1,1]) test.add_point([1,0,0]) test.add_point([1,0,1]) test.add_point([1,1,0]) test.add_point([1,1,1]) test.add_polygon(1,2,3,4,5,6,7,8) test_gp = Sketchup.active_model.entities.add_group test_gp.entities.add_face([0,0,0])
-
-
Also look at how the SketchUp Team makes shapes in the Shapes plugin example:
http://extensions.sketchup.com/en/content/shapes -
@tig said:
Look at http://www.sketchup.com/intl/en/developer/docs/ourdoc/entities#add_faces_from_mesh
Thanks for that TIG. I had a look at that and with my simple cube example, it did not quite give me the result i was hoping for. DO i need to manually join the other edges?
@dan rathbun said:
Also look at how the SketchUp Team makes shapes in the Shapes plugin example:
http://extensions.sketchup.com/en/content/shapesThanks Dan. I have had a look at that and it seems to describe how to do basic shapes, however what I am looking at is a bit more complex (despite my example) and shaped more like a balloon, or a very irregular shape.
Advertisement