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!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    3D model of hill-like structures using SketchUp C SDK

    Scheduled Pinned Locked Moved Developers' Forum
    12 Posts 3 Posters 2.0k 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.
    • S Offline
      SrutiDavis
      last edited by

      @tt_su said:

      The Ruby API can only be used from within SketchUp, correct.

      As for the C SDK, where are you stuck? What prevents you from creating terrain geometry? The C API is generic, there is no limitations imposed to what it creates - so creating terrains is be possible.

      Hi tt_su,

      Thanks for your reply. I'm new to SketchUp and so far I have only been able to create regular shapes such as a cube or a 2D face using the SDK. How does one go about creating terrain geometry such as a sand pile? Please give some suggestions.

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

        You would first create a virtual mesh (a Geom::PolygonMesh object. All classes in the GEom module are virtual memory objects, not actual model Sketchup::DrawingElement subclasses.)

        Then to port the mesh to the model, you use Entities#add_faces_from_mesh() or Entities#fill_from_mesh().

        I'm not here much anymore.

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

          Then to tweak your mesh, you can get TT's Vertex Tools

          301 Moved Permanently

          favicon

          (www.thomthom.net)

          http://www.thomthom.net/software/vertex_tools/images/VertexToolsTincan.jpg

          💭

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • S Offline
            SrutiDavis
            last edited by

            @dan rathbun said:

            You would first create a virtual mesh (a Geom::PolygonMesh object. All classes in the GEom module are virtual memory objects, not actual model Sketchup::DrawingElement subclasses.)

            Then to port the mesh to the model, you use Entities#add_faces_from_mesh() or Entities#fill_from_mesh().

            Hi Dan,

            Thanks for your reply. The methods and objects you proposed are from the Ruby API. I want to be able to do the same using C API since I am working from another application and not using the SketchUp interface.
            So how can I create terrain geometry using the C API?

            1 Reply Last reply Reply Quote 0
            • tt_suT Offline
              tt_su
              last edited by

              @srutidavis said:

              Thanks for your reply. I'm new to SketchUp and so far I have only been able to create regular shapes such as a cube or a 2D face using the SDK. How does one go about creating terrain geometry such as a sand pile? Please give some suggestions.

              If you observe the construction of the mesh that Sandbox you'll see that each square is made up of two triangular faces with a soft+smooth edge shared between them.
              If you have your set of 3d points that represent the sand pile you'd iterate over it, generating the triangulation needed.

              1 Reply Last reply Reply Quote 0
              • tt_suT Offline
                tt_su
                last edited by

                @dan rathbun said:

                You would first create a virtual mesh (a Geom::PolygonMesh object. All classes in the GEom module are virtual memory objects, not actual model Sketchup::DrawingElement subclasses.)

                Then to port the mesh to the model, you use Entities#add_faces_from_mesh() or Entities#fill_from_mesh().

                That doesn't apply to this particular question though, as he's trying to use the C API to generate the geometry.

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

                  Sorry.. but does the C API have interfaces for Geom classes ?

                  Does it have an interface for add_faces_from_mesh ?

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • tt_suT Offline
                    tt_su
                    last edited by

                    @dan rathbun said:

                    Sorry.. but does the C API have interfaces for Geom classes ?

                    Does it have an interface for add_faces_from_mesh ?

                    The C API interfaces with the SketchUp core, it does not interface with Ruby.

                    There are similar functions though, such as SUEntitiesAddFaces and SUEntitiesFill, but they are not 1:1 mappings.

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

                      OK thanks. I have not had time to delve into it yet.

                      I thought it would have virtual helper classes like the Ruby API has in the Geom module.
                      But I suppose being C, there is a wealth of such libraries that a C programmer could choose to use, even OpenGL, or MS GDI libs ?

                      I'm not here much anymore.

                      1 Reply Last reply Reply Quote 0
                      • tt_suT Offline
                        tt_su
                        last edited by

                        There is, yes. But the C API isn't finalized either. It's still being developed and we are improving it to make it have a similar coverage as the Ruby API.

                        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