• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

[Plugin] CleanUp

Scheduled Pinned Locked Moved Plugins
974 Posts 217 Posters 787.9k 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.
  • T Offline
    thomthom
    last edited by 29 Oct 2009, 21:55

    Yea, I've been thinking of something like that. Get that kind of stuff importing from revit. But the problem there is that the axis, insertion point, is different. So I can't just go by that. I'd have to compare the geometry...

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

    1 Reply Last reply Reply Quote 0
    • C Offline
      Chris Fullmer
      last edited by 29 Oct 2009, 23:24

      I think about this too from time to time. And one of the problems is that it might be easy enough if all components were inserted with the same rotation, but it gets tricky if all components are rotated differently.

      To help compare, you could take all edges from comp1 and compare its length against all edge lengths in comp 2. They should have all the same amount, of the same lengths if they are possibly the same component. That would help determine if you should continue comparing the two components.

      Also, you could compensate for components that are the same, with different scale factors by the same idea. Get all edge lengths for each. Then take each comps shorteest edge, and scale it up to be the length of the other comps smallest edge. Get that scale factor, and scale all edges the same. THen compare to see if the newly scaled lengths all equal the target component's edge lengths. And voi-la, theres a way to test for scale differences.

      Just some ideas while they were still in my mind.

      Chris

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

      1 Reply Last reply Reply Quote 0
      • T Offline
        thomthom
        last edited by 29 Oct 2009, 23:27

        I was thinking of taking the source object and start of with an entity, compare it and it's connected faces and edges (length and angle betweens) and then iterate through the target object and look for matches. Once a match is found, iterate to next entity in the source and see if it compares to any of the potential next entities in the target.

        ...too complicated...?

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

        1 Reply Last reply Reply Quote 0
        • C Offline
          Chris Fullmer
          last edited by 29 Oct 2009, 23:45

          I think something like that is what you would end up having to do, but I was imagining you could cut out a lot of groups by first testing them with whay I was suggesting. If for example, you have 100 groups. And you don't know if they are possibly same components or not, you could test them based on their entity number.

          All groups with the same amount of entities, then get tested together for the same amount of edges, same amount of faces. Those that still have matching numbers move on to the next round of comparisons. Maybe we are down to 10 that have the same amount of entities, same number of edges and faces.

          Then compare those 10 based on all edge lengths. If their edge lengths don't match up, maybe try adjusting the scale using them method I outlined. Then if by chance you end up with any components that match entity.length, and edge amounts, and face amounts, and their edge lengths all match, then maybe you have a good chance of them being the same component.

          Then at that point, I was thinking you could look for any edge length that only has 1 identical edge length match in the other group. Then you have a starting point for aligning axes, using the identical edges. Just take one component and transform it to its one edge would be aligned to the other edge. Then you could compare all their point3d positions and see if they all are the same.

          Of course, that would all be done with temporary groups or proxy Point3d objects or something.. The original group would need to remain unaffected. But I think you could identify groups that appeared to be identical based on entity counts, edge lengths, etc. Then take those and try to aligned them, you could then just test their points against eachother. And if their points are identical, you've got a match!

          That is how I would forsee it happening. What I like about this method is that there is no looping through the model looking for angles. Just compare point positions.

          Just a thought,

          Chris

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

          1 Reply Last reply Reply Quote 0
          • C Offline
            Chris Fullmer
            last edited by 29 Oct 2009, 23:48

            wanna connect to my notepadd++ and work on it? 😄 PM me

            Chris

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

            1 Reply Last reply Reply Quote 0
            • T Offline
              thomthom
              last edited by 29 Oct 2009, 23:51

              That's be cool - to make some real use of that Np++ feature! But I'm off to bed. Should have been there least an hour ago.

              How many hours behind GMT are you?

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

              1 Reply Last reply Reply Quote 0
              • C Offline
                Chris Fullmer
                last edited by 29 Oct 2009, 23:53

                +8 I think. I am still at work - 16:50 here.

                Chris

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

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thomthom
                  last edited by 30 Oct 2009, 07:30

                  You mean -8 . 😉
                  A full workday in difference. Could be tricky to try this outside the weekends...

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

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    Chris Fullmer
                    last edited by 30 Oct 2009, 08:14

                    Ahh yes, -8. Yeah, I normally catch you when you wake up and I'ts like midnight here. Or in the middle of the day for me and its the middle of the night for you. So maybe this weekend we'll try it.

                    Actualyl though, I already most ofthe code. I got the part that sorts all entities and makes an arrayof all the groups to compare. Now you can just finish up everything after that 😆

                    Chris

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

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      thomthom
                      last edited by 30 Oct 2009, 08:18

                      I'll connect it to my magic 8-ball.

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

                      1 Reply Last reply Reply Quote 0
                      • E Offline
                        ely862me
                        last edited by 30 Oct 2009, 09:02

                        Kind of very useful this plugin ; i ve tried it on version 6 and it s pretty good (if u re setting well the variable debug).
                        So,thank you!

                        Take care!

                        Elisei

                        Elisei (sketchupper)


                        Before no life was done on Earth it was THE LIFE ITSELF...GOD
                        Come and See EliseiDesign

                        1 Reply Last reply Reply Quote 0
                        • P Offline
                          plot-paris
                          last edited by 30 Oct 2009, 09:11

                          guys, that new idea of the 'convert groups to components' plugin sounds exciting. I wanted such a script ever since i first importet my first model from 3Ds...
                          can't wait to see some first results 🎉

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            thomthom
                            last edited by 30 Oct 2009, 09:34

                            @ely862me said:

                            Kind of very useful this plugin ; i ve tried it on version 6 and it s pretty good (if u re setting well the variable debug).
                            So,thank you!

                            Take care!

                            Elisei

                            Regardless of the variable, you will run into a Sketchup bug where it's impossible to delete some edges, even if they are 100% planar.

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

                            1 Reply Last reply Reply Quote 0
                            • P Offline
                              pep75
                              last edited by 2 Nov 2009, 12:37

                              Brilliant Plugin ThomThom!!! Perfect!!!

                              1 Reply Last reply Reply Quote 0
                              • R Offline
                                remus
                                last edited by 9 Nov 2009, 08:35

                                You can download this plugin from the first post in this thread, there should be a link somewhere in the post or sometimes towards the bottom of the post. You dont need to have a pro license to use plugins.

                                http://remusrendering.wordpress.com/

                                1 Reply Last reply Reply Quote 0
                                • T Offline
                                  thomthom
                                  last edited by 9 Nov 2009, 08:42

                                  Yes - download link is in the first post. In this, and most others on this forum, it's at the bottom of the first post.

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

                                  1 Reply Last reply Reply Quote 0
                                  • L Offline
                                    loolytoo
                                    last edited by 9 Nov 2009, 09:00

                                    Thankyou! i got it and got it working

                                    1 Reply Last reply Reply Quote 0
                                    • T Offline
                                      tomot
                                      last edited by 9 Nov 2009, 20:16

                                      this cleanup routine is simply outrageous! 🎉

                                      Yesterday I ran the intersect with modelroutine, hoping to get rid of 3 redundant duplicate planes that each face of an imported model had been blessed with 😢 I finally stopped SU after 4 hours of trying to due that job. the SU file had grown to 600,000k in the task manager window. Your Cleanup routine on the other hand was almost instant.

                                      Well Done!

                                      [my plugins](http://thingsvirtual.blogspot.ca/)
                                      tomot

                                      1 Reply Last reply Reply Quote 0
                                      • P Offline
                                        plot-paris
                                        last edited by 16 Nov 2009, 09:34

                                        just cleaned up an imported model (from 3Ds Max).

                                        cleaned up edges: 62.700
                                        remaining edges: 84.300

                                        your plugin rocks, thomthom

                                        1 Reply Last reply Reply Quote 0
                                        • F Offline
                                          Fletch
                                          last edited by 21 Nov 2009, 01:12

                                          ThomThom, ran this plugin on a file today - it actually took it a surprising long time to clean the file! 😲

                                          So I opened Outliner and find that there are 920 uniquecomponents in the file. It was obviously imported from OBJ file into SketchUp because each component is called "OBJ_29" etc.

                                          So, if your Cleanup routine had an option "Convert All Unique Components to Groups" that would be great.

                                          It's a fairly simple model, shouldn't really be more than a 1 or 2Mb file if it was build properly in SketchUp... but it's a 29Mb file! 😮

                                          I have tried selecting all the unique components and exploding them but SU appears to be chugging along quite some time on it, and I am unsure if it's completely frozen, or just working hard and ignoring me. 😒

                                          The absolute best for AutoCAD files would be one that said "Convert Identical Groups to be Identical Components"... wished for that many times when you have 50 columns that are all the same, but each is a unique "group" from ACAD.

                                          Fletch
                                          Twilight Render Cross-platform Plugin for SketchUp on PC or Mac

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 3
                                          • 4
                                          • 5
                                          • 6
                                          • 48
                                          • 49
                                          • 4 / 49
                                          4 / 49
                                          • First post
                                            64/974
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement