sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Create arbitrary shape from list of points

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 528 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

      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
      • TIGT Offline
        TIG Moderator
        last edited by

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

        TIG

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          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

            @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
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement