sketchucation logo sketchucation
    • Login
    1. Home
    2. oajfh
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    O
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 22
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: PolygonMesh triangulation... ?

      Hi.

      First off, thanks for the speedy reply !

      If I understand correctly what you mean, then my mesh creation piece of code would be what causes the problem. I am trying to have a general PolygonMesh that contains the points, indexes and face point indexes for a cube, and this is what the code looks like :

      def self.incomplete_make_mesh faces puts "Mesh creation started" mesh = Geom::PolygonMesh.new faces.each_with_index do |face,index| if face.is_a? Sketchup::Face temp_mesh = face.mesh mesh.add_polygon(temp_mesh.points) end end puts 'Polygons : '+ mesh.polygons.to_s puts 'Points : '+ mesh.points.to_s return mesh end

      When I make a component of a cube, I break it recursively down into its faces (so far I've been assuming I only have one component, I haven't yet tried compensating local component origins, but that's another matter) and then creating the polygon this way.

      Judging from your reply, I'm assuming there's something wrong with my approach. I can't debug this piece of code for now as my computer is not with me (just my Ruby scripts, ahaha), but you get three indexes per face with your piece of code, and I get more with mine.

      posted in Developers' Forum
      O
      oajfh
    • PolygonMesh triangulation... ?

      Greetings,

      I am a fairly new Sketchup plugin developer, and I have a couple of questions about some aspects of the PolygonMesh class which I need for what I am doing.

      Essentially, I've been trying to understand the exact behavior of this class. From what I've seen, it can create meshes -polygon meshes- from faces of a SketchUp model. It also enables one to get the vertex normals from the face (I've no interest in texturing at the moment).

      So essentially, it doesn't triangulate my faces. It just gives me the points and point indexes for each face.

      On the other hand, this old topic states that there is some triangulation involved :
      http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=40006%26amp;p=354223%26amp;hilit=triangulation#p354223

      I'm a little confused. It is an old topic, so perhaps the behavior of that class has changed, but why would the possibility to access the triangles directly from the API be removed in that case ?

      Anyway, if I'm right, and it isn't possible to obtain pretriangulated meshes, then I'm going to assume I either need to use the SDK, or do it by hand using Ruby and some triangulation algorithm.

      If I'm wrong, and it is possible to get the SketchUp triangles from within the API, then how is it I obtain some polygons with more than three indexes for the faces, and how should I proceed in order to obtain triangulated meshes ?

      Sorry if this seems obvious to some of you, but I find the API documentation a little unclear for that class, and the research I've done hasn't clarified it for me.

      Cheers.

      posted in Developers' Forum
      O
      oajfh
    • 1
    • 2
    • 2 / 2