sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Get points from a Sketchup object

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 1.6k 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.
    • V Offline
      vhiguita
      last edited by

      Is there a method in ruby or a way to get all the 3D points (x,y,z) from a sketchup Object?

      Thanks in advance.

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Moved this to the Developers' Forum where it will get better attention...

        https://developers.google.com/sketchup/docs/ourdoc/boundingbox
        returns info like center and the eight corners of the object's bounds.

        https://developers.google.com/sketchup/docs/ourdoc/transformation
        returns info like 'origin', rotation etc.

        If you want the 'vertices' [end-points] of all edges in an object you iterate the edges, collect an array of the edge.vertices, .flatten! it, .uniq! it and then iterate the vertices, collecting all of the vertex.position point3d info which is xyz - however if it's an instance or group you need to apply its transformation to these to get them in 'model-coordinates' if needed...

        TIG

        1 Reply Last reply Reply Quote 0
        • A Offline
          Aerilius
          last edited by

          An object of what you mean is a Sketchup Drawingelement.

          If the Drawingelement is a Face, Edge, ArcCurve or Curve, it will have a method to get all vertices, and for each vertex you can get the position (which is what you want):
          positions = face.vertices.map{|v| v.position}

          If the Drawingelement is a Group, ComponentInstance of Image, it is "a model" in the model any you have to loop over the contained entities:
          group.parent.entities.find_all{|e| e.respond_to?(:vertices) }. map{|e| e.vertices.map{|v| v.position} }.flatten
          or with
          component.definition.entities

          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