sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Self intersect

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 3 Posters 254 Views 3 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.
    • voljankoV Offline
      voljanko
      last edited by

      I'm trying to intersect a group with itself like this:

      group.entities.intersect_with false, group.transformation, group.entities,
         group.transformation, true, group.entities
      

      but with a type mismatch error.
      What is wrong,how to intersect a group with itself?

      SuSolid.com - solid check - solid repair- solid intersection check - weight plugin

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

        From the user comments at the bottom of the Entities class:

        @unknownuser said:

        intersect_with is a little confusing. The parameter entities1 needs to be an Entities object. The parameter entities2 needs to be a single Entity, or an array of Entity - but NOT and Entities object. Better parm names would be "output_entities" and "entity_list"

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

        1 Reply Last reply Reply Quote 0
        • voljankoV Offline
          voljanko
          last edited by

          Now it is ok,thanks.Here is the code:

          transformation = Geom;;Transformation.new   
          faces=[]
          group.entities.each do |entity|
             if entity.is_a?( Sketchup;;Face)
                faces.push entity
             end
          end
          group.entities.intersect_with false, transformation, group.entities,transformation, true, faces
          

          p.s.where do you read the user comments of the API?

          SuSolid.com - solid check - solid repair- solid intersection check - weight plugin

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

            group.entities.intersect_with false, group.transformation, group.entities, group.transformation, true, group.entities.to_a
            Should also work without having to filter out entities.

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

            1 Reply Last reply Reply Quote 0
            • voljankoV Offline
              voljanko
              last edited by

              Yes,but transformations should be "new",otherwise the intersection lines are displaced.
              p.s.where do you read the user comments of the API?

              SuSolid.com - solid check - solid repair- solid intersection check - weight plugin

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

                @voljanko said:

                p.s.where do you read the user comments of the API?

                At the bottom of the pages in the API docs.
                Mind you, I found that if my browser is set to prefer a non-English language the reader is redirected to a page without the comments.

                The URL that has the comments look like this: http://code.google.com/apis/sketchup/docs/ourdoc/entities.html
                If you are redirected then it's the Google pages trying to be "smart" and redirect you to a localized page - which is nothing but the very same page as the English, just without the comments.

                Annoyingly one has to change one's browser settings to prefer English first.

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

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

                  The API comments are at the end of each section and might be over more than one 'page' if there are several of them.

                  Using 'new' transformations, without arguments, sets it to the ORIGIN [0,0,0] - which may work OK.
                  But using the 'group.transformation' for both required transformations to ensure that the group's geometry intersects with itself, and it returns the intersection geometry in the same location should work ? Perhaps not if the group has been moved ?? 😕

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • voljankoV Offline
                    voljanko
                    last edited by

                    Grrr,I hate the "smart" pages. 😠
                    There are no comments on my API pages.I will try to change setting in my browser.

                    @unknownuser said:

                    But using the 'group.transformation' for both required transformations to ensure that the group's geometry intersects with itself, and it returns the intersection geometry in the same location should work ? Perhaps not if the group has been moved ??

                    I have tested it... and it is only ok, if both the transformations are "new".

                    SuSolid.com - solid check - solid repair- solid intersection check - weight plugin

                    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