• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[Plugin] Face(s) to group(s)

Scheduled Pinned Locked Moved Plugins
11 Posts 7 Posters 21.7k Views
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.
  • B Offline
    bentleykfrog
    last edited by bentleykfrog 22 Oct 2010, 10:18

    I thought I'd re-write this script to provide an edge-condition for the grouping. Thanks to Didier and Gavvy for permission to publish this.

    This is my first attempt at a sketchup ruby script though i've had some previous experience with OOP, so any advice/suggestions would be greatly appreciated.

    The script can be accessed through the menu 'Plugins' -> 'Face(s) to Group(s)' or 'Context Menu (With Face Selected)' -> 'Face(s) to Group(s)'

    First select some ungrouped geometry containing faces and run one of three commands:

    F2G: by Any Edge: Creates a single group for each face selected

    F2G: by Hard Edge: Creates a single group for each collection of faces defined by a hard edged outer loop

    F2G: by Hard + Hard Hidden: Creates a single group for collection of faces defined by either a hard edged outer loop or a hard hidden edged outer loop

    The first option can create an incredible amount of groups if there is a large selection, and Sketchup tends to slow down at around 750 groups per context, so F2G: by Hard Edge and F2G: by Hard + Hard Hidden gives you some control of the division of each group. F2G: by Hard Edge combined with an intersect operation allows you to define the cutting planes for large geometry, ie.

    1. Group the selection of faces you want to divide

    2. Enter this group and change the face style to wireframe to select and hide all the edges inside the group

    3. Switch the style to any style other than wireframe and in a seperate group define some cutting planes to divide up the faces

    4. In the first group, select all geometry and run 'intersect faces' -> 'with model' from the context menu

    5. In the first group, select all geometry and run 'Face(s) to Group(s)' -> 'F2G: by Hard Edge' from the context menu

    This should create groups seperated by the 'hard' edge created by the cutting planes.

    In this version there are also some extra settings to change the edge style during the operation. They can be accessed by the menu 'Plugins' -> 'Face(s) to Group(s)':

    Preserve Edge Condition: Does exactly that, leaves the edges in the selection as they are

    Restore Hidden Edges: Turns all hidden edges into unhidden edges

    All Edges Hard: Turns all edges in the selection to unhidden, unsoft and unsmooth (ie a hard edge)

    Changelog

    • 13th January 2011 (v0.51)

    • General Maintenance: Added sketchup 6 check for start_operation (thanks to Jim and Daarboven)


    Face(s) to Group(s) version 0.51 (2011-01-13)

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 22 Oct 2010, 10:41

      Could you please post this as a separate thread? That way it's easier to locate the plugin when it's at the top of the thread. When they are further down in the post list it's very hard to find.

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

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gaieus
        last edited by 22 Oct 2010, 11:18

        Topic split.

        Gai...

        1 Reply Last reply Reply Quote 0
        • W Offline
          wg19861110
          last edited by 23 Oct 2010, 15:57

          Think U!I learn more

          1 Reply Last reply Reply Quote 0
          • D Offline
            daarboven
            last edited by 12 Jan 2011, 14:15

            I noticed this doesn't work with SU 6 because of this line:

            model.start_operation("Face(s) to Group(s)",true)
            

            if you edit it to

            model.start_operation("Face(s) to Group(s)")
            

            leaving out the second parameter it works in SU 6.

            Thanks for the plug, anyway.

            regards

            1 Reply Last reply Reply Quote 0
            • E Offline
              Edson
              last edited by 12 Jan 2011, 14:22

              what is a hard edge in sketchup?

              edson mahfuz, architect| porto alegre • brasil
              http://www.mahfuz.arq.br

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by 12 Jan 2011, 14:41

                @daarboven said:

                I noticed this doesn't work with SU 6 because of this line:

                model.start_operation("Face(s) to Group(s)",true)
                

                if you edit it to

                model.start_operation("Face(s) to Group(s)")
                

                leaving out the second parameter it works in SU 6.

                Thanks for the plug, anyway.

                regards

                Right. I have been using this:

                
                if Sketchup.version.to_f < 7.0
                  Sketchup.active_model.start_operation("Operation")
                else
                  Sketchup.active_model.start_operation("Operation", true)
                end
                
                

                It ain't pretty, but it is clear and even explains a little about the reason.

                Hi

                1 Reply Last reply Reply Quote 0
                • B Offline
                  bentleykfrog
                  last edited by 12 Jan 2011, 23:44

                  @jim said:

                  @daarboven said:

                  I noticed this doesn't work with SU 6 because of this line:

                  model.start_operation("Face(s) to Group(s)",true)
                  

                  if you edit it to

                  model.start_operation("Face(s) to Group(s)")
                  

                  leaving out the second parameter it works in SU 6.

                  Thanks for the plug, anyway.

                  regards

                  Right. I have been using this:

                  
                  > if Sketchup.version.to_f < 7.0
                  >   Sketchup.active_model.start_operation("Operation")
                  > else
                  >   Sketchup.active_model.start_operation("Operation", true)
                  > end
                  > 
                  

                  It ain't pretty, but it is clear and even explains a little about the reason.

                  Thanks for the tips Jim and Daarboven, I've updated the script to check for this.

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    bentleykfrog
                    last edited by 12 Jan 2011, 23:48

                    @edson said:

                    what is a hard edge in sketchup?

                    I presumed it was the opposite of a hidden, soft or smooth edge

                    @bentleykfrog said:

                    All Edges Hard: Turns all edges in the selection to unhidden, unsoft and unsmooth (ie a hard edge)

                    If there's better terminology for this I'll update the code.

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      daarboven
                      last edited by 17 Jan 2011, 10:35

                      @bentleykfrog said:

                      @jim said:

                      @daarboven said:

                      I noticed this doesn't work with SU 6 because of this line:

                      model.start_operation("Face(s) to Group(s)",true)
                      

                      if you edit it to

                      model.start_operation("Face(s) to Group(s)")
                      

                      leaving out the second parameter it works in SU 6.

                      Thanks for the plug, anyway.

                      regards

                      Right. I have been using this:

                      
                      > > if Sketchup.version.to_f < 7.0
                      > >   Sketchup.active_model.start_operation("Operation")
                      > > else
                      > >   Sketchup.active_model.start_operation("Operation", true)
                      > > end
                      > > 
                      

                      It ain't pretty, but it is clear and even explains a little about the reason.

                      Thanks for the tips Jim and Daarboven, I've updated the script to check for this.

                      Thanks for the update, and yes, the version conditional is much more readable!!! If the start_operation method would have default values for the parameters, older versions would have stayed out of trouble 😉

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        thomthom
                        last edited by 17 Jan 2011, 10:56

                        The second argument is optional. It just didn't exist in older versions.

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

                        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