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

    Asking For Help Points are not planar (resolved)

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 3 Posters 809 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.
    • M Offline
      Mcdull
      last edited by Mcdull

      i am trying to read polyline from xml document,then to generate three-dimensional wall.now there is a problem that just lines in the X direction can be drawn,the others in the y direction can not be drawn,and show a message that
      Error: #<ArgumentError: E:\test\RubyApplication1\lib\main.rb:250:in `add_face': Points are not planar>

      // if i draw the lines in the y -direction by it self,it can be done, i dont know why?pelese help me!
      thank u very much!

      [code][code][code][/code][/code][/code]
      

      [attachment=1:3jpuek0d]<!-- ia1 -->main.rar<!-- ia1 -->[/attachment:3jpuek0d]

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        Would help if you enclosed your code in the CODE tag so it doesn't get smileys in the code - and it will preserve formatting. And with such a long code it's probably easier to just attach it.

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • M Offline
          Mcdull
          last edited by

          @thomthom said:

          Would help if you enclosed your code in the CODE tag so it doesn't get smileys in the code - and it will preserve formatting. And with such a long code it's probably easier to just attach it.

          ok,i have done.thank u

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            Have you outputted the loopVertices to the Ruby Console content before passing on add_face? Just to visually inspect the data?

            Have to look further into what the code does before I can say anything more.

            But this code, right before line 250.

            
            loopVertices = []
            for v in loop
              loopVertices.push([v.x,v.y,v.z])
            end
            
            

            Should that not say for v in loop.vertices ?

            I gather that you want an array of 3D points?

            That can be written:

            
            loopVertices = loop.vertices.collect { |v| v.position }
            
            

            Vertex.position returns a Point3D for that Vertex.

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • M Offline
              Mcdull
              last edited by

              @thomthom said:

              Have you outputted the loopVertices to the Ruby Console content before passing on add_face? Just to visually inspect the data?

              Have to look further into what the code does before I can say anything more.

              But this code, right before line 250.

              
              > loopVertices = []
              > for v in loop
              >   loopVertices.push([v.x,v.y,v.z])
              > end
              > 
              

              Should that not say for v in loop.vertices ?

              I gather that you want an array of 3D points?

              That can be written:

              
              > loopVertices = loop.vertices.collect { |v| v.position }
              > 
              

              yes ,i have inspected all the loopvertices to the Ruby Console content,every wall has 6 faces.
              but if passing on add_face,the error will come out with the message points are not planar.
              Vertex.position returns a Point3D for that Vertex.

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by

                I think I got that error sometime when I had only 3 points. I thought there must be some mistake as any 3 points are planar. I found out later that the 3 points were in fact linear, and thus not planar.

                Maye this is what is happening?

                
                pts = [ [0, 0, 0], [1, 0, 0], [2, 0, 0] ]
                Sketchup.active_model.entities.add_face pts
                Error; #<ArgumentError; (eval);65;in `add_face'; Points are not planar>
                
                

                Hi

                1 Reply Last reply Reply Quote 0
                • M Offline
                  Mcdull
                  last edited by

                  i have solved the problem ,thank u

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    @mcdull said:

                    i have solved the problem ,thank u

                    And what was it?

                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      Mcdull
                      last edited by

                      @thomthom said:

                      @mcdull said:

                      i have solved the problem ,thank u

                      And what was it?

                      when i generate 3d wall,some points are not planar.i have changed the function.

                      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