sketchucation logo sketchucation
    • 登入
    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

    [Plugin] triangulateFaces.rb v1.2 20101120

    已排程 已置頂 已鎖定 已移動 Plugins
    97 貼文 21 Posters 110.6k 瀏覽 21 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • TIGT 離線
      TIG Moderator
      最後由 TIG 編輯

      Now new improved 'triangulate' - It now 'triangulates' [almost] everything...
      PayPalButton
      Script: triangulate.rb
      Code Usage: triangulate(array_of_faces)
      Result: it triangulates faces in array...
      Plugin Usage:
      Result: it triangulates faces in selection...
      Known Issues:
      Even complex single looped faces should work OK.
      Simple faces with one or two holes are also usually OK.
      Very large numbers of faces might cause a 'white-out',
      processing is continuing, please be patient...
      Complex faces with complex multiple holes in them might 'splat' !
      Add some extra dividing lines and retry...
      Very small faces might not work properly and 'splat' ! Scale them...
      Failed triangulations are warned and can be undone...
      Save your work before using this tool...
      v1.0 First issue. 20090703
      v1.1 4 sided faces with 3 in line vertices trapped.
      undo operation added. 20090703 pm
      v1.2 L-shaped AND 4-sided faces trapped. 20090703 pm+
      v1.3 Menu added, warns if no suitable selection. 20090703 pm++
      v2.0 Now triangulates all >= 4-sided faces and traps awkward L/U/holed
      shapes etc. 20090707
      v2.1 Renamed 'triangulatefaces' to avoid clashes with delauney/cloud etc.
      20090708

      Now Obsolete - see triangulateFaces.rb later in thread... HERE http://forums.sketchucation.com/viewtopic.php?p=175613#p175613

      TIG

      1 條回覆 最後回覆 回覆 引用 0
      • TIGT 離線
        TIG Moderator
        最後由 編輯

        Updated
        v1.1 4-sided faces with 3 in line vertices trapped,undo operation added 20090703pm
        http://forums.sketchucation.com/viewtopic.php?p=169956#p169956

        TIG

        1 條回覆 最後回覆 回覆 引用 0
        • Chris FullmerC 離線
          Chris Fullmer
          最後由 編輯

          Are you going to put into the menu system? Or just run it in the webconsole? or...?

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

          1 條回覆 最後回覆 回覆 引用 0
          • S 離線
            sepo
            最後由 編輯

            Well it does not appear in plugins menu nor in context menu.

            1 條回覆 最後回覆 回覆 引用 0
            • BurkhardB 離線
              Burkhard
              最後由 編輯

              What's the difference to this plugin?
              Author unknown!


              triangulateSelected.rb

              [http://www.ia-plus.de(http://www.ia-plus.de)]

              1 條回覆 最後回覆 回覆 引用 0
              • BurkhardB 離線
                Burkhard
                最後由 編輯

                It is possible to add a seperate " add detail" tool for further triangulations?
                It could be usefull for detail modeling.

                1- Triangulate face and open:
                2- Input Box with values like: 10x and available smoothcheckbox
                3- Set complete triangulation in one step

                You can seperate the Sandbox " add detail" from the original script. But then the new script should be coded ( with strings) in the same way to add it in one toolbar.

                usefull?

                [http://www.ia-plus.de(http://www.ia-plus.de)]

                1 條回覆 最後回覆 回覆 引用 0
                • TIGT 離線
                  TIG Moderator
                  最後由 編輯

                  OK, OK... 😎 Here's v1.3 http://forums.sketchucation.com/viewtopic.php?p=169956#p169956
                  It now has a menu and traps for unsuitable selections...

                  I only made it as a quick hack because Chris asked how to triangulate the quad faces of a sphere........................

                  TIG

                  1 條回覆 最後回覆 回覆 引用 0
                  • TIGT 離線
                    TIG Moderator
                    最後由 編輯

                    Here's v1.2 http://forums.sketchucation.com/viewtopic.php?p=169956#p169956

                    Burkhard: To add extra detail sub-division to faces use my Advertex+.rb tools - using the appropriate modifier key you can add a vertex onto a face and new edges will then be added up to it from every face-vertex...
                    It's a little different from the other script (which I don't recall seeing before) - mine only sub-divides quads - as Chris's request and it also traps for any possible new 'dividing' edges not falling on the face - e.g. with L-shaped or 3nr co-linear-vertex faces...

                    B/Chris: It runs by selecting some faces and then typing triangulate in the Ruby-console... To add a menu item you can simply add these lines onto the end of the script using a plain-text editor...

                    ### Menu ###
                    UI.menu("Plugins").add_item("Triangulate 4-edged Face in Selection"){triangulate}if not file_loaded?(File.basename(__FILE__))
                    file_loaded(File.basename(__FILE__))
                    

                    TIG

                    1 條回覆 最後回覆 回覆 引用 0
                    • TIGT 離線
                      TIG Moderator
                      最後由 編輯

                      Here's v2.0, now new improved - 'triangulates' [almost] everything...
                      http://forums.sketchucation.com/viewtopic.php?p=169956#p169956

                      TIG

                      1 條回覆 最後回覆 回覆 引用 0
                      • Chris FullmerC 離線
                        Chris Fullmer
                        最後由 編輯

                        Thanks TIG, this is great!!!

                        Lately you've been tan, suspicious for the winter.
                        All my Plugins I've written

                        1 條回覆 最後回覆 回覆 引用 0
                        • TIGT 離線
                          TIG Moderator
                          最後由 編輯

                          Here's v2.1, I've renamed the command triangulatefaces(array_of_faces) as 'triangulate' was already a defined command inside delauney/cloud scripts etc, used to triangulate points...
                          http://forums.sketchucation.com/viewtopic.php?p=169956#p169956
                          Please replace earlier versions with this new file to avoid clashes...

                          TIG

                          1 條回覆 最後回覆 回覆 引用 0
                          • S 離線
                            sepo
                            最後由 編輯

                            Cheers Tig...nice one.

                            1 條回覆 最後回覆 回覆 引用 0
                            • C 離線
                              CPhillips
                              最後由 編輯

                              Here is the method I use:

                              
                              def triangulateFace(face)
                                  ents=Sketchup.active_model.active_entities
                                  faces=face.mesh.polygons
                                  verts=face.mesh.points
                                  faces.each{|f|
                                      ents.add_line(verts[f[0].abs-1],verts[f[1].abs-1])
                                      ents.add_line(verts[f[1].abs-1],verts[f[2].abs-1])
                                      ents.add_line(verts[f[2].abs-1],verts[f[0].abs-1])
                                  }       
                              end
                              
                              

                              The nice thing is it cant fail to triangulate regardless of the shape or number of holes. But it unfortunately adds faces to the "holes". Or rather Sketchup does. Does anyone a way to add an edge without Sketchup attempting the "heal" the face?

                              1 條回覆 最後回覆 回覆 引用 0
                              • TIGT 離線
                                TIG Moderator
                                最後由 編輯

                                I thought of that approach but abandoned it because of that facing hole problem...

                                TIG

                                1 條回覆 最後回覆 回覆 引用 0
                                • K 離線
                                  kwistenbiebel
                                  最後由 編輯

                                  Thank you TIG for this plugin. 👍

                                  Do we still need to add those extra lines in the ruby console to get the plugin in a menu?
                                  I couldn't find it in the Plugins/Tools menu, thus my question...

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • TIGT 離線
                                    TIG Moderator
                                    最後由 編輯

                                    @kwistenbiebel said:

                                    Thank you TIG for this plugin. 👍

                                    Do we still need to add those extra lines in the ruby console to get a menu?
                                    I couldn't find it in the Plugins/Tools menu, thus my question...

                                    'Triangulate Faces in Selection' should be in the Plugins menu...

                                    TIG

                                    1 條回覆 最後回覆 回覆 引用 0
                                    • K 離線
                                      kwistenbiebel
                                      最後由 編輯

                                      Strange, I can't find it anywhere in my long long plugin list 😳 .
                                      Maybe it clashes with some other plugin? (I do have WxSU installed which caused me trouble with other plugins in the past).
                                      By the way, I am on SU6 Pro.

                                      1 條回覆 最後回覆 回覆 引用 0
                                      • TIGT 離線
                                        TIG Moderator
                                        最後由 編輯

                                        @kwistenbiebel said:

                                        Strange, I can't find it anywhere in my long long plugin list 😳 .
                                        Maybe it clashes with some other plugin? (I do have WxSU installed which caused me trouble with other plugins in the past).
                                        By the way, I am on SU6 Pro.

                                        If you have 2.1 open it in a text editor and read the last bit it should define the menu...

                                        TIG

                                        1 條回覆 最後回覆 回覆 引用 0
                                        • C 離線
                                          CPhillips
                                          最後由 編輯

                                          I finally figured out how to triangulate any face without the side effect of filling holes.

                                          def triangulateFace(face)
                                              mesh=face.mesh(1)
                                              faces=mesh.polygons
                                              verts=mesh.points
                                              uvs=mesh.uvs(true)
                                              outmesh = Geom;;PolygonMesh.new
                                              faces.each{|f|
                                                  outmesh.add_polygon(verts[f[0].abs-1],verts[f[1].abs-1],verts[f[2].abs-1])
                                              }
                                              ents=Sketchup.active_model.active_entities
                                              mat=face.material
                                              face.erase!
                                              grp = ents.add_group
                                              grp.entities.add_faces_from_mesh(outmesh)
                                              grp.entities.each{|e|
                                                  if(e.class==Sketchup;;Edge)
                                                      e.smooth=false
                                                      e.soft=false            
                                                  elsif(e.class==Sketchup;;Face && mat!=nil)
                                                         #handle materials and uvs.
                                                      uva=verts.index(e.vertices[0].position)
                                                      uvb=verts.index(e.vertices[1].position)
                                                      uvc=verts.index(e.vertices[2].position)
                                                      e.material=mat
                                                      e.position_material(mat,[verts[uva],uvs[uva],verts[uvb],uvs[uvb],verts[uvc],uvs[uvc]],true)
                                                  end
                                              }
                                              grp.explode
                                          end
                                          
                                          1 條回覆 最後回覆 回覆 引用 0
                                          • C 離線
                                            Coronel
                                            最後由 編輯

                                            Could you please clarify for a 3D newie the purpose of triangulation in this case?
                                            Does it means the model will be correct or will work better or is merely a way of get more detail?

                                            1 條回覆 最後回覆 回覆 引用 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 1 / 5
                                            • 第一個貼文
                                              最後的貼文
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement