sketchucation logo sketchucation
    • Login
    ⚠️ Attention | Having issues with Sketchucation Tools 5? Report Here

    [Plugin] colorthinfaces v1.2 20110804

    Scheduled Pinned Locked Moved Plugins
    13 Posts 4 Posters 9.9k Views 4 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.
    • TIGT Online
      TIG Moderator
      last edited by

      Copy=paste code into a file called colorthinfaces.rb in the Plugins folder, save and restart Sketchup

      ### (c) TIG 2011
      ### Usage; Type in Ruby Console
      ### TIG.colorthinfaces
      ### Any faces 'thinner' < 3mm are marked colored 'Magenta'
      ### or 'Cyan' on back to help see reversed too.
      ### To check for other dimensions add an number as an argument, e.g.
      ### TIG.colorthinfaces 10.1
      ### to mark faces < 10.1 current units e.g. 10.1mm, 10.1cm, 10.1" etc.
      ### To specify units other than 'current units' add a suffix [with '.']
      ### TIG.colorthinfaces 4.mm
      ### to marks all faces < 4mm, irrespective of the current unit settings.
      ### It's one step undo-able.
      ### v1.1 20110804 Angle faces glitch trapped.
      ### v1.2 20110804 Now marks ALL faces in model and definitions
      ### and marks faces with thin parts even if bounds are larger,
      ### back-faces become Cyan to help check reversed faces too.
      module TIG
      def self.colorthinfaces(t=3.0.mm)
        t=t.to_s.to_l
        t=t-0.1.mm ### i.e. ensure 3mm is OK
        model=Sketchup.active_model
        faces=[]
        model.entities.each{|e|faces<<e if e.class==Sketchup;;Face}
        model.definitions.each{|d|
          next if d.image?
          d.entities.each{|e|faces<<e if e.class==Sketchup;;Face}
        }
        nfaces=[]
        faces.each{|e|
          thin=false
          e.edges.each{|ed|
            sp=ed.start.position
            ve=ed.line[1]
            mp=sp.offset(ve,ed.length/2)
            tr=Geom;;Transformation.rotation(sp,e.normal,90.degrees)
            ve.transform!(tr)
            pt1=mp.offset(ve,t)
            pt2=mp.offset(ve.reverse,t)
            if e.classify_point(pt1)!=Sketchup;;Face;;PointInside and e.classify_point(pt2)!=Sketchup;;Face;;PointInside
              thin=true
              break
            end
          }
          nfaces << e if thin
        }
        nfaces.uniq!
        model.start_operation('colorthinfaces')
        nfaces.each{|e|
          e.material='Magenta'
          e.back_material='Cyan'
        }
        model.commit_operation
      end
      end
      
      

      PayPalButton

      TIG

      1 Reply Last reply Reply Quote 0
      • D Offline
        driven
        last edited by

        hi Tig,

        I don't get anything happening on the mac...

        saved and installed properly, nothing on test file, so I restarted SU and created 1mm thick cuboid, made it a group, made it a component, only default materials showing in model?

        this a mac issue?

        and if I enter it in Ruby Console it returns nil, and still nothing happens...
        john

        learn from the mistakes of others, you may not live long enough to make them all yourself...

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

          No! it needs 'raw faces' in the active_entities context - so edit the group and run it... It doesn't [yet] mine down into definition's faces...
          Incidentally there's a new version in the first post...

          TIG

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

            Here's v1.2 http://forums.sketchucation.com/viewtopic.php?p=346362#p346362
            It now marks all thin faces Magenta, even if they are part of a face that is larger than the size limit otherwise.
            It will mark 'needle' shaped faces [or larger faces with 'spikes'] provided that the average thickness of the tapering part of the face is below the size limit; i.e. it will not mark it if it is fatter than the size limit at its center.
            It colors the backs of thin faces Cyan so you can spot if they are thin AND reversed!

            TIG

            1 Reply Last reply Reply Quote 0
            • D Offline
              driven
              last edited by

              as expected?
              is this as you'd expect?

              seems to be functioning on mac

              cheers
              john

              learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                Except for that larger magenta face on the left ? Perhaps it has a thin projection we can't see in this view ??
                πŸ˜•
                You also have a lot of thin faces [Cyan] that need reversing.
                I suggest you view in Monochrome mode to see these [and thicker faces looking 'bluish'] and reverse them all... because the 'white' should show outwards in a 'solid' - especially for 3d printing or even rendering on most apps...

                TIG

                1 Reply Last reply Reply Quote 0
                • D Offline
                  driven
                  last edited by

                  hi Tig,

                  I should have left the section plane showing, the cyan is all inside,
                  and all the faces are orientated correctly,
                  I used the skp from the other thread because it was there, and although solid, it does need a good cleanup,

                  I'll test on one of my own later on...
                  john

                  learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                    No probs... πŸ˜‰
                    Feedback is welcome...............

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • K Offline
                      kyyu
                      last edited by

                      Hi Tig,

                      Works fine in simple cases, but missed some faces in this crossed pattern.
                      colorthinfaces_1.png

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

                        Kyyu

                        Strange it should look at each face the same way...
                        Can you supply that SKP so I can test it ?
                        How thin are the faces? 2.95mm might creep in ?

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • K Offline
                          kyyu
                          last edited by

                          @tig said:

                          Kyyu

                          Strange it should look at each face the same way...
                          Can you supply that SKP so I can test it ?
                          How thin are the faces? 2.95mm might creep in ?

                          TIG, I didn't save the original one, but I made up another one. The width was 2mm. Got similar result.

                          colorthinfaces_crossed faces example.skp

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

                            Capture.PNGWorked fine for me [eventually] BUT you have several 'overlaid' coplanar/coincident faces - which is a known but weird phenomenon sometimes found with small faces etc.
                            To fix it 'select all', and 'intersect with selection' - the duplicate faces disappeared and the cyan colored faces are shown.

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • Rich O BrienR Online
                              Rich O Brien Moderator
                              last edited by

                              @unknownuser said:

                              To fix it 'select all', and 'intersect with selection'

                              Is that how to fix that nuisance of faces on faces on faces etc? I never knew that πŸ‘

                              Download the free D'oh Book for SketchUp πŸ“–

                              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