• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[Plugin] 2dBoolean ver1.3.1 beta UPDATE 20 dec 2013

Scheduled Pinned Locked Moved Plugins
88 Posts 8 Posters 48.8k 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.
  • J Offline
    jolran
    last edited by 31 Aug 2011, 21:59

    He he! No worries πŸ˜„

    Sometimes when I reread my posts I wonder what the heck I was talking about. That's why I post so many pictures πŸ˜„ To clear things up.

    This new code of yours look very nice. Can't wait to test it out.

    @unknownuser said:

    tedges.uniq!

    Haven't seen that command before? To remove duplicates? Need to read more about pure Ruby...

    @unknownuser said:

    Once that's all done we can worry about making the group into the gluing/cutting component, with corrected axes as before...

    I was thinking of putting in the option to make group instead of component, should one wish. Could be useful if the user only has edges with no faces.

    Thanks a lot for your help, TIG!

    1 Reply Last reply Reply Quote 0
    • J Offline
      jolran
      last edited by 1 Sept 2011, 06:41

      I'm having trouble with this part of the code. Maybe should add some parameters to it?

      faces.each{|gface|
      pt=gface.bounds.center.project_to_plane(face.plane)
      if face.classify_point(pt)==Sketchup;;Face;;PointOutside
      tedges << gface.edges
      gface.erase!
      end
      }
      

      If you look at the picture, you will see that it might not work in all cases with that code.
      Especially when having big faces.

      In the earlier posts I was trying to figure out a way to erase faces more selectively.
      By using IF the FACES center==HOLES center >> erase.faces! (Simplified code)

      However, when I did that, sometimes there where errors. Or faces that would not get deleted.


      Faced with a problem-2.jpg

      1 Reply Last reply Reply Quote 0
      • T Offline
        TIG Moderator
        last edited by 1 Sept 2011, 09:58

        The .flatten! combines nested arrays
        The .uniq! removes duplicates
        Also [not applicable to THIS tool] .compact! would remove 'nil' array elements, or .sort! puts the list 'in order'...

        Now to the chase.........
        I also see this 'unexpected' possibility of faces we want to keep being false-flagged as 'holes'.
        So we need to trap for real 'hole' faces - the outer_loop edges will always have two faces...

        faces2go=[]### rather than erase as we go we'll collect them...
        faces.each{|gface|
          ### we skip the gface IF it's NOT a 'hole'
          ### just 1 one-faced edges is enough for != hole
          hole=true
          gface.outer_loop.edges.each{|e|
            if e.faces.length==1
              hole=false
              break
            end
          }
          next if not hole
          ###
          pt=gface.bounds.center.project_to_plane(face.plane)
          if face.classify_point(pt)==Sketchup;;Face;;PointOutside
            tedges << gface.edges
            faces2go << gface ### save them up
          end
        }
        
        

        THEN erase_entities on faces2go and then erase! any of the tedges that don't have a face...

        TIG

        1 Reply Last reply Reply Quote 0
        • J Offline
          jolran
          last edited by 1 Sept 2011, 13:01

          @unknownuser said:

          The .flatten! combines nested arrays
          The .uniq! removes duplicates
          Also [not applicable to THIS tool] .compact! would remove 'nil' array elements, or .sort! puts the list 'in order'...

          πŸ‘ Great to know. Will be useful.

          Your code works! Almost

          Like with the method I used before(face.clone holes.centers), I'm experiencing some faces don't get erased. (Having a model that look like a swiss cheese)

          I wonder why this happends. Your code should be working...

          For ex. I run the plugin once. Maybe 3 faces are not deleted but the edges are trimmed to fit. I run the plugin again with the component selected, then it is OK!

          It is like it needs another rescue operation? πŸ˜• Or maybe run the last command twice? Seems excessive..

          I will check my code as well. Been moving snippets back and forth, it need some cleaning up.

          And another thing. Was it GO for NOT using faceclone? Intersect with SS or Glue face?
          I havent implemented that yet, still using face.clone. Shouldent matter in this regard...


          Almost.jpg

          1 Reply Last reply Reply Quote 0
          • J Offline
            jolran
            last edited by 1 Sept 2011, 15:02

            Think it is ok...

            Breaks sometimes, but only if using a simple squarish component. One have to consider what this tool is going to be used for.

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 1 Sept 2011, 15:10

              Try intersecting the group.entities with the face.edges+[face] twice ?
              Will make it slightly slower... BUT it might fix the potential glitch ??

              TIG

              1 Reply Last reply Reply Quote 0
              • J Offline
                jolran
                last edited by 1 Sept 2011, 15:34

                Yes TIG, I think you are on the right track there! Good thinking.

                I was about to report that intersection is not working properly. One cannot erase a face if it can't be selected πŸ˜„

                This can be due to my code being a bit shabby at the moment, moving stuff back and forth as mentioned.

                I will "clean it" and report back later.

                1 Reply Last reply Reply Quote 0
                • J Offline
                  jolran
                  last edited by 1 Sept 2011, 23:27

                  2 intersection gave a big improvement! Not 100% accurate, but I think it's good enough. One can force it by selecting the component and running the plugin again. It almost always sort out the fuzz, then.

                  Still intersecting with face.clone. Had some problem with intersecting with Sketchup.active.model selection...Expecting entitiy something..

                  Speed is better, even with 2 intersections πŸ˜‰

                  Did a test with a "heavy" component, ver 1.1 VS current dev.code. VER 1.1: 41.483 seconds. current dev.code: 4.278 seconds 😲

                  Do we move forward, TIG? Or delve deeper in this problem, to make perfection?


                  2 intersections.jpg

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    jolran
                    last edited by 2 Sept 2011, 09:16

                    Ok, I have put out the new version 1.2 for testing. So you have something to play with this weekend.
                    It should be an improvement..

                    KEEP THE OLDER VERSION AT HANDS! I won't be able to fix issues this weekend πŸ˜„

                    Thank you TIG for all the help.

                    I haven't optimized the iterator exactley as TIG suggested, so that can be improved...

                    There are more issues to deal with later on.. But let's not spoil all the fun.

                    1 Reply Last reply Reply Quote 0
                    • andybotA Offline
                      andybot
                      last edited by 7 Oct 2011, 17:27

                      Joel, thanks so much for this plugin!! I have 2d elevations that I needed to glue to a massing, and this works absolutely perfect for my needs. Good work!
                      Andy

                      http://charlottesvillearchitecturalrendering.com/

                      1 Reply Last reply Reply Quote 0
                      • A Offline
                        AcesHigh
                        last edited by 7 Oct 2011, 22:40

                        can anyone check if this pluging works with meshes?

                        when importing several pieces from GoogleMaps, the pieces usually end overlapping each other, causing texture errors.

                        You cant use 3D boolean because obviously, meshes, are not solids.

                        So I would usually "zorro" the different meshes, and cut the parts that overlap. Obviously, a HUGE work when you are dealing with dozens of different GoogleEarth imported meshes. If this plugin works with those, it will be great!

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          jolran
                          last edited by 8 Oct 2011, 19:12

                          Hey, I missed some posts in here!

                          Andybot. I'm glad someone have use for this plugin! Appreciate it!(we all know TIG's part of this of course)

                          AcesHigh.

                          I've seen your request in other post regarding this subject. Like I said. I think it lies more in the 3d domain, since the surfaces are not flat.

                          IF the intersecting geometry would be flat at intersectionpoints, 2dBoolean should activate. But I see your case you would need a subtraction-algorythm.

                          At this point 2dboolean only subtracts geometry outside the face it's lying on(or selected face).

                          What you are asking for is really needed, and I will see what can be done about that in the future. I'm kinda busy at the moment.

                          Have to deal with Hatchfaces webdialog, which unfortunaly proves very difficult.
                          I thought I only had to learn Javascript, HTML, CSS and JQUERY πŸ˜‰ . But there is need for some JSON and maybe AJAX as well. Kinda much required to make a simple dialog if you ask me.

                          1 Reply Last reply Reply Quote 0
                          • J Offline
                            jolran
                            last edited by 29 Nov 2011, 14:32

                            Nice update.

                            But! If you are gonna further developp this tool, and display it in this thread with my icons included. Please don't scramble the code, so other can benefit from your code like you did on mine and Tig's.

                            Besides your plugin will be lost in this thread posting it here.

                            Best regards.

                            1 Reply Last reply Reply Quote 0
                            • JuantxoJ Offline
                              Juantxo
                              last edited by 29 Nov 2011, 15:43

                              Sorry, but actually I prefer the code scrambled. The code is not very optimized because I did it to translate to C after.
                              I don't use any line of your code. I used a simplicans planar theory. (I taked your one icon, feel free of use my icons)

                              Best regards

                              1 Reply Last reply Reply Quote 0
                              • jeff hammondJ Offline
                                jeff hammond
                                last edited by 29 Nov 2011, 15:48

                                @juantxo said:

                                Sorry, but actually I prefer the code scrambled. The code is not very optimized because I did it to translate to C after.
                                I don't use any line of your code. I used a simplicans planar theory. (I taked your one icon, feel free of use my icons)

                                Best regards

                                watch out, the πŸ€“ 's around here will unscramble your code and make sure you're telling the truth πŸ’š

                                dotdotdot

                                1 Reply Last reply Reply Quote 0
                                • J Offline
                                  jolran
                                  last edited by 29 Nov 2011, 16:28

                                  @unknownuser said:

                                  I don't use any line of your code

                                  Ok. If you say so.

                                  @unknownuser said:

                                  I taked your one icon, feel free of use my icons

                                  That's ok. I don't mind that. 2 min PS for me.

                                  @unknownuser said:

                                  Sorry, but actually I prefer the code scrambled

                                  Ok, about that. I find it somewhat strange to post stuff for free, scrambled. thats not very helpful for other programmers.. Personally I rather tell to much then nothing at all.

                                  1 Reply Last reply Reply Quote 0
                                  • JuantxoJ Offline
                                    Juantxo
                                    last edited by 25 Jan 2012, 16:08

                                    Actually I'm working in 2D boolean of polygons in Sketchup because I need for other stuff. I did this plugin using simplicians theory.
                                    May be could be usefull for someone.

                                    You need to select two groups with a general planar polygon.
                                    General planar polygon = A single polygon or a polygon consisting of a set of non-intersecting single polygons.

                                    DOWNLOAD 2d_simplex_bool.rbz

                                    http://skelion.net/bool/2dbool.jpg

                                    1 Reply Last reply Reply Quote 0
                                    • J Offline
                                      jolran
                                      last edited by 20 Dec 2013, 16:03

                                      New version 1.3.1 added:

                                      http://sketchucation.com/forums/viewtopic.php?f=323%26amp;t=39661

                                      Whole lot is rewritten so there may be lot of things broken. I suggest a lot of testing and report back bugs and wishes πŸ˜„

                                      Intersections should now be a Little quicker. And some new stuff as well.

                                      Make sure to read the manual in second post.

                                      Will try and add to pluginstore later.

                                      1 Reply Last reply Reply Quote 0
                                      • J Offline
                                        jolran
                                        last edited by 20 Dec 2013, 17:31

                                        Manual

                                        Since ver 1.3.1


                                        manual_2dBoolean.zip

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          TIG Moderator
                                          last edited by 21 Dec 2013, 14:31

                                          I added it to the SketchUcation PluginStore for you... πŸ€“
                                          http://sketchucation.com/resources/pluginstore?pln=2dBoolean
                                          You might want to edit the listing and add documentation, release notes etc...

                                          TIG

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

                                          Advertisement