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

    Request: Group to Component Plugin

    Scheduled Pinned Locked Moved Plugins
    14 Posts 6 Posters 1.3k Views 6 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.
    • thomthomT Offline
      thomthom
      last edited by

      @kmead said:

      Should per chance I end up in Trondheim, I will be more than happy to proffer a cookie or more likely a beer.

      Karl

      πŸ‘ πŸ˜„ πŸ‘

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

      1 Reply Last reply Reply Quote 0
      • DavidBoulderD Offline
        DavidBoulder
        last edited by

        I think an ideal user workflow is to pick the object you want to use as your component and identify it. If it is a group convert it to a component. Once you have identified that, then manually pick all of the groups you want to be replaced with the component, and then have the script automate that.

        I hadn't realized that a group acted like a component until I tried to copy a group into inside, and SketchUp wouldn't let me.

        --

        David Goldwasser
        OpenStudio Developer
        National Renewable Energy Laboratory

        1 Reply Last reply Reply Quote 0
        • bmikeB Offline
          bmike
          last edited by

          thomthom - nice tools!
          how have i lived so long without them?

          thanks.

          http://www.yorkblog.com/eatersdigest/Cookie Stack.jpg

          mike beganyi design + consulting llc

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

            @davidboulder said:

            I think an ideal user workflow is to pick the object you want to use as your component and identify it. If it is a group convert it to a component. Once you have identified that, then manually pick all of the groups you want to be replaced with the component, and then have the script automate that.

            I hadn't realized that a group acted like a component until I tried to copy a group into inside, and SketchUp wouldn't let me.

            If you have selected a bunch of components you can use the Component Browser to replace all selected with the one you right-click in the browser and choose "Replace".

            You can also use this plugin to replace any selected groups / components with one that you pick in the model: http://forums.sketchucation.com/viewtopic.php?f=323&t=26008&p=223994

            The catch here is that often the group/component insertion point differs.

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

            1 Reply Last reply Reply Quote 0
            • Chris FullmerC Offline
              Chris Fullmer
              last edited by

              I had pretty good success find matching groups inside a model just by comparing geometry. # of faces, edges, types of materials, lengths of all edges, area of all faces. Just that alone starts to find many groups that are identical that could be collapsed into the same component. The next step was to test edge vectors and compare them to make sure all edges were in the same direction. I never got that worked out because that then requires working out the rotation of the group, and potentially the scaling. Or maybe it ends up helping to identify what the rotation is. Again, I never quite got that worked out in my mind.

              But the idea is do-able. I'm just slowly working on a few other scripts so I will not have time to touch this one any time soon. But I think it would be a great one.

              Chris

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

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

                @chris fullmer said:

                I had pretty good success find matching groups inside a model just by comparing geometry. # of faces, edges, types of materials, lengths of all edges, area of all faces. Just that alone starts to find many groups that are identical that could be collapsed into the same component. The next step was to test edge vectors and compare them to make sure all edges were in the same direction. I never got that worked out because that then requires working out the rotation of the group, and potentially the scaling. Or maybe it ends up helping to identify what the rotation is. Again, I never quite got that worked out in my mind.

                I was scribbling down time ideas earlier today (before I even saw this thread). I was thinking that one could start with one vertex in the source, and then look for a vertex in the target that has the same number of edges, faces, face areas, edge lengths.
                Then when you find a match for that, pick an edge in the source and then a matching edge in the target. Now use Transformation.axis to transform the 3D coordinates of all the vertices of the target into the coordinate system of the source. Now it should be possible to iterate them all to ensure they are identical. If they are you can replace the target with the source and account for the different insertion point and axis.

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

                1 Reply Last reply Reply Quote 0
                • DavidBoulderD Offline
                  DavidBoulder
                  last edited by

                  Maybe you could do some pre-testing with the bounding box, but to deal with rotation you would want to get the relative bounding box of the entities in the group (from within the group) vs. the global bounding box.

                  If two groups have the same bounding box then you can do further testing to see if they are the same.

                  Of course if SU could just turn groups into components on import that would be great.

                  --

                  David Goldwasser
                  OpenStudio Developer
                  National Renewable Energy Laboratory

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

                    @davidboulder said:

                    Of course if SU could just turn groups into components on import that would be great.

                    You'd still have the same problem very often.
                    When I import from Revit, many windows that are in reality the same come in with various insertion points. And some are mirrored.

                    The pre-checks are one thing, good for speeding up comparison - but it's determining the difference between the local co-ordinates of the two objects that is the core problem to tackle.

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

                    1 Reply Last reply Reply Quote 0
                    • plot-parisP Offline
                      plot-paris
                      last edited by

                      such a tool would be of tremendous help! especially when importing models with excessively recurring objects (like trees with thousands of leaves).
                      taking the example of a tree again it is important for the script not only to identify the orientation of similar groups, but to evaluate the scaling as well (defining the scale of the source component as 1).

                      and to make everything perfect this plugin should be able to work on components as well as on groups (because some importers make every object a component, leaving you with a mess and an unaccessible component browser).

                      big task ahead there, thomthom... πŸ˜„

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

                        @plot-paris said:

                        and to make everything perfect this plugin should be able to work on components as well as on groups (because some importers make every object a component, leaving you with a mess and an unaccessible component browser).

                        Revit grumble grumble

                        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