• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Create arbitrary shape from list of points

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 3 Posters 487 Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    wackywally
    last edited by 16 Aug 2015, 10:44

    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])
    
    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 16 Aug 2015, 12:44

      Look at http://www.sketchup.com/intl/en/developer/docs/ourdoc/entities#add_faces_from_mesh

      TIG

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 16 Aug 2015, 13:27

        Also look at how the SketchUp Team makes shapes in the Shapes plugin example:
        http://extensions.sketchup.com/en/content/shapes

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • W Offline
          wackywally
          last edited by 19 Aug 2015, 01:51

          @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?

          http://i.imgur.com/FxA4R7em.png

          @dan rathbun said:

          Also look at how the SketchUp Team makes shapes in the Shapes plugin example:
          http://extensions.sketchup.com/en/content/shapes

          Thanks 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.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          1 / 1
          • First post
            1/4
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement